1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package EMOF.impl; |
8 | |
9 | import EMOF.EMOFPackage; |
10 | import EMOF.Operation; |
11 | import EMOF.Property; |
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.InternalEObject; |
22 | |
23 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
24 | |
25 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
26 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
27 | import org.eclipse.emf.ecore.util.InternalEList; |
28 | |
29 | /** |
30 | * <!-- begin-user-doc --> |
31 | * An implementation of the model object '<em><b>Class</b></em>'. |
32 | * <!-- end-user-doc --> |
33 | * <p> |
34 | * The following features are implemented: |
35 | * <ul> |
36 | * <li>{@link EMOF.impl.ClassImpl#getIsAbstract <em>Is Abstract</em>}</li> |
37 | * <li>{@link EMOF.impl.ClassImpl#getOwnedAttribute <em>Owned Attribute</em>}</li> |
38 | * <li>{@link EMOF.impl.ClassImpl#getOwnedOperation <em>Owned Operation</em>}</li> |
39 | * <li>{@link EMOF.impl.ClassImpl#getSuperClass <em>Super Class</em>}</li> |
40 | * </ul> |
41 | * </p> |
42 | * |
43 | * @generated |
44 | */ |
45 | public class ClassImpl extends TypeImpl implements EMOF.Class { |
46 | /** |
47 | * The default value of the '{@link #getIsAbstract() <em>Is Abstract</em>}' attribute. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @see #getIsAbstract() |
51 | * @generated |
52 | * @ordered |
53 | */ |
54 | protected static final Boolean IS_ABSTRACT_EDEFAULT = Boolean.FALSE; |
55 | |
56 | /** |
57 | * The cached value of the '{@link #getIsAbstract() <em>Is Abstract</em>}' attribute. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @see #getIsAbstract() |
61 | * @generated |
62 | * @ordered |
63 | */ |
64 | protected Boolean isAbstract = IS_ABSTRACT_EDEFAULT; |
65 | |
66 | /** |
67 | * The cached value of the '{@link #getOwnedAttribute() <em>Owned Attribute</em>}' containment reference list. |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @see #getOwnedAttribute() |
71 | * @generated |
72 | * @ordered |
73 | */ |
74 | protected EList<Property> ownedAttribute; |
75 | |
76 | /** |
77 | * The cached value of the '{@link #getOwnedOperation() <em>Owned Operation</em>}' containment reference list. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @see #getOwnedOperation() |
81 | * @generated |
82 | * @ordered |
83 | */ |
84 | protected EList<Operation> ownedOperation; |
85 | |
86 | /** |
87 | * The cached value of the '{@link #getSuperClass() <em>Super Class</em>}' reference list. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @see #getSuperClass() |
91 | * @generated |
92 | * @ordered |
93 | */ |
94 | protected EList<EMOF.Class> superClass; |
95 | |
96 | /** |
97 | * <!-- begin-user-doc --> |
98 | * <!-- end-user-doc --> |
99 | * @generated |
100 | */ |
101 | protected ClassImpl() { |
102 | super(); |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | @Override |
111 | protected EClass eStaticClass() { |
112 | return EMOFPackage.Literals.CLASS; |
113 | } |
114 | |
115 | /** |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @generated |
119 | */ |
120 | public Boolean getIsAbstract() { |
121 | return isAbstract; |
122 | } |
123 | |
124 | /** |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | public void setIsAbstract(Boolean newIsAbstract) { |
130 | Boolean oldIsAbstract = isAbstract; |
131 | isAbstract = newIsAbstract; |
132 | if (eNotificationRequired()) |
133 | eNotify(new ENotificationImpl(this, Notification.SET, EMOFPackage.CLASS__IS_ABSTRACT, oldIsAbstract, isAbstract)); |
134 | } |
135 | |
136 | /** |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | public EList<Property> getOwnedAttribute() { |
142 | if (ownedAttribute == null) { |
143 | ownedAttribute = new EObjectContainmentWithInverseEList<Property>(Property.class, this, EMOFPackage.CLASS__OWNED_ATTRIBUTE, EMOFPackage.PROPERTY__CLASS); |
144 | } |
145 | return ownedAttribute; |
146 | } |
147 | |
148 | /** |
149 | * <!-- begin-user-doc --> |
150 | * <!-- end-user-doc --> |
151 | * @generated |
152 | */ |
153 | public EList<Operation> getOwnedOperation() { |
154 | if (ownedOperation == null) { |
155 | ownedOperation = new EObjectContainmentWithInverseEList<Operation>(Operation.class, this, EMOFPackage.CLASS__OWNED_OPERATION, EMOFPackage.OPERATION__CLASS); |
156 | } |
157 | return ownedOperation; |
158 | } |
159 | |
160 | /** |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | public EList<EMOF.Class> getSuperClass() { |
166 | if (superClass == null) { |
167 | superClass = new EObjectResolvingEList<EMOF.Class>(EMOF.Class.class, this, EMOFPackage.CLASS__SUPER_CLASS); |
168 | } |
169 | return superClass; |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @SuppressWarnings("unchecked") |
178 | @Override |
179 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
180 | switch (featureID) { |
181 | case EMOFPackage.CLASS__OWNED_ATTRIBUTE: |
182 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedAttribute()).basicAdd(otherEnd, msgs); |
183 | case EMOFPackage.CLASS__OWNED_OPERATION: |
184 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getOwnedOperation()).basicAdd(otherEnd, msgs); |
185 | } |
186 | return super.eInverseAdd(otherEnd, featureID, msgs); |
187 | } |
188 | |
189 | /** |
190 | * <!-- begin-user-doc --> |
191 | * <!-- end-user-doc --> |
192 | * @generated |
193 | */ |
194 | @Override |
195 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
196 | switch (featureID) { |
197 | case EMOFPackage.CLASS__OWNED_ATTRIBUTE: |
198 | return ((InternalEList<?>)getOwnedAttribute()).basicRemove(otherEnd, msgs); |
199 | case EMOFPackage.CLASS__OWNED_OPERATION: |
200 | return ((InternalEList<?>)getOwnedOperation()).basicRemove(otherEnd, msgs); |
201 | } |
202 | return super.eInverseRemove(otherEnd, featureID, msgs); |
203 | } |
204 | |
205 | /** |
206 | * <!-- begin-user-doc --> |
207 | * <!-- end-user-doc --> |
208 | * @generated |
209 | */ |
210 | @Override |
211 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
212 | switch (featureID) { |
213 | case EMOFPackage.CLASS__IS_ABSTRACT: |
214 | return getIsAbstract(); |
215 | case EMOFPackage.CLASS__OWNED_ATTRIBUTE: |
216 | return getOwnedAttribute(); |
217 | case EMOFPackage.CLASS__OWNED_OPERATION: |
218 | return getOwnedOperation(); |
219 | case EMOFPackage.CLASS__SUPER_CLASS: |
220 | return getSuperClass(); |
221 | } |
222 | return super.eGet(featureID, resolve, coreType); |
223 | } |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | @SuppressWarnings("unchecked") |
231 | @Override |
232 | public void eSet(int featureID, Object newValue) { |
233 | switch (featureID) { |
234 | case EMOFPackage.CLASS__IS_ABSTRACT: |
235 | setIsAbstract((Boolean)newValue); |
236 | return; |
237 | case EMOFPackage.CLASS__OWNED_ATTRIBUTE: |
238 | getOwnedAttribute().clear(); |
239 | getOwnedAttribute().addAll((Collection<? extends Property>)newValue); |
240 | return; |
241 | case EMOFPackage.CLASS__OWNED_OPERATION: |
242 | getOwnedOperation().clear(); |
243 | getOwnedOperation().addAll((Collection<? extends Operation>)newValue); |
244 | return; |
245 | case EMOFPackage.CLASS__SUPER_CLASS: |
246 | getSuperClass().clear(); |
247 | getSuperClass().addAll((Collection<? extends EMOF.Class>)newValue); |
248 | return; |
249 | } |
250 | super.eSet(featureID, newValue); |
251 | } |
252 | |
253 | /** |
254 | * <!-- begin-user-doc --> |
255 | * <!-- end-user-doc --> |
256 | * @generated |
257 | */ |
258 | @Override |
259 | public void eUnset(int featureID) { |
260 | switch (featureID) { |
261 | case EMOFPackage.CLASS__IS_ABSTRACT: |
262 | setIsAbstract(IS_ABSTRACT_EDEFAULT); |
263 | return; |
264 | case EMOFPackage.CLASS__OWNED_ATTRIBUTE: |
265 | getOwnedAttribute().clear(); |
266 | return; |
267 | case EMOFPackage.CLASS__OWNED_OPERATION: |
268 | getOwnedOperation().clear(); |
269 | return; |
270 | case EMOFPackage.CLASS__SUPER_CLASS: |
271 | getSuperClass().clear(); |
272 | return; |
273 | } |
274 | super.eUnset(featureID); |
275 | } |
276 | |
277 | /** |
278 | * <!-- begin-user-doc --> |
279 | * <!-- end-user-doc --> |
280 | * @generated |
281 | */ |
282 | @Override |
283 | public boolean eIsSet(int featureID) { |
284 | switch (featureID) { |
285 | case EMOFPackage.CLASS__IS_ABSTRACT: |
286 | return IS_ABSTRACT_EDEFAULT == null ? isAbstract != null : !IS_ABSTRACT_EDEFAULT.equals(isAbstract); |
287 | case EMOFPackage.CLASS__OWNED_ATTRIBUTE: |
288 | return ownedAttribute != null && !ownedAttribute.isEmpty(); |
289 | case EMOFPackage.CLASS__OWNED_OPERATION: |
290 | return ownedOperation != null && !ownedOperation.isEmpty(); |
291 | case EMOFPackage.CLASS__SUPER_CLASS: |
292 | return superClass != null && !superClass.isEmpty(); |
293 | } |
294 | return super.eIsSet(featureID); |
295 | } |
296 | |
297 | /** |
298 | * <!-- begin-user-doc --> |
299 | * <!-- end-user-doc --> |
300 | * @generated |
301 | */ |
302 | @Override |
303 | public String toString() { |
304 | if (eIsProxy()) return super.toString(); |
305 | |
306 | StringBuffer result = new StringBuffer(super.toString()); |
307 | result.append(" (isAbstract: "); |
308 | result.append(isAbstract); |
309 | result.append(')'); |
310 | return result.toString(); |
311 | } |
312 | |
313 | } //ClassImpl |