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