Skip to content

Package: DynamicContainmentTreeImpl

DynamicContainmentTreeImpl

nameinstructionbranchcomplexitylinemethod
DynamicContainmentTreeImpl()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
basicGetChildReference()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
basicGetDomainModel()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
basicSetChildComposite(VContainedElement, NotificationChain)
M: 4 C: 25
86%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 1 C: 9
90%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 19 C: 14
42%
M: 7 C: 3
30%
M: 5 C: 3
38%
M: 7 C: 4
36%
M: 0 C: 1
100%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 20 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
eIsSet(int)
M: 27 C: 22
45%
M: 12 C: 8
40%
M: 8 C: 5
38%
M: 3 C: 4
57%
M: 0 C: 1
100%
eSet(int, Object)
M: 42 C: 0
0%
M: 6 C: 0
0%
M: 6 C: 0
0%
M: 15 C: 0
0%
M: 1 C: 0
0%
eStaticClass()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
eUnset(int)
M: 26 C: 0
0%
M: 6 C: 0
0%
M: 6 C: 0
0%
M: 13 C: 0
0%
M: 1 C: 0
0%
getChildComposite()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getChildReference()
M: 38 C: 0
0%
M: 8 C: 0
0%
M: 5 C: 0
0%
M: 8 C: 0
0%
M: 1 C: 0
0%
getDomainModel()
M: 27 C: 10
27%
M: 6 C: 2
25%
M: 4 C: 1
20%
M: 6 C: 2
25%
M: 0 C: 1
100%
getItems()
M: 0 C: 14
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getLabelObject()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getPathToRoot()
M: 0 C: 14
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
setChildComposite(VContainedElement)
M: 22 C: 30
58%
M: 6 C: 4
40%
M: 5 C: 1
17%
M: 4 C: 11
73%
M: 0 C: 1
100%
setChildReference(EReference)
M: 0 C: 21
100%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 6
100%
M: 0 C: 1
100%
setDomainModel(EObject)
M: 0 C: 21
100%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 6
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (c) 2011-2013 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Edgar Mueller - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.dynamictree.model.impl;
15:
16: import java.util.Collection;
17:
18: import org.eclipse.emf.common.notify.Notification;
19: import org.eclipse.emf.common.notify.NotificationChain;
20: import org.eclipse.emf.common.util.EList;
21: import org.eclipse.emf.ecore.EClass;
22: import org.eclipse.emf.ecore.EObject;
23: import org.eclipse.emf.ecore.EReference;
24: import org.eclipse.emf.ecore.InternalEObject;
25: import org.eclipse.emf.ecore.impl.ENotificationImpl;
26: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
27: import org.eclipse.emf.ecore.util.EObjectResolvingEList;
28: import org.eclipse.emf.ecore.util.InternalEList;
29: import org.eclipse.emf.ecp.view.dynamictree.model.DynamicContainmentItem;
30: import org.eclipse.emf.ecp.view.dynamictree.model.DynamicContainmentTree;
31: import org.eclipse.emf.ecp.view.dynamictree.model.ModelPackage;
32: import org.eclipse.emf.ecp.view.spi.categorization.model.impl.VCategoryImpl;
33: import org.eclipse.emf.ecp.view.spi.model.VContainedElement;
34:
35: /**
36: * <!-- begin-user-doc -->
37: * An implementation of the model object '<em><b>Dynamic Containment Tree</b></em>'.
38: * <!-- end-user-doc -->
39: * <p>
40: * The following features are implemented:
41: * <ul>
42: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeImpl#getDomainModel <em>Domain Model
43: * </em>}</li>
44: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeImpl#getChildReference <em>Child
45: * Reference</em>}</li>
46: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeImpl#getPathToRoot <em>Path To Root
47: * </em>}</li>
48: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeImpl#getChildComposite <em>Child
49: * Composite</em>}</li>
50: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeImpl#getItems <em>Items</em>}</li>
51: * </ul>
52: * </p>
53: *
54: * @generated
55: */
56: public class DynamicContainmentTreeImpl extends VCategoryImpl implements DynamicContainmentTree {
57:         /**
58:          * The cached value of the '{@link #getDomainModel() <em>Domain Model</em>}' reference.
59:          * <!-- begin-user-doc -->
60:          * <!-- end-user-doc -->
61:          *
62:          * @see #getDomainModel()
63:          * @generated
64:          * @ordered
65:          */
66:         protected EObject domainModel;
67:
68:         /**
69:          * The cached value of the '{@link #getChildReference() <em>Child Reference</em>}' reference.
70:          * <!-- begin-user-doc -->
71:          * <!-- end-user-doc -->
72:          *
73:          * @see #getChildReference()
74:          * @generated
75:          * @ordered
76:          */
77:         protected EReference childReference;
78:
79:         /**
80:          * The cached value of the '{@link #getPathToRoot() <em>Path To Root</em>}' reference list.
81:          * <!-- begin-user-doc -->
82:          * <!-- end-user-doc -->
83:          *
84:          * @see #getPathToRoot()
85:          * @generated
86:          * @ordered
87:          */
88:         protected EList<EReference> pathToRoot;
89:
90:         /**
91:          * The cached value of the '{@link #getChildComposite() <em>Child Composite</em>}' containment reference.
92:          * <!-- begin-user-doc -->
93:          * <!-- end-user-doc -->
94:          *
95:          * @see #getChildComposite()
96:          * @generated
97:          * @ordered
98:          */
99:         protected VContainedElement childComposite;
100:
101:         /**
102:          * The cached value of the '{@link #getItems() <em>Items</em>}' containment reference list.
103:          * <!-- begin-user-doc -->
104:          * <!-- end-user-doc -->
105:          *
106:          * @see #getItems()
107:          * @generated
108:          * @ordered
109:          */
110:         protected EList<DynamicContainmentItem> items;
111:
112:         /**
113:          * <!-- begin-user-doc -->
114:          * <!-- end-user-doc -->
115:          *
116:          * @generated NOT
117:          */
118:         protected DynamicContainmentTreeImpl() {
119:                 super();
120:                 addLocalDependencyToLabelAdapter(ModelPackage.Literals.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL);
121:         }
122:
123:         /**
124:          * <!-- begin-user-doc -->
125:          * .
126:          * <!-- end-user-doc -->
127:          *
128:          * @generated
129:          */
130:         @Override
131:         protected EClass eStaticClass() {
132:                 return ModelPackage.Literals.DYNAMIC_CONTAINMENT_TREE;
133:         }
134:
135:         /**
136:          * <!-- begin-user-doc -->
137:          * <!-- end-user-doc -->
138:          *
139:          * @generated
140:          */
141:         @Override
142:         public EObject getDomainModel() {
143:•                if (domainModel != null && domainModel.eIsProxy()) {
144:                         final InternalEObject oldDomainModel = (InternalEObject) domainModel;
145:                         domainModel = eResolveProxy(oldDomainModel);
146:•                        if (domainModel != oldDomainModel) {
147:•                                if (eNotificationRequired()) {
148:                                         eNotify(new ENotificationImpl(this, Notification.RESOLVE,
149:                                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL, oldDomainModel, domainModel));
150:                                 }
151:                         }
152:                 }
153:                 return domainModel;
154:         }
155:
156:         /**
157:          * <!-- begin-user-doc -->
158:          * <!-- end-user-doc -->
159:          *
160:          * @generated
161:          */
162:         public EObject basicGetDomainModel() {
163:                 return domainModel;
164:         }
165:
166:         /**
167:          * <!-- begin-user-doc -->
168:          * <!-- end-user-doc -->
169:          *
170:          * @generated
171:          */
172:         @Override
173:         public void setDomainModel(EObject newDomainModel) {
174:                 final EObject oldDomainModel = domainModel;
175:                 domainModel = newDomainModel;
176:•                if (eNotificationRequired()) {
177:                         eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL,
178:                                 oldDomainModel, domainModel));
179:                 }
180:         }
181:
182:         /**
183:          * <!-- begin-user-doc -->
184:          * <!-- end-user-doc -->
185:          *
186:          * @generated
187:          */
188:         @Override
189:         public EReference getChildReference() {
190:•                if (childReference != null && childReference.eIsProxy()) {
191:                         final InternalEObject oldChildReference = (InternalEObject) childReference;
192:                         childReference = (EReference) eResolveProxy(oldChildReference);
193:•                        if (childReference != oldChildReference) {
194:•                                if (eNotificationRequired()) {
195:                                         eNotify(new ENotificationImpl(this, Notification.RESOLVE,
196:                                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_REFERENCE, oldChildReference, childReference));
197:                                 }
198:                         }
199:                 }
200:                 return childReference;
201:         }
202:
203:         /**
204:          * <!-- begin-user-doc -->
205:          * <!-- end-user-doc -->
206:          *
207:          * @generated
208:          */
209:         public EReference basicGetChildReference() {
210:                 return childReference;
211:         }
212:
213:         /**
214:          * <!-- begin-user-doc -->
215:          * <!-- end-user-doc -->
216:          *
217:          * @generated
218:          */
219:         @Override
220:         public void setChildReference(EReference newChildReference) {
221:                 final EReference oldChildReference = childReference;
222:                 childReference = newChildReference;
223:•                if (eNotificationRequired()) {
224:                         eNotify(new ENotificationImpl(this, Notification.SET,
225:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_REFERENCE, oldChildReference, childReference));
226:                 }
227:         }
228:
229:         /**
230:          * <!-- begin-user-doc -->
231:          * <!-- end-user-doc -->
232:          *
233:          * @generated
234:          */
235:         @Override
236:         public EList<EReference> getPathToRoot() {
237:•                if (pathToRoot == null) {
238:                         pathToRoot = new EObjectResolvingEList<EReference>(EReference.class, this,
239:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__PATH_TO_ROOT);
240:                 }
241:                 return pathToRoot;
242:         }
243:
244:         /**
245:          * <!-- begin-user-doc -->
246:          * <!-- end-user-doc -->
247:          *
248:          * @generated
249:          */
250:         @Override
251:         public VContainedElement getChildComposite() {
252:                 return childComposite;
253:         }
254:
255:         /**
256:          * <!-- begin-user-doc -->
257:          * <!-- end-user-doc -->
258:          *
259:          * @generated
260:          */
261:         public NotificationChain basicSetChildComposite(VContainedElement newChildComposite, NotificationChain msgs) {
262:                 final VContainedElement oldChildComposite = childComposite;
263:                 childComposite = newChildComposite;
264:•                if (eNotificationRequired()) {
265:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
266:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE, oldChildComposite, newChildComposite);
267:•                        if (msgs == null) {
268:                                 msgs = notification;
269:                         } else {
270:                                 msgs.add(notification);
271:                         }
272:                 }
273:                 return msgs;
274:         }
275:
276:         /**
277:          * <!-- begin-user-doc -->
278:          * <!-- end-user-doc -->
279:          *
280:          * @generated
281:          */
282:         @Override
283:         public void setChildComposite(VContainedElement newChildComposite) {
284:•                if (newChildComposite != childComposite) {
285:                         NotificationChain msgs = null;
286:•                        if (childComposite != null) {
287:                                 msgs = ((InternalEObject) childComposite).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
288:                                         - ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE, null, msgs);
289:                         }
290:•                        if (newChildComposite != null) {
291:                                 msgs = ((InternalEObject) newChildComposite).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
292:                                         - ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE, null, msgs);
293:                         }
294:                         msgs = basicSetChildComposite(newChildComposite, msgs);
295:•                        if (msgs != null) {
296:                                 msgs.dispatch();
297:                         }
298:•                } else if (eNotificationRequired()) {
299:                         eNotify(new ENotificationImpl(this, Notification.SET,
300:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE, newChildComposite, newChildComposite));
301:                 }
302:         }
303:
304:         /**
305:          * <!-- begin-user-doc -->
306:          * <!-- end-user-doc -->
307:          *
308:          * @generated
309:          */
310:         @Override
311:         public EList<DynamicContainmentItem> getItems() {
312:•                if (items == null) {
313:                         items = new EObjectContainmentEList<DynamicContainmentItem>(DynamicContainmentItem.class, this,
314:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE__ITEMS);
315:                 }
316:                 return items;
317:         }
318:
319:         /**
320:          * <!-- begin-user-doc -->
321:          * <!-- end-user-doc -->
322:          *
323:          * @generated
324:          */
325:         @Override
326:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
327:•                switch (featureID) {
328:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE:
329:                         return basicSetChildComposite(null, msgs);
330:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__ITEMS:
331:                         return ((InternalEList<?>) getItems()).basicRemove(otherEnd, msgs);
332:                 }
333:                 return super.eInverseRemove(otherEnd, featureID, msgs);
334:         }
335:
336:         /**
337:          * <!-- begin-user-doc -->
338:          * <!-- end-user-doc -->
339:          *
340:          * @generated
341:          */
342:         @Override
343:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
344:•                switch (featureID) {
345:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL:
346:•                        if (resolve) {
347:                                 return getDomainModel();
348:                         }
349:                         return basicGetDomainModel();
350:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_REFERENCE:
351:•                        if (resolve) {
352:                                 return getChildReference();
353:                         }
354:                         return basicGetChildReference();
355:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__PATH_TO_ROOT:
356:                         return getPathToRoot();
357:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE:
358:                         return getChildComposite();
359:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__ITEMS:
360:                         return getItems();
361:                 }
362:                 return super.eGet(featureID, resolve, coreType);
363:         }
364:
365:         /**
366:          * <!-- begin-user-doc -->
367:          * <!-- end-user-doc -->
368:          *
369:          * @generated
370:          */
371:         @SuppressWarnings("unchecked")
372:         @Override
373:         public void eSet(int featureID, Object newValue) {
374:•                switch (featureID) {
375:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL:
376:                         setDomainModel((EObject) newValue);
377:                         return;
378:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_REFERENCE:
379:                         setChildReference((EReference) newValue);
380:                         return;
381:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__PATH_TO_ROOT:
382:                         getPathToRoot().clear();
383:                         getPathToRoot().addAll((Collection<? extends EReference>) newValue);
384:                         return;
385:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE:
386:                         setChildComposite((VContainedElement) newValue);
387:                         return;
388:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__ITEMS:
389:                         getItems().clear();
390:                         getItems().addAll((Collection<? extends DynamicContainmentItem>) newValue);
391:                         return;
392:                 }
393:                 super.eSet(featureID, newValue);
394:         }
395:
396:         /**
397:          * <!-- begin-user-doc -->
398:          * <!-- end-user-doc -->
399:          *
400:          * @generated
401:          */
402:         @Override
403:         public void eUnset(int featureID) {
404:•                switch (featureID) {
405:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL:
406:                         setDomainModel((EObject) null);
407:                         return;
408:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_REFERENCE:
409:                         setChildReference((EReference) null);
410:                         return;
411:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__PATH_TO_ROOT:
412:                         getPathToRoot().clear();
413:                         return;
414:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE:
415:                         setChildComposite((VContainedElement) null);
416:                         return;
417:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__ITEMS:
418:                         getItems().clear();
419:                         return;
420:                 }
421:                 super.eUnset(featureID);
422:         }
423:
424:         /**
425:          * <!-- begin-user-doc -->
426:          * <!-- end-user-doc -->
427:          *
428:          * @generated
429:          */
430:         @Override
431:         public boolean eIsSet(int featureID) {
432:•                switch (featureID) {
433:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__DOMAIN_MODEL:
434:•                        return domainModel != null;
435:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_REFERENCE:
436:•                        return childReference != null;
437:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__PATH_TO_ROOT:
438:•                        return pathToRoot != null && !pathToRoot.isEmpty();
439:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__CHILD_COMPOSITE:
440:•                        return childComposite != null;
441:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE__ITEMS:
442:•                        return items != null && !items.isEmpty();
443:                 }
444:                 return super.eIsSet(featureID);
445:         }
446:
447:         /**
448:          * {@inheritDoc}
449:          *
450:          * @see org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizableElement#getLabelObject()
451:          */
452:         @Override
453:         public EObject getLabelObject() {
454:                 return getDomainModel();
455:         }
456:
457: } // DynamicContainmentTreeImpl