1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.impl; |
8 | |
9 | import de.uka.ipd.sdq.pcm.designdecision.ProcessingResourceDegree; |
10 | import de.uka.ipd.sdq.pcm.designdecision.SchedulingPolicyDegree; |
11 | import de.uka.ipd.sdq.pcm.designdecision.designdecisionPackage; |
12 | |
13 | import de.uka.ipd.sdq.pcm.resourceenvironment.SchedulingPolicy; |
14 | |
15 | import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType; |
16 | |
17 | import java.util.Collection; |
18 | |
19 | import org.eclipse.emf.common.notify.Notification; |
20 | |
21 | import org.eclipse.emf.common.util.EList; |
22 | |
23 | import org.eclipse.emf.ecore.EClass; |
24 | import org.eclipse.emf.ecore.InternalEObject; |
25 | |
26 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
27 | |
28 | import org.eclipse.emf.ecore.util.EDataTypeUniqueEList; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * An implementation of the model object '<em><b>Scheduling Policy Degree</b></em>'. |
33 | * <!-- end-user-doc --> |
34 | * <p> |
35 | * The following features are implemented: |
36 | * <ul> |
37 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.SchedulingPolicyDegreeImpl#getProcessingresourcetype <em>Processingresourcetype</em>}</li> |
38 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.impl.SchedulingPolicyDegreeImpl#getDomainOfAllowedSchedulingPolicies <em>Domain Of Allowed Scheduling Policies</em>}</li> |
39 | * </ul> |
40 | * </p> |
41 | * |
42 | * @generated |
43 | */ |
44 | public class SchedulingPolicyDegreeImpl extends EnumDegreeImpl implements SchedulingPolicyDegree { |
45 | /** |
46 | * The cached value of the '{@link #getProcessingresourcetype() <em>Processingresourcetype</em>}' reference. |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @see #getProcessingresourcetype() |
50 | * @generated |
51 | * @ordered |
52 | */ |
53 | protected ProcessingResourceType processingresourcetype; |
54 | /** |
55 | * The cached value of the '{@link #getDomainOfAllowedSchedulingPolicies() <em>Domain Of Allowed Scheduling Policies</em>}' attribute list. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @see #getDomainOfAllowedSchedulingPolicies() |
59 | * @generated |
60 | * @ordered |
61 | */ |
62 | protected EList<SchedulingPolicy> domainOfAllowedSchedulingPolicies; |
63 | |
64 | /** |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @generated |
68 | */ |
69 | protected SchedulingPolicyDegreeImpl() { |
70 | super(); |
71 | } |
72 | |
73 | /** |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @generated |
77 | */ |
78 | @Override |
79 | protected EClass eStaticClass() { |
80 | return designdecisionPackage.Literals.SCHEDULING_POLICY_DEGREE; |
81 | } |
82 | |
83 | /** |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @generated |
87 | */ |
88 | public ProcessingResourceType getProcessingresourcetype() { |
89 | if (processingresourcetype != null && processingresourcetype.eIsProxy()) { |
90 | InternalEObject oldProcessingresourcetype = (InternalEObject)processingresourcetype; |
91 | processingresourcetype = (ProcessingResourceType)eResolveProxy(oldProcessingresourcetype); |
92 | if (processingresourcetype != oldProcessingresourcetype) { |
93 | if (eNotificationRequired()) |
94 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE, oldProcessingresourcetype, processingresourcetype)); |
95 | } |
96 | } |
97 | return processingresourcetype; |
98 | } |
99 | |
100 | /** |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @generated |
104 | */ |
105 | public ProcessingResourceType basicGetProcessingresourcetype() { |
106 | return processingresourcetype; |
107 | } |
108 | |
109 | /** |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | public void setProcessingresourcetype(ProcessingResourceType newProcessingresourcetype) { |
115 | ProcessingResourceType oldProcessingresourcetype = processingresourcetype; |
116 | processingresourcetype = newProcessingresourcetype; |
117 | if (eNotificationRequired()) |
118 | eNotify(new ENotificationImpl(this, Notification.SET, designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE, oldProcessingresourcetype, processingresourcetype)); |
119 | } |
120 | |
121 | /** |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | public EList<SchedulingPolicy> getDomainOfAllowedSchedulingPolicies() { |
127 | if (domainOfAllowedSchedulingPolicies == null) { |
128 | domainOfAllowedSchedulingPolicies = new EDataTypeUniqueEList<SchedulingPolicy>(SchedulingPolicy.class, this, designdecisionPackage.SCHEDULING_POLICY_DEGREE__DOMAIN_OF_ALLOWED_SCHEDULING_POLICIES); |
129 | } |
130 | return domainOfAllowedSchedulingPolicies; |
131 | } |
132 | |
133 | /** |
134 | * <!-- begin-user-doc --> |
135 | * <!-- end-user-doc --> |
136 | * @generated |
137 | */ |
138 | @Override |
139 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
140 | switch (featureID) { |
141 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE: |
142 | if (resolve) return getProcessingresourcetype(); |
143 | return basicGetProcessingresourcetype(); |
144 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__DOMAIN_OF_ALLOWED_SCHEDULING_POLICIES: |
145 | return getDomainOfAllowedSchedulingPolicies(); |
146 | } |
147 | return super.eGet(featureID, resolve, coreType); |
148 | } |
149 | |
150 | /** |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | @SuppressWarnings("unchecked") |
156 | @Override |
157 | public void eSet(int featureID, Object newValue) { |
158 | switch (featureID) { |
159 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE: |
160 | setProcessingresourcetype((ProcessingResourceType)newValue); |
161 | return; |
162 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__DOMAIN_OF_ALLOWED_SCHEDULING_POLICIES: |
163 | getDomainOfAllowedSchedulingPolicies().clear(); |
164 | getDomainOfAllowedSchedulingPolicies().addAll((Collection<? extends SchedulingPolicy>)newValue); |
165 | return; |
166 | } |
167 | super.eSet(featureID, newValue); |
168 | } |
169 | |
170 | /** |
171 | * <!-- begin-user-doc --> |
172 | * <!-- end-user-doc --> |
173 | * @generated |
174 | */ |
175 | @Override |
176 | public void eUnset(int featureID) { |
177 | switch (featureID) { |
178 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE: |
179 | setProcessingresourcetype((ProcessingResourceType)null); |
180 | return; |
181 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__DOMAIN_OF_ALLOWED_SCHEDULING_POLICIES: |
182 | getDomainOfAllowedSchedulingPolicies().clear(); |
183 | return; |
184 | } |
185 | super.eUnset(featureID); |
186 | } |
187 | |
188 | /** |
189 | * <!-- begin-user-doc --> |
190 | * <!-- end-user-doc --> |
191 | * @generated |
192 | */ |
193 | @Override |
194 | public boolean eIsSet(int featureID) { |
195 | switch (featureID) { |
196 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE: |
197 | return processingresourcetype != null; |
198 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__DOMAIN_OF_ALLOWED_SCHEDULING_POLICIES: |
199 | return domainOfAllowedSchedulingPolicies != null && !domainOfAllowedSchedulingPolicies.isEmpty(); |
200 | } |
201 | return super.eIsSet(featureID); |
202 | } |
203 | |
204 | /** |
205 | * <!-- begin-user-doc --> |
206 | * <!-- end-user-doc --> |
207 | * @generated |
208 | */ |
209 | @Override |
210 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
211 | if (baseClass == ProcessingResourceDegree.class) { |
212 | switch (derivedFeatureID) { |
213 | case designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE: return designdecisionPackage.PROCESSING_RESOURCE_DEGREE__PROCESSINGRESOURCETYPE; |
214 | default: return -1; |
215 | } |
216 | } |
217 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
218 | } |
219 | |
220 | /** |
221 | * <!-- begin-user-doc --> |
222 | * <!-- end-user-doc --> |
223 | * @generated |
224 | */ |
225 | @Override |
226 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
227 | if (baseClass == ProcessingResourceDegree.class) { |
228 | switch (baseFeatureID) { |
229 | case designdecisionPackage.PROCESSING_RESOURCE_DEGREE__PROCESSINGRESOURCETYPE: return designdecisionPackage.SCHEDULING_POLICY_DEGREE__PROCESSINGRESOURCETYPE; |
230 | default: return -1; |
231 | } |
232 | } |
233 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | @Override |
242 | public String toString() { |
243 | if (eIsProxy()) return super.toString(); |
244 | |
245 | StringBuffer result = new StringBuffer(super.toString()); |
246 | result.append(" (domainOfAllowedSchedulingPolicies: "); |
247 | result.append(domainOfAllowedSchedulingPolicies); |
248 | result.append(')'); |
249 | return result.toString(); |
250 | } |
251 | |
252 | } //SchedulingPolicyDegreeImpl |