1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.GDoF.impl; |
8 | |
9 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.ChangeableElementDescription; |
10 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.DegreeOfFreedom; |
11 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.GDoFPackage; |
12 | |
13 | import java.util.Collection; |
14 | |
15 | import org.eclipse.emf.common.notify.Notification; |
16 | import org.eclipse.emf.common.notify.NotificationChain; |
17 | |
18 | import org.eclipse.emf.common.util.EList; |
19 | |
20 | import org.eclipse.emf.ecore.EClass; |
21 | import org.eclipse.emf.ecore.EOperation; |
22 | import org.eclipse.emf.ecore.InternalEObject; |
23 | |
24 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
25 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
26 | |
27 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
28 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
29 | import org.eclipse.emf.ecore.util.InternalEList; |
30 | |
31 | /** |
32 | * <!-- begin-user-doc --> |
33 | * An implementation of the model object '<em><b>Degree Of Freedom</b></em>'. |
34 | * <!-- end-user-doc --> |
35 | * <p> |
36 | * The following features are implemented: |
37 | * <ul> |
38 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.DegreeOfFreedomImpl#getName <em>Name</em>}</li> |
39 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.DegreeOfFreedomImpl#getAddedElements <em>Added Elements</em>}</li> |
40 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.DegreeOfFreedomImpl#getChangeableElementDescriptions <em>Changeable Element Descriptions</em>}</li> |
41 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.DegreeOfFreedomImpl#getInteractionConstraints <em>Interaction Constraints</em>}</li> |
42 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.DegreeOfFreedomImpl#getPrimaryChangeable <em>Primary Changeable</em>}</li> |
43 | * </ul> |
44 | * </p> |
45 | * |
46 | * @generated |
47 | */ |
48 | public class DegreeOfFreedomImpl extends EObjectImpl implements DegreeOfFreedom { |
49 | /** |
50 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getName() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected static final String NAME_EDEFAULT = null; |
58 | |
59 | /** |
60 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #getName() |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected String name = NAME_EDEFAULT; |
68 | |
69 | /** |
70 | * The cached value of the '{@link #getAddedElements() <em>Added Elements</em>}' reference list. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @see #getAddedElements() |
74 | * @generated |
75 | * @ordered |
76 | */ |
77 | protected EList<EClass> addedElements; |
78 | |
79 | /** |
80 | * The cached value of the '{@link #getChangeableElementDescriptions() <em>Changeable Element Descriptions</em>}' containment reference list. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @see #getChangeableElementDescriptions() |
84 | * @generated |
85 | * @ordered |
86 | */ |
87 | protected EList<ChangeableElementDescription> changeableElementDescriptions; |
88 | |
89 | /** |
90 | * The cached value of the '{@link #getInteractionConstraints() <em>Interaction Constraints</em>}' reference list. |
91 | * <!-- begin-user-doc --> |
92 | * <!-- end-user-doc --> |
93 | * @see #getInteractionConstraints() |
94 | * @generated |
95 | * @ordered |
96 | */ |
97 | protected EList<EOperation> interactionConstraints; |
98 | |
99 | /** |
100 | * The cached value of the '{@link #getPrimaryChangeable() <em>Primary Changeable</em>}' reference. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @see #getPrimaryChangeable() |
104 | * @generated |
105 | * @ordered |
106 | */ |
107 | protected ChangeableElementDescription primaryChangeable; |
108 | |
109 | /** |
110 | * <!-- begin-user-doc --> |
111 | * <!-- end-user-doc --> |
112 | * @generated |
113 | */ |
114 | protected DegreeOfFreedomImpl() { |
115 | super(); |
116 | } |
117 | |
118 | /** |
119 | * <!-- begin-user-doc --> |
120 | * <!-- end-user-doc --> |
121 | * @generated |
122 | */ |
123 | @Override |
124 | protected EClass eStaticClass() { |
125 | return GDoFPackage.Literals.DEGREE_OF_FREEDOM; |
126 | } |
127 | |
128 | /** |
129 | * <!-- begin-user-doc --> |
130 | * <!-- end-user-doc --> |
131 | * @generated |
132 | */ |
133 | public String getName() { |
134 | return name; |
135 | } |
136 | |
137 | /** |
138 | * <!-- begin-user-doc --> |
139 | * <!-- end-user-doc --> |
140 | * @generated |
141 | */ |
142 | public void setName(String newName) { |
143 | String oldName = name; |
144 | name = newName; |
145 | if (eNotificationRequired()) |
146 | eNotify(new ENotificationImpl(this, Notification.SET, GDoFPackage.DEGREE_OF_FREEDOM__NAME, oldName, name)); |
147 | } |
148 | |
149 | /** |
150 | * <!-- begin-user-doc --> |
151 | * <!-- end-user-doc --> |
152 | * @generated |
153 | */ |
154 | public EList<EClass> getAddedElements() { |
155 | if (addedElements == null) { |
156 | addedElements = new EObjectResolvingEList<EClass>(EClass.class, this, GDoFPackage.DEGREE_OF_FREEDOM__ADDED_ELEMENTS); |
157 | } |
158 | return addedElements; |
159 | } |
160 | |
161 | /** |
162 | * <!-- begin-user-doc --> |
163 | * <!-- end-user-doc --> |
164 | * @generated |
165 | */ |
166 | public EList<ChangeableElementDescription> getChangeableElementDescriptions() { |
167 | if (changeableElementDescriptions == null) { |
168 | changeableElementDescriptions = new EObjectContainmentEList<ChangeableElementDescription>(ChangeableElementDescription.class, this, GDoFPackage.DEGREE_OF_FREEDOM__CHANGEABLE_ELEMENT_DESCRIPTIONS); |
169 | } |
170 | return changeableElementDescriptions; |
171 | } |
172 | |
173 | /** |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @generated |
177 | */ |
178 | public EList<EOperation> getInteractionConstraints() { |
179 | if (interactionConstraints == null) { |
180 | interactionConstraints = new EObjectResolvingEList<EOperation>(EOperation.class, this, GDoFPackage.DEGREE_OF_FREEDOM__INTERACTION_CONSTRAINTS); |
181 | } |
182 | return interactionConstraints; |
183 | } |
184 | |
185 | /** |
186 | * <!-- begin-user-doc --> |
187 | * <!-- end-user-doc --> |
188 | * @generated |
189 | */ |
190 | public ChangeableElementDescription getPrimaryChangeable() { |
191 | if (primaryChangeable != null && primaryChangeable.eIsProxy()) { |
192 | InternalEObject oldPrimaryChangeable = (InternalEObject)primaryChangeable; |
193 | primaryChangeable = (ChangeableElementDescription)eResolveProxy(oldPrimaryChangeable); |
194 | if (primaryChangeable != oldPrimaryChangeable) { |
195 | if (eNotificationRequired()) |
196 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, GDoFPackage.DEGREE_OF_FREEDOM__PRIMARY_CHANGEABLE, oldPrimaryChangeable, primaryChangeable)); |
197 | } |
198 | } |
199 | return primaryChangeable; |
200 | } |
201 | |
202 | /** |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | public ChangeableElementDescription basicGetPrimaryChangeable() { |
208 | return primaryChangeable; |
209 | } |
210 | |
211 | /** |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | public void setPrimaryChangeable(ChangeableElementDescription newPrimaryChangeable) { |
217 | ChangeableElementDescription oldPrimaryChangeable = primaryChangeable; |
218 | primaryChangeable = newPrimaryChangeable; |
219 | if (eNotificationRequired()) |
220 | eNotify(new ENotificationImpl(this, Notification.SET, GDoFPackage.DEGREE_OF_FREEDOM__PRIMARY_CHANGEABLE, oldPrimaryChangeable, primaryChangeable)); |
221 | } |
222 | |
223 | /** |
224 | * <!-- begin-user-doc --> |
225 | * <!-- end-user-doc --> |
226 | * @generated |
227 | */ |
228 | @Override |
229 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
230 | switch (featureID) { |
231 | case GDoFPackage.DEGREE_OF_FREEDOM__CHANGEABLE_ELEMENT_DESCRIPTIONS: |
232 | return ((InternalEList<?>)getChangeableElementDescriptions()).basicRemove(otherEnd, msgs); |
233 | } |
234 | return super.eInverseRemove(otherEnd, featureID, msgs); |
235 | } |
236 | |
237 | /** |
238 | * <!-- begin-user-doc --> |
239 | * <!-- end-user-doc --> |
240 | * @generated |
241 | */ |
242 | @Override |
243 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
244 | switch (featureID) { |
245 | case GDoFPackage.DEGREE_OF_FREEDOM__NAME: |
246 | return getName(); |
247 | case GDoFPackage.DEGREE_OF_FREEDOM__ADDED_ELEMENTS: |
248 | return getAddedElements(); |
249 | case GDoFPackage.DEGREE_OF_FREEDOM__CHANGEABLE_ELEMENT_DESCRIPTIONS: |
250 | return getChangeableElementDescriptions(); |
251 | case GDoFPackage.DEGREE_OF_FREEDOM__INTERACTION_CONSTRAINTS: |
252 | return getInteractionConstraints(); |
253 | case GDoFPackage.DEGREE_OF_FREEDOM__PRIMARY_CHANGEABLE: |
254 | if (resolve) return getPrimaryChangeable(); |
255 | return basicGetPrimaryChangeable(); |
256 | } |
257 | return super.eGet(featureID, resolve, coreType); |
258 | } |
259 | |
260 | /** |
261 | * <!-- begin-user-doc --> |
262 | * <!-- end-user-doc --> |
263 | * @generated |
264 | */ |
265 | @SuppressWarnings("unchecked") |
266 | @Override |
267 | public void eSet(int featureID, Object newValue) { |
268 | switch (featureID) { |
269 | case GDoFPackage.DEGREE_OF_FREEDOM__NAME: |
270 | setName((String)newValue); |
271 | return; |
272 | case GDoFPackage.DEGREE_OF_FREEDOM__ADDED_ELEMENTS: |
273 | getAddedElements().clear(); |
274 | getAddedElements().addAll((Collection<? extends EClass>)newValue); |
275 | return; |
276 | case GDoFPackage.DEGREE_OF_FREEDOM__CHANGEABLE_ELEMENT_DESCRIPTIONS: |
277 | getChangeableElementDescriptions().clear(); |
278 | getChangeableElementDescriptions().addAll((Collection<? extends ChangeableElementDescription>)newValue); |
279 | return; |
280 | case GDoFPackage.DEGREE_OF_FREEDOM__INTERACTION_CONSTRAINTS: |
281 | getInteractionConstraints().clear(); |
282 | getInteractionConstraints().addAll((Collection<? extends EOperation>)newValue); |
283 | return; |
284 | case GDoFPackage.DEGREE_OF_FREEDOM__PRIMARY_CHANGEABLE: |
285 | setPrimaryChangeable((ChangeableElementDescription)newValue); |
286 | return; |
287 | } |
288 | super.eSet(featureID, newValue); |
289 | } |
290 | |
291 | /** |
292 | * <!-- begin-user-doc --> |
293 | * <!-- end-user-doc --> |
294 | * @generated |
295 | */ |
296 | @Override |
297 | public void eUnset(int featureID) { |
298 | switch (featureID) { |
299 | case GDoFPackage.DEGREE_OF_FREEDOM__NAME: |
300 | setName(NAME_EDEFAULT); |
301 | return; |
302 | case GDoFPackage.DEGREE_OF_FREEDOM__ADDED_ELEMENTS: |
303 | getAddedElements().clear(); |
304 | return; |
305 | case GDoFPackage.DEGREE_OF_FREEDOM__CHANGEABLE_ELEMENT_DESCRIPTIONS: |
306 | getChangeableElementDescriptions().clear(); |
307 | return; |
308 | case GDoFPackage.DEGREE_OF_FREEDOM__INTERACTION_CONSTRAINTS: |
309 | getInteractionConstraints().clear(); |
310 | return; |
311 | case GDoFPackage.DEGREE_OF_FREEDOM__PRIMARY_CHANGEABLE: |
312 | setPrimaryChangeable((ChangeableElementDescription)null); |
313 | return; |
314 | } |
315 | super.eUnset(featureID); |
316 | } |
317 | |
318 | /** |
319 | * <!-- begin-user-doc --> |
320 | * <!-- end-user-doc --> |
321 | * @generated |
322 | */ |
323 | @Override |
324 | public boolean eIsSet(int featureID) { |
325 | switch (featureID) { |
326 | case GDoFPackage.DEGREE_OF_FREEDOM__NAME: |
327 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
328 | case GDoFPackage.DEGREE_OF_FREEDOM__ADDED_ELEMENTS: |
329 | return addedElements != null && !addedElements.isEmpty(); |
330 | case GDoFPackage.DEGREE_OF_FREEDOM__CHANGEABLE_ELEMENT_DESCRIPTIONS: |
331 | return changeableElementDescriptions != null && !changeableElementDescriptions.isEmpty(); |
332 | case GDoFPackage.DEGREE_OF_FREEDOM__INTERACTION_CONSTRAINTS: |
333 | return interactionConstraints != null && !interactionConstraints.isEmpty(); |
334 | case GDoFPackage.DEGREE_OF_FREEDOM__PRIMARY_CHANGEABLE: |
335 | return primaryChangeable != null; |
336 | } |
337 | return super.eIsSet(featureID); |
338 | } |
339 | |
340 | /** |
341 | * <!-- begin-user-doc --> |
342 | * <!-- end-user-doc --> |
343 | * @generated |
344 | */ |
345 | @Override |
346 | public String toString() { |
347 | if (eIsProxy()) return super.toString(); |
348 | |
349 | StringBuffer result = new StringBuffer(super.toString()); |
350 | result.append(" (name: "); |
351 | result.append(name); |
352 | result.append(')'); |
353 | return result.toString(); |
354 | } |
355 | |
356 | } //DegreeOfFreedomImpl |