1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EssentialOCL.impl; |
8 | |
9 | import EMOF.impl.TypedElementImpl; |
10 | |
11 | import EssentialOCL.CollectionLiteralExp; |
12 | import EssentialOCL.CollectionLiteralPart; |
13 | import EssentialOCL.EssentialOCLPackage; |
14 | |
15 | import org.eclipse.emf.common.notify.Notification; |
16 | import org.eclipse.emf.common.notify.NotificationChain; |
17 | |
18 | import org.eclipse.emf.ecore.EClass; |
19 | import org.eclipse.emf.ecore.InternalEObject; |
20 | |
21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
22 | |
23 | import org.eclipse.emf.ecore.util.EcoreUtil; |
24 | |
25 | /** |
26 | * <!-- begin-user-doc --> |
27 | * An implementation of the model object '<em><b>Collection Literal Part</b></em>'. |
28 | * <!-- end-user-doc --> |
29 | * <p> |
30 | * The following features are implemented: |
31 | * <ul> |
32 | * <li>{@link EssentialOCL.impl.CollectionLiteralPartImpl#getCollectionLiteralExp <em>Collection Literal Exp</em>}</li> |
33 | * </ul> |
34 | * </p> |
35 | * |
36 | * @generated |
37 | */ |
38 | public abstract class CollectionLiteralPartImpl extends TypedElementImpl implements CollectionLiteralPart { |
39 | /** |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | protected CollectionLiteralPartImpl() { |
45 | super(); |
46 | } |
47 | |
48 | /** |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | @Override |
54 | protected EClass eStaticClass() { |
55 | return EssentialOCLPackage.Literals.COLLECTION_LITERAL_PART; |
56 | } |
57 | |
58 | /** |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | public CollectionLiteralExp getCollectionLiteralExp() { |
64 | if (eContainerFeatureID() != EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP) return null; |
65 | return (CollectionLiteralExp)eContainer(); |
66 | } |
67 | |
68 | /** |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @generated |
72 | */ |
73 | public NotificationChain basicSetCollectionLiteralExp(CollectionLiteralExp newCollectionLiteralExp, NotificationChain msgs) { |
74 | msgs = eBasicSetContainer((InternalEObject)newCollectionLiteralExp, EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP, msgs); |
75 | return msgs; |
76 | } |
77 | |
78 | /** |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @generated |
82 | */ |
83 | public void setCollectionLiteralExp(CollectionLiteralExp newCollectionLiteralExp) { |
84 | if (newCollectionLiteralExp != eInternalContainer() || (eContainerFeatureID() != EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP && newCollectionLiteralExp != null)) { |
85 | if (EcoreUtil.isAncestor(this, newCollectionLiteralExp)) |
86 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
87 | NotificationChain msgs = null; |
88 | if (eInternalContainer() != null) |
89 | msgs = eBasicRemoveFromContainer(msgs); |
90 | if (newCollectionLiteralExp != null) |
91 | msgs = ((InternalEObject)newCollectionLiteralExp).eInverseAdd(this, EssentialOCLPackage.COLLECTION_LITERAL_EXP__PART, CollectionLiteralExp.class, msgs); |
92 | msgs = basicSetCollectionLiteralExp(newCollectionLiteralExp, msgs); |
93 | if (msgs != null) msgs.dispatch(); |
94 | } |
95 | else if (eNotificationRequired()) |
96 | eNotify(new ENotificationImpl(this, Notification.SET, EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP, newCollectionLiteralExp, newCollectionLiteralExp)); |
97 | } |
98 | |
99 | /** |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | @Override |
105 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
106 | switch (featureID) { |
107 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
108 | if (eInternalContainer() != null) |
109 | msgs = eBasicRemoveFromContainer(msgs); |
110 | return basicSetCollectionLiteralExp((CollectionLiteralExp)otherEnd, msgs); |
111 | } |
112 | return super.eInverseAdd(otherEnd, featureID, msgs); |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | @Override |
121 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
122 | switch (featureID) { |
123 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
124 | return basicSetCollectionLiteralExp(null, msgs); |
125 | } |
126 | return super.eInverseRemove(otherEnd, featureID, msgs); |
127 | } |
128 | |
129 | /** |
130 | * <!-- begin-user-doc --> |
131 | * <!-- end-user-doc --> |
132 | * @generated |
133 | */ |
134 | @Override |
135 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
136 | switch (eContainerFeatureID()) { |
137 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
138 | return eInternalContainer().eInverseRemove(this, EssentialOCLPackage.COLLECTION_LITERAL_EXP__PART, CollectionLiteralExp.class, msgs); |
139 | } |
140 | return super.eBasicRemoveFromContainerFeature(msgs); |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | @Override |
149 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
150 | switch (featureID) { |
151 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
152 | return getCollectionLiteralExp(); |
153 | } |
154 | return super.eGet(featureID, resolve, coreType); |
155 | } |
156 | |
157 | /** |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | @Override |
163 | public void eSet(int featureID, Object newValue) { |
164 | switch (featureID) { |
165 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
166 | setCollectionLiteralExp((CollectionLiteralExp)newValue); |
167 | return; |
168 | } |
169 | super.eSet(featureID, newValue); |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @Override |
178 | public void eUnset(int featureID) { |
179 | switch (featureID) { |
180 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
181 | setCollectionLiteralExp((CollectionLiteralExp)null); |
182 | return; |
183 | } |
184 | super.eUnset(featureID); |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | @Override |
193 | public boolean eIsSet(int featureID) { |
194 | switch (featureID) { |
195 | case EssentialOCLPackage.COLLECTION_LITERAL_PART__COLLECTION_LITERAL_EXP: |
196 | return getCollectionLiteralExp() != null; |
197 | } |
198 | return super.eIsSet(featureID); |
199 | } |
200 | |
201 | } //CollectionLiteralPartImpl |