1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EMOF.impl; |
8 | |
9 | import EMOF.EMOFPackage; |
10 | import EMOF.MultiplicityElement; |
11 | import EMOF.Operation; |
12 | import EMOF.Parameter; |
13 | |
14 | import org.eclipse.emf.common.notify.Notification; |
15 | import org.eclipse.emf.common.notify.NotificationChain; |
16 | |
17 | import org.eclipse.emf.ecore.EClass; |
18 | import org.eclipse.emf.ecore.InternalEObject; |
19 | |
20 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
21 | |
22 | import org.eclipse.emf.ecore.util.EcoreUtil; |
23 | |
24 | /** |
25 | * <!-- begin-user-doc --> |
26 | * An implementation of the model object '<em><b>Parameter</b></em>'. |
27 | * <!-- end-user-doc --> |
28 | * <p> |
29 | * The following features are implemented: |
30 | * <ul> |
31 | * <li>{@link EMOF.impl.ParameterImpl#getIsOrdered <em>Is Ordered</em>}</li> |
32 | * <li>{@link EMOF.impl.ParameterImpl#getIsUnique <em>Is Unique</em>}</li> |
33 | * <li>{@link EMOF.impl.ParameterImpl#getLower <em>Lower</em>}</li> |
34 | * <li>{@link EMOF.impl.ParameterImpl#getUpper <em>Upper</em>}</li> |
35 | * <li>{@link EMOF.impl.ParameterImpl#getOperation <em>Operation</em>}</li> |
36 | * </ul> |
37 | * </p> |
38 | * |
39 | * @generated |
40 | */ |
41 | public class ParameterImpl extends TypedElementImpl implements Parameter { |
42 | /** |
43 | * The default value of the '{@link #getIsOrdered() <em>Is Ordered</em>}' attribute. |
44 | * <!-- begin-user-doc --> |
45 | * <!-- end-user-doc --> |
46 | * @see #getIsOrdered() |
47 | * @generated |
48 | * @ordered |
49 | */ |
50 | protected static final Boolean IS_ORDERED_EDEFAULT = Boolean.FALSE; |
51 | |
52 | /** |
53 | * The cached value of the '{@link #getIsOrdered() <em>Is Ordered</em>}' attribute. |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @see #getIsOrdered() |
57 | * @generated |
58 | * @ordered |
59 | */ |
60 | protected Boolean isOrdered = IS_ORDERED_EDEFAULT; |
61 | |
62 | /** |
63 | * The default value of the '{@link #getIsUnique() <em>Is Unique</em>}' attribute. |
64 | * <!-- begin-user-doc --> |
65 | * <!-- end-user-doc --> |
66 | * @see #getIsUnique() |
67 | * @generated |
68 | * @ordered |
69 | */ |
70 | protected static final Boolean IS_UNIQUE_EDEFAULT = Boolean.TRUE; |
71 | |
72 | /** |
73 | * The cached value of the '{@link #getIsUnique() <em>Is Unique</em>}' attribute. |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @see #getIsUnique() |
77 | * @generated |
78 | * @ordered |
79 | */ |
80 | protected Boolean isUnique = IS_UNIQUE_EDEFAULT; |
81 | |
82 | /** |
83 | * The default value of the '{@link #getLower() <em>Lower</em>}' attribute. |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @see #getLower() |
87 | * @generated |
88 | * @ordered |
89 | */ |
90 | protected static final Integer LOWER_EDEFAULT = new Integer(1); |
91 | |
92 | /** |
93 | * The cached value of the '{@link #getLower() <em>Lower</em>}' attribute. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @see #getLower() |
97 | * @generated |
98 | * @ordered |
99 | */ |
100 | protected Integer lower = LOWER_EDEFAULT; |
101 | |
102 | /** |
103 | * The default value of the '{@link #getUpper() <em>Upper</em>}' attribute. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @see #getUpper() |
107 | * @generated |
108 | * @ordered |
109 | */ |
110 | protected static final Integer UPPER_EDEFAULT = new Integer(1); |
111 | |
112 | /** |
113 | * The cached value of the '{@link #getUpper() <em>Upper</em>}' attribute. |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @see #getUpper() |
117 | * @generated |
118 | * @ordered |
119 | */ |
120 | protected Integer upper = UPPER_EDEFAULT; |
121 | |
122 | /** |
123 | * <!-- begin-user-doc --> |
124 | * <!-- end-user-doc --> |
125 | * @generated |
126 | */ |
127 | protected ParameterImpl() { |
128 | super(); |
129 | } |
130 | |
131 | /** |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | @Override |
137 | protected EClass eStaticClass() { |
138 | return EMOFPackage.Literals.PARAMETER; |
139 | } |
140 | |
141 | /** |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | public Boolean getIsOrdered() { |
147 | return isOrdered; |
148 | } |
149 | |
150 | /** |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | public void setIsOrdered(Boolean newIsOrdered) { |
156 | Boolean oldIsOrdered = isOrdered; |
157 | isOrdered = newIsOrdered; |
158 | if (eNotificationRequired()) |
159 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.PARAMETER__IS_ORDERED, oldIsOrdered, isOrdered)); |
160 | } |
161 | |
162 | /** |
163 | * <!-- begin-user-doc --> |
164 | * <!-- end-user-doc --> |
165 | * @generated |
166 | */ |
167 | public Boolean getIsUnique() { |
168 | return isUnique; |
169 | } |
170 | |
171 | /** |
172 | * <!-- begin-user-doc --> |
173 | * <!-- end-user-doc --> |
174 | * @generated |
175 | */ |
176 | public void setIsUnique(Boolean newIsUnique) { |
177 | Boolean oldIsUnique = isUnique; |
178 | isUnique = newIsUnique; |
179 | if (eNotificationRequired()) |
180 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.PARAMETER__IS_UNIQUE, oldIsUnique, isUnique)); |
181 | } |
182 | |
183 | /** |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | public Integer getLower() { |
189 | return lower; |
190 | } |
191 | |
192 | /** |
193 | * <!-- begin-user-doc --> |
194 | * <!-- end-user-doc --> |
195 | * @generated |
196 | */ |
197 | public void setLower(Integer newLower) { |
198 | Integer oldLower = lower; |
199 | lower = newLower; |
200 | if (eNotificationRequired()) |
201 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.PARAMETER__LOWER, oldLower, lower)); |
202 | } |
203 | |
204 | /** |
205 | * <!-- begin-user-doc --> |
206 | * <!-- end-user-doc --> |
207 | * @generated |
208 | */ |
209 | public Integer getUpper() { |
210 | return upper; |
211 | } |
212 | |
213 | /** |
214 | * <!-- begin-user-doc --> |
215 | * <!-- end-user-doc --> |
216 | * @generated |
217 | */ |
218 | public void setUpper(Integer newUpper) { |
219 | Integer oldUpper = upper; |
220 | upper = newUpper; |
221 | if (eNotificationRequired()) |
222 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.PARAMETER__UPPER, oldUpper, upper)); |
223 | } |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | public Operation getOperation() { |
231 | if (eContainerFeatureID() != EMOFPackage.PARAMETER__OPERATION) return null; |
232 | return (Operation)eContainer(); |
233 | } |
234 | |
235 | /** |
236 | * <!-- begin-user-doc --> |
237 | * <!-- end-user-doc --> |
238 | * @generated |
239 | */ |
240 | public NotificationChain basicSetOperation(Operation newOperation, NotificationChain msgs) { |
241 | msgs = eBasicSetContainer((InternalEObject)newOperation, EMOFPackage.PARAMETER__OPERATION, msgs); |
242 | return msgs; |
243 | } |
244 | |
245 | /** |
246 | * <!-- begin-user-doc --> |
247 | * <!-- end-user-doc --> |
248 | * @generated |
249 | */ |
250 | public void setOperation(Operation newOperation) { |
251 | if (newOperation != eInternalContainer() || (eContainerFeatureID() != EMOFPackage.PARAMETER__OPERATION && newOperation != null)) { |
252 | if (EcoreUtil.isAncestor(this, newOperation)) |
253 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
254 | NotificationChain msgs = null; |
255 | if (eInternalContainer() != null) |
256 | msgs = eBasicRemoveFromContainer(msgs); |
257 | if (newOperation != null) |
258 | msgs = ((InternalEObject)newOperation).eInverseAdd(this, EMOFPackage.OPERATION__OWNED_PARAMETER, Operation.class, msgs); |
259 | msgs = basicSetOperation(newOperation, msgs); |
260 | if (msgs != null) msgs.dispatch(); |
261 | } |
262 | else if (eNotificationRequired()) |
263 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.PARAMETER__OPERATION, newOperation, newOperation)); |
264 | } |
265 | |
266 | /** |
267 | * <!-- begin-user-doc --> |
268 | * <!-- end-user-doc --> |
269 | * @generated |
270 | */ |
271 | @Override |
272 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
273 | switch (featureID) { |
274 | case EMOFPackage.PARAMETER__OPERATION: |
275 | if (eInternalContainer() != null) |
276 | msgs = eBasicRemoveFromContainer(msgs); |
277 | return basicSetOperation((Operation)otherEnd, msgs); |
278 | } |
279 | return super.eInverseAdd(otherEnd, featureID, msgs); |
280 | } |
281 | |
282 | /** |
283 | * <!-- begin-user-doc --> |
284 | * <!-- end-user-doc --> |
285 | * @generated |
286 | */ |
287 | @Override |
288 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
289 | switch (featureID) { |
290 | case EMOFPackage.PARAMETER__OPERATION: |
291 | return basicSetOperation(null, msgs); |
292 | } |
293 | return super.eInverseRemove(otherEnd, featureID, msgs); |
294 | } |
295 | |
296 | /** |
297 | * <!-- begin-user-doc --> |
298 | * <!-- end-user-doc --> |
299 | * @generated |
300 | */ |
301 | @Override |
302 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
303 | switch (eContainerFeatureID()) { |
304 | case EMOFPackage.PARAMETER__OPERATION: |
305 | return eInternalContainer().eInverseRemove(this, EMOFPackage.OPERATION__OWNED_PARAMETER, Operation.class, msgs); |
306 | } |
307 | return super.eBasicRemoveFromContainerFeature(msgs); |
308 | } |
309 | |
310 | /** |
311 | * <!-- begin-user-doc --> |
312 | * <!-- end-user-doc --> |
313 | * @generated |
314 | */ |
315 | @Override |
316 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
317 | switch (featureID) { |
318 | case EMOFPackage.PARAMETER__IS_ORDERED: |
319 | return getIsOrdered(); |
320 | case EMOFPackage.PARAMETER__IS_UNIQUE: |
321 | return getIsUnique(); |
322 | case EMOFPackage.PARAMETER__LOWER: |
323 | return getLower(); |
324 | case EMOFPackage.PARAMETER__UPPER: |
325 | return getUpper(); |
326 | case EMOFPackage.PARAMETER__OPERATION: |
327 | return getOperation(); |
328 | } |
329 | return super.eGet(featureID, resolve, coreType); |
330 | } |
331 | |
332 | /** |
333 | * <!-- begin-user-doc --> |
334 | * <!-- end-user-doc --> |
335 | * @generated |
336 | */ |
337 | @Override |
338 | public void eSet(int featureID, Object newValue) { |
339 | switch (featureID) { |
340 | case EMOFPackage.PARAMETER__IS_ORDERED: |
341 | setIsOrdered((Boolean)newValue); |
342 | return; |
343 | case EMOFPackage.PARAMETER__IS_UNIQUE: |
344 | setIsUnique((Boolean)newValue); |
345 | return; |
346 | case EMOFPackage.PARAMETER__LOWER: |
347 | setLower((Integer)newValue); |
348 | return; |
349 | case EMOFPackage.PARAMETER__UPPER: |
350 | setUpper((Integer)newValue); |
351 | return; |
352 | case EMOFPackage.PARAMETER__OPERATION: |
353 | setOperation((Operation)newValue); |
354 | return; |
355 | } |
356 | super.eSet(featureID, newValue); |
357 | } |
358 | |
359 | /** |
360 | * <!-- begin-user-doc --> |
361 | * <!-- end-user-doc --> |
362 | * @generated |
363 | */ |
364 | @Override |
365 | public void eUnset(int featureID) { |
366 | switch (featureID) { |
367 | case EMOFPackage.PARAMETER__IS_ORDERED: |
368 | setIsOrdered(IS_ORDERED_EDEFAULT); |
369 | return; |
370 | case EMOFPackage.PARAMETER__IS_UNIQUE: |
371 | setIsUnique(IS_UNIQUE_EDEFAULT); |
372 | return; |
373 | case EMOFPackage.PARAMETER__LOWER: |
374 | setLower(LOWER_EDEFAULT); |
375 | return; |
376 | case EMOFPackage.PARAMETER__UPPER: |
377 | setUpper(UPPER_EDEFAULT); |
378 | return; |
379 | case EMOFPackage.PARAMETER__OPERATION: |
380 | setOperation((Operation)null); |
381 | return; |
382 | } |
383 | super.eUnset(featureID); |
384 | } |
385 | |
386 | /** |
387 | * <!-- begin-user-doc --> |
388 | * <!-- end-user-doc --> |
389 | * @generated |
390 | */ |
391 | @Override |
392 | public boolean eIsSet(int featureID) { |
393 | switch (featureID) { |
394 | case EMOFPackage.PARAMETER__IS_ORDERED: |
395 | return IS_ORDERED_EDEFAULT == null ? isOrdered != null : !IS_ORDERED_EDEFAULT.equals(isOrdered); |
396 | case EMOFPackage.PARAMETER__IS_UNIQUE: |
397 | return IS_UNIQUE_EDEFAULT == null ? isUnique != null : !IS_UNIQUE_EDEFAULT.equals(isUnique); |
398 | case EMOFPackage.PARAMETER__LOWER: |
399 | return LOWER_EDEFAULT == null ? lower != null : !LOWER_EDEFAULT.equals(lower); |
400 | case EMOFPackage.PARAMETER__UPPER: |
401 | return UPPER_EDEFAULT == null ? upper != null : !UPPER_EDEFAULT.equals(upper); |
402 | case EMOFPackage.PARAMETER__OPERATION: |
403 | return getOperation() != null; |
404 | } |
405 | return super.eIsSet(featureID); |
406 | } |
407 | |
408 | /** |
409 | * <!-- begin-user-doc --> |
410 | * <!-- end-user-doc --> |
411 | * @generated |
412 | */ |
413 | @Override |
414 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
415 | if (baseClass == MultiplicityElement.class) { |
416 | switch (derivedFeatureID) { |
417 | case EMOFPackage.PARAMETER__IS_ORDERED: return EMOFPackage.MULTIPLICITY_ELEMENT__IS_ORDERED; |
418 | case EMOFPackage.PARAMETER__IS_UNIQUE: return EMOFPackage.MULTIPLICITY_ELEMENT__IS_UNIQUE; |
419 | case EMOFPackage.PARAMETER__LOWER: return EMOFPackage.MULTIPLICITY_ELEMENT__LOWER; |
420 | case EMOFPackage.PARAMETER__UPPER: return EMOFPackage.MULTIPLICITY_ELEMENT__UPPER; |
421 | default: return -1; |
422 | } |
423 | } |
424 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
425 | } |
426 | |
427 | /** |
428 | * <!-- begin-user-doc --> |
429 | * <!-- end-user-doc --> |
430 | * @generated |
431 | */ |
432 | @Override |
433 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
434 | if (baseClass == MultiplicityElement.class) { |
435 | switch (baseFeatureID) { |
436 | case EMOFPackage.MULTIPLICITY_ELEMENT__IS_ORDERED: return EMOFPackage.PARAMETER__IS_ORDERED; |
437 | case EMOFPackage.MULTIPLICITY_ELEMENT__IS_UNIQUE: return EMOFPackage.PARAMETER__IS_UNIQUE; |
438 | case EMOFPackage.MULTIPLICITY_ELEMENT__LOWER: return EMOFPackage.PARAMETER__LOWER; |
439 | case EMOFPackage.MULTIPLICITY_ELEMENT__UPPER: return EMOFPackage.PARAMETER__UPPER; |
440 | default: return -1; |
441 | } |
442 | } |
443 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
444 | } |
445 | |
446 | /** |
447 | * <!-- begin-user-doc --> |
448 | * <!-- end-user-doc --> |
449 | * @generated |
450 | */ |
451 | @Override |
452 | public String toString() { |
453 | if (eIsProxy()) return super.toString(); |
454 | |
455 | StringBuffer result = new StringBuffer(super.toString()); |
456 | result.append(" (isOrdered: "); |
457 | result.append(isOrdered); |
458 | result.append(", isUnique: "); |
459 | result.append(isUnique); |
460 | result.append(", lower: "); |
461 | result.append(lower); |
462 | result.append(", upper: "); |
463 | result.append(upper); |
464 | result.append(')'); |
465 | return result.toString(); |
466 | } |
467 | |
468 | } //ParameterImpl |