1 | /**
|
---|
2 | */
|
---|
3 | package de.ugoe.cs.cpdp.decentApp.models.decent.impl;
|
---|
4 |
|
---|
5 | import java.util.Collection;
|
---|
6 |
|
---|
7 | import org.eclipse.emf.common.notify.Notification;
|
---|
8 | import org.eclipse.emf.common.notify.NotificationChain;
|
---|
9 | import org.eclipse.emf.common.util.EList;
|
---|
10 | import org.eclipse.emf.ecore.EClass;
|
---|
11 | import org.eclipse.emf.ecore.InternalEObject;
|
---|
12 | import org.eclipse.emf.ecore.impl.ENotificationImpl;
|
---|
13 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
|
---|
14 | import org.eclipse.emf.ecore.util.EObjectResolvingEList;
|
---|
15 | import org.eclipse.emf.ecore.util.EcoreUtil;
|
---|
16 | import org.eclipse.emf.ecore.util.InternalEList;
|
---|
17 |
|
---|
18 | import de.ugoe.cs.cpdp.decentApp.models.decent.Artifact;
|
---|
19 | import de.ugoe.cs.cpdp.decentApp.models.decent.ArtifactType;
|
---|
20 | import de.ugoe.cs.cpdp.decentApp.models.decent.Attribute;
|
---|
21 | import de.ugoe.cs.cpdp.decentApp.models.decent.DECENTPackage;
|
---|
22 | import de.ugoe.cs.cpdp.decentApp.models.decent.State;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | * <!-- begin-user-doc -->
|
---|
26 | * An implementation of the model object '<em><b>Artifact</b></em>'.
|
---|
27 | * <!-- end-user-doc -->
|
---|
28 | * <p>
|
---|
29 | * The following features are implemented:
|
---|
30 | * <ul>
|
---|
31 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.ArtifactImpl#getType <em>Type</em>}</li>
|
---|
32 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.ArtifactImpl#getParent <em>Parent</em>}</li>
|
---|
33 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.ArtifactImpl#getChildren <em>Children</em>}</li>
|
---|
34 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.ArtifactImpl#getStates <em>States</em>}</li>
|
---|
35 | * <li>{@link de.ugoe.cs.cpdp.decentApp.models.decent.impl.ArtifactImpl#getAttributes <em>Attributes</em>}</li>
|
---|
36 | * </ul>
|
---|
37 | * </p>
|
---|
38 | *
|
---|
39 | * @generated
|
---|
40 | */
|
---|
41 | public class ArtifactImpl extends ElementImpl implements Artifact {
|
---|
42 | /**
|
---|
43 | * The cached value of the '{@link #getType() <em>Type</em>}' reference.
|
---|
44 | * <!-- begin-user-doc -->
|
---|
45 | * <!-- end-user-doc -->
|
---|
46 | * @see #getType()
|
---|
47 | * @generated
|
---|
48 | * @ordered
|
---|
49 | */
|
---|
50 | protected ArtifactType type;
|
---|
51 |
|
---|
52 | /**
|
---|
53 | * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list.
|
---|
54 | * <!-- begin-user-doc -->
|
---|
55 | * <!-- end-user-doc -->
|
---|
56 | * @see #getChildren()
|
---|
57 | * @generated
|
---|
58 | * @ordered
|
---|
59 | */
|
---|
60 | protected EList<Artifact> children;
|
---|
61 |
|
---|
62 | /**
|
---|
63 | * The cached value of the '{@link #getStates() <em>States</em>}' containment reference list.
|
---|
64 | * <!-- begin-user-doc -->
|
---|
65 | * <!-- end-user-doc -->
|
---|
66 | * @see #getStates()
|
---|
67 | * @generated
|
---|
68 | * @ordered
|
---|
69 | */
|
---|
70 | protected EList<State> states;
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * The cached value of the '{@link #getAttributes() <em>Attributes</em>}' reference list.
|
---|
74 | * <!-- begin-user-doc -->
|
---|
75 | * <!-- end-user-doc -->
|
---|
76 | * @see #getAttributes()
|
---|
77 | * @generated
|
---|
78 | * @ordered
|
---|
79 | */
|
---|
80 | protected EList<Attribute> attributes;
|
---|
81 |
|
---|
82 | /**
|
---|
83 | * <!-- begin-user-doc -->
|
---|
84 | * <!-- end-user-doc -->
|
---|
85 | * @generated
|
---|
86 | */
|
---|
87 | protected ArtifactImpl() {
|
---|
88 | super();
|
---|
89 | }
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * <!-- begin-user-doc -->
|
---|
93 | * <!-- end-user-doc -->
|
---|
94 | * @generated
|
---|
95 | */
|
---|
96 | @Override
|
---|
97 | protected EClass eStaticClass() {
|
---|
98 | return DECENTPackage.Literals.ARTIFACT;
|
---|
99 | }
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * <!-- begin-user-doc -->
|
---|
103 | * <!-- end-user-doc -->
|
---|
104 | * @generated
|
---|
105 | */
|
---|
106 | public ArtifactType getType() {
|
---|
107 | if (type != null && type.eIsProxy()) {
|
---|
108 | InternalEObject oldType = (InternalEObject)type;
|
---|
109 | type = (ArtifactType)eResolveProxy(oldType);
|
---|
110 | if (type != oldType) {
|
---|
111 | if (eNotificationRequired())
|
---|
112 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, DECENTPackage.ARTIFACT__TYPE, oldType, type));
|
---|
113 | }
|
---|
114 | }
|
---|
115 | return type;
|
---|
116 | }
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * <!-- begin-user-doc -->
|
---|
120 | * <!-- end-user-doc -->
|
---|
121 | * @generated
|
---|
122 | */
|
---|
123 | public ArtifactType basicGetType() {
|
---|
124 | return type;
|
---|
125 | }
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * <!-- begin-user-doc -->
|
---|
129 | * <!-- end-user-doc -->
|
---|
130 | * @generated
|
---|
131 | */
|
---|
132 | public void setType(ArtifactType newType) {
|
---|
133 | ArtifactType oldType = type;
|
---|
134 | type = newType;
|
---|
135 | if (eNotificationRequired())
|
---|
136 | eNotify(new ENotificationImpl(this, Notification.SET, DECENTPackage.ARTIFACT__TYPE, oldType, type));
|
---|
137 | }
|
---|
138 |
|
---|
139 | /**
|
---|
140 | * <!-- begin-user-doc -->
|
---|
141 | * <!-- end-user-doc -->
|
---|
142 | * @generated
|
---|
143 | */
|
---|
144 | public Artifact getParent() {
|
---|
145 | if (eContainerFeatureID() != DECENTPackage.ARTIFACT__PARENT) return null;
|
---|
146 | return (Artifact)eInternalContainer();
|
---|
147 | }
|
---|
148 |
|
---|
149 | /**
|
---|
150 | * <!-- begin-user-doc -->
|
---|
151 | * <!-- end-user-doc -->
|
---|
152 | * @generated
|
---|
153 | */
|
---|
154 | public NotificationChain basicSetParent(Artifact newParent, NotificationChain msgs) {
|
---|
155 | msgs = eBasicSetContainer((InternalEObject)newParent, DECENTPackage.ARTIFACT__PARENT, msgs);
|
---|
156 | return msgs;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /**
|
---|
160 | * <!-- begin-user-doc -->
|
---|
161 | * <!-- end-user-doc -->
|
---|
162 | * @generated
|
---|
163 | */
|
---|
164 | public void setParent(Artifact newParent) {
|
---|
165 | if (newParent != eInternalContainer() || (eContainerFeatureID() != DECENTPackage.ARTIFACT__PARENT && newParent != null)) {
|
---|
166 | if (EcoreUtil.isAncestor(this, newParent))
|
---|
167 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
|
---|
168 | NotificationChain msgs = null;
|
---|
169 | if (eInternalContainer() != null)
|
---|
170 | msgs = eBasicRemoveFromContainer(msgs);
|
---|
171 | if (newParent != null)
|
---|
172 | msgs = ((InternalEObject)newParent).eInverseAdd(this, DECENTPackage.ARTIFACT__CHILDREN, Artifact.class, msgs);
|
---|
173 | msgs = basicSetParent(newParent, msgs);
|
---|
174 | if (msgs != null) msgs.dispatch();
|
---|
175 | }
|
---|
176 | else if (eNotificationRequired())
|
---|
177 | eNotify(new ENotificationImpl(this, Notification.SET, DECENTPackage.ARTIFACT__PARENT, newParent, newParent));
|
---|
178 | }
|
---|
179 |
|
---|
180 | /**
|
---|
181 | * <!-- begin-user-doc -->
|
---|
182 | * <!-- end-user-doc -->
|
---|
183 | * @generated
|
---|
184 | */
|
---|
185 | public EList<Artifact> getChildren() {
|
---|
186 | if (children == null) {
|
---|
187 | children = new EObjectContainmentWithInverseEList<Artifact>(Artifact.class, this, DECENTPackage.ARTIFACT__CHILDREN, DECENTPackage.ARTIFACT__PARENT);
|
---|
188 | }
|
---|
189 | return children;
|
---|
190 | }
|
---|
191 |
|
---|
192 | /**
|
---|
193 | * <!-- begin-user-doc -->
|
---|
194 | * <!-- end-user-doc -->
|
---|
195 | * @generated
|
---|
196 | */
|
---|
197 | public EList<State> getStates() {
|
---|
198 | if (states == null) {
|
---|
199 | states = new EObjectContainmentWithInverseEList<State>(State.class, this, DECENTPackage.ARTIFACT__STATES, DECENTPackage.STATE__ARTIFACT);
|
---|
200 | }
|
---|
201 | return states;
|
---|
202 | }
|
---|
203 |
|
---|
204 | /**
|
---|
205 | * <!-- begin-user-doc -->
|
---|
206 | * <!-- end-user-doc -->
|
---|
207 | * @generated
|
---|
208 | */
|
---|
209 | public EList<Attribute> getAttributes() {
|
---|
210 | if (attributes == null) {
|
---|
211 | attributes = new EObjectResolvingEList<Attribute>(Attribute.class, this, DECENTPackage.ARTIFACT__ATTRIBUTES);
|
---|
212 | }
|
---|
213 | return attributes;
|
---|
214 | }
|
---|
215 |
|
---|
216 | /**
|
---|
217 | * <!-- begin-user-doc -->
|
---|
218 | * <!-- end-user-doc -->
|
---|
219 | * @generated
|
---|
220 | */
|
---|
221 | @SuppressWarnings("unchecked")
|
---|
222 | @Override
|
---|
223 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
---|
224 | switch (featureID) {
|
---|
225 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
226 | if (eInternalContainer() != null)
|
---|
227 | msgs = eBasicRemoveFromContainer(msgs);
|
---|
228 | return basicSetParent((Artifact)otherEnd, msgs);
|
---|
229 | case DECENTPackage.ARTIFACT__CHILDREN:
|
---|
230 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getChildren()).basicAdd(otherEnd, msgs);
|
---|
231 | case DECENTPackage.ARTIFACT__STATES:
|
---|
232 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getStates()).basicAdd(otherEnd, msgs);
|
---|
233 | }
|
---|
234 | return super.eInverseAdd(otherEnd, featureID, msgs);
|
---|
235 | }
|
---|
236 |
|
---|
237 | /**
|
---|
238 | * <!-- begin-user-doc -->
|
---|
239 | * <!-- end-user-doc -->
|
---|
240 | * @generated
|
---|
241 | */
|
---|
242 | @Override
|
---|
243 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
|
---|
244 | switch (featureID) {
|
---|
245 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
246 | return basicSetParent(null, msgs);
|
---|
247 | case DECENTPackage.ARTIFACT__CHILDREN:
|
---|
248 | return ((InternalEList<?>)getChildren()).basicRemove(otherEnd, msgs);
|
---|
249 | case DECENTPackage.ARTIFACT__STATES:
|
---|
250 | return ((InternalEList<?>)getStates()).basicRemove(otherEnd, msgs);
|
---|
251 | }
|
---|
252 | return super.eInverseRemove(otherEnd, featureID, msgs);
|
---|
253 | }
|
---|
254 |
|
---|
255 | /**
|
---|
256 | * <!-- begin-user-doc -->
|
---|
257 | * <!-- end-user-doc -->
|
---|
258 | * @generated
|
---|
259 | */
|
---|
260 | @Override
|
---|
261 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
|
---|
262 | switch (eContainerFeatureID()) {
|
---|
263 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
264 | return eInternalContainer().eInverseRemove(this, DECENTPackage.ARTIFACT__CHILDREN, Artifact.class, msgs);
|
---|
265 | }
|
---|
266 | return super.eBasicRemoveFromContainerFeature(msgs);
|
---|
267 | }
|
---|
268 |
|
---|
269 | /**
|
---|
270 | * <!-- begin-user-doc -->
|
---|
271 | * <!-- end-user-doc -->
|
---|
272 | * @generated
|
---|
273 | */
|
---|
274 | @Override
|
---|
275 | public Object eGet(int featureID, boolean resolve, boolean coreType) {
|
---|
276 | switch (featureID) {
|
---|
277 | case DECENTPackage.ARTIFACT__TYPE:
|
---|
278 | if (resolve) return getType();
|
---|
279 | return basicGetType();
|
---|
280 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
281 | return getParent();
|
---|
282 | case DECENTPackage.ARTIFACT__CHILDREN:
|
---|
283 | return getChildren();
|
---|
284 | case DECENTPackage.ARTIFACT__STATES:
|
---|
285 | return getStates();
|
---|
286 | case DECENTPackage.ARTIFACT__ATTRIBUTES:
|
---|
287 | return getAttributes();
|
---|
288 | }
|
---|
289 | return super.eGet(featureID, resolve, coreType);
|
---|
290 | }
|
---|
291 |
|
---|
292 | /**
|
---|
293 | * <!-- begin-user-doc -->
|
---|
294 | * <!-- end-user-doc -->
|
---|
295 | * @generated
|
---|
296 | */
|
---|
297 | @SuppressWarnings("unchecked")
|
---|
298 | @Override
|
---|
299 | public void eSet(int featureID, Object newValue) {
|
---|
300 | switch (featureID) {
|
---|
301 | case DECENTPackage.ARTIFACT__TYPE:
|
---|
302 | setType((ArtifactType)newValue);
|
---|
303 | return;
|
---|
304 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
305 | setParent((Artifact)newValue);
|
---|
306 | return;
|
---|
307 | case DECENTPackage.ARTIFACT__CHILDREN:
|
---|
308 | getChildren().clear();
|
---|
309 | getChildren().addAll((Collection<? extends Artifact>)newValue);
|
---|
310 | return;
|
---|
311 | case DECENTPackage.ARTIFACT__STATES:
|
---|
312 | getStates().clear();
|
---|
313 | getStates().addAll((Collection<? extends State>)newValue);
|
---|
314 | return;
|
---|
315 | case DECENTPackage.ARTIFACT__ATTRIBUTES:
|
---|
316 | getAttributes().clear();
|
---|
317 | getAttributes().addAll((Collection<? extends Attribute>)newValue);
|
---|
318 | return;
|
---|
319 | }
|
---|
320 | super.eSet(featureID, newValue);
|
---|
321 | }
|
---|
322 |
|
---|
323 | /**
|
---|
324 | * <!-- begin-user-doc -->
|
---|
325 | * <!-- end-user-doc -->
|
---|
326 | * @generated
|
---|
327 | */
|
---|
328 | @Override
|
---|
329 | public void eUnset(int featureID) {
|
---|
330 | switch (featureID) {
|
---|
331 | case DECENTPackage.ARTIFACT__TYPE:
|
---|
332 | setType((ArtifactType)null);
|
---|
333 | return;
|
---|
334 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
335 | setParent((Artifact)null);
|
---|
336 | return;
|
---|
337 | case DECENTPackage.ARTIFACT__CHILDREN:
|
---|
338 | getChildren().clear();
|
---|
339 | return;
|
---|
340 | case DECENTPackage.ARTIFACT__STATES:
|
---|
341 | getStates().clear();
|
---|
342 | return;
|
---|
343 | case DECENTPackage.ARTIFACT__ATTRIBUTES:
|
---|
344 | getAttributes().clear();
|
---|
345 | return;
|
---|
346 | }
|
---|
347 | super.eUnset(featureID);
|
---|
348 | }
|
---|
349 |
|
---|
350 | /**
|
---|
351 | * <!-- begin-user-doc -->
|
---|
352 | * <!-- end-user-doc -->
|
---|
353 | * @generated
|
---|
354 | */
|
---|
355 | @Override
|
---|
356 | public boolean eIsSet(int featureID) {
|
---|
357 | switch (featureID) {
|
---|
358 | case DECENTPackage.ARTIFACT__TYPE:
|
---|
359 | return type != null;
|
---|
360 | case DECENTPackage.ARTIFACT__PARENT:
|
---|
361 | return getParent() != null;
|
---|
362 | case DECENTPackage.ARTIFACT__CHILDREN:
|
---|
363 | return children != null && !children.isEmpty();
|
---|
364 | case DECENTPackage.ARTIFACT__STATES:
|
---|
365 | return states != null && !states.isEmpty();
|
---|
366 | case DECENTPackage.ARTIFACT__ATTRIBUTES:
|
---|
367 | return attributes != null && !attributes.isEmpty();
|
---|
368 | }
|
---|
369 | return super.eIsSet(featureID);
|
---|
370 | }
|
---|
371 |
|
---|
372 | } //ArtifactImpl
|
---|