Skip to content

Package: DynamicContainmentTreeDomainModelReferenceImpl

DynamicContainmentTreeDomainModelReferenceImpl

nameinstructionbranchcomplexitylinemethod
DynamicContainmentTreeDomainModelReferenceImpl()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
basicSetPathFromBase(VDomainModelReference, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 7 C: 4
36%
M: 0 C: 1
100%
basicSetPathFromRoot(VDomainModelReference, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 7 C: 4
36%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 6 C: 8
57%
M: 1 C: 2
67%
M: 1 C: 2
67%
M: 1 C: 3
75%
M: 0 C: 1
100%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 18 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: 4 C: 16
80%
M: 2 C: 5
71%
M: 2 C: 3
60%
M: 0 C: 4
100%
M: 0 C: 1
100%
eSet(int, Object)
M: 5 C: 12
71%
M: 1 C: 2
67%
M: 1 C: 2
67%
M: 2 C: 5
71%
M: 0 C: 1
100%
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: 14 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
getEStructuralFeatureIterator()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getFullPathIterator()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getIterator()
M: 4 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPackingItem()
M: 0 C: 22
100%
M: 0 C: 6
100%
M: 0 C: 4
100%
M: 0 C: 7
100%
M: 0 C: 1
100%
getPathFromBase()
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%
getPathFromRoot()
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%
init(EObject)
M: 2 C: 46
96%
M: 2 C: 6
75%
M: 2 C: 3
60%
M: 1 C: 8
89%
M: 0 C: 1
100%
notifyChange(ModelChangeNotification)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
setPathFromBase(VDomainModelReference)
M: 25 C: 27
52%
M: 6 C: 4
40%
M: 5 C: 1
17%
M: 7 C: 9
56%
M: 0 C: 1
100%
setPathFromRoot(VDomainModelReference)
M: 25 C: 27
52%
M: 6 C: 4
40%
M: 5 C: 1
17%
M: 7 C: 9
56%
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.Iterator;
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.EStructuralFeature;
24: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
25: import org.eclipse.emf.ecore.InternalEObject;
26: import org.eclipse.emf.ecore.impl.ENotificationImpl;
27: import org.eclipse.emf.ecp.view.dynamictree.model.DynamicContainmentItem;
28: import org.eclipse.emf.ecp.view.dynamictree.model.DynamicContainmentTreeDomainModelReference;
29: import org.eclipse.emf.ecp.view.dynamictree.model.ModelPackage;
30: import org.eclipse.emf.ecp.view.spi.model.ModelChangeNotification;
31: import org.eclipse.emf.ecp.view.spi.model.SettingPath;
32: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
33: import org.eclipse.emf.ecp.view.spi.model.impl.VDomainModelReferenceImpl;
34:
35: /**
36: * <!-- begin-user-doc -->
37: * An implementation of the model object '<em><b>Dynamic Containment Tree Domain Model Reference</b></em>'.
38: * <!-- end-user-doc -->
39: * <p>
40: * The following features are implemented:
41: * </p>
42: * <ul>
43: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeDomainModelReferenceImpl#getPathFromRoot
44: * <em>Path From Root</em>}</li>
45: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentTreeDomainModelReferenceImpl#getPathFromBase
46: * <em>Path From Base</em>}</li>
47: * </ul>
48: *
49: * @generated
50: */
51: public class DynamicContainmentTreeDomainModelReferenceImpl extends VDomainModelReferenceImpl implements
52:         DynamicContainmentTreeDomainModelReference {
53:         /**
54:          * The cached value of the '{@link #getPathFromRoot() <em>Path From Root</em>}' containment reference.
55:          * <!-- begin-user-doc -->
56:          * <!-- end-user-doc -->
57:          *
58:          * @see #getPathFromRoot()
59:          * @generated
60:          * @ordered
61:          */
62:         protected VDomainModelReference pathFromRoot;
63:
64:         /**
65:          * The cached value of the '{@link #getPathFromBase() <em>Path From Base</em>}' containment reference.
66:          * <!-- begin-user-doc -->
67:          * <!-- end-user-doc -->
68:          *
69:          * @see #getPathFromBase()
70:          * @generated
71:          * @ordered
72:          */
73:         protected VDomainModelReference pathFromBase;
74:
75:         /**
76:          * <!-- begin-user-doc -->
77:          * <!-- end-user-doc -->
78:          *
79:          * @generated
80:          */
81:         protected DynamicContainmentTreeDomainModelReferenceImpl() {
82:                 super();
83:         }
84:
85:         /**
86:          * <!-- begin-user-doc -->
87:          * <!-- end-user-doc -->
88:          *
89:          * @generated
90:          */
91:         @Override
92:         protected EClass eStaticClass() {
93:                 return ModelPackage.Literals.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE;
94:         }
95:
96:         /**
97:          * <!-- begin-user-doc -->
98:          * <!-- end-user-doc -->
99:          *
100:          * @generated
101:          */
102:         @Override
103:         public VDomainModelReference getPathFromRoot() {
104:                 return pathFromRoot;
105:         }
106:
107:         /**
108:          * <!-- begin-user-doc -->
109:          * <!-- end-user-doc -->
110:          *
111:          * @generated
112:          */
113:         public NotificationChain basicSetPathFromRoot(VDomainModelReference newPathFromRoot, NotificationChain msgs) {
114:                 final VDomainModelReference oldPathFromRoot = pathFromRoot;
115:                 pathFromRoot = newPathFromRoot;
116:•                if (eNotificationRequired()) {
117:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
118:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT, oldPathFromRoot,
119:                                 newPathFromRoot);
120:•                        if (msgs == null) {
121:                                 msgs = notification;
122:                         } else {
123:                                 msgs.add(notification);
124:                         }
125:                 }
126:                 return msgs;
127:         }
128:
129:         /**
130:          * <!-- begin-user-doc -->
131:          * <!-- end-user-doc -->
132:          *
133:          * @generated
134:          */
135:         @Override
136:         public void setPathFromRoot(VDomainModelReference newPathFromRoot) {
137:•                if (newPathFromRoot != pathFromRoot) {
138:                         NotificationChain msgs = null;
139:•                        if (pathFromRoot != null) {
140:                                 msgs = ((InternalEObject) pathFromRoot).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
141:                                         - ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT, null, msgs);
142:                         }
143:•                        if (newPathFromRoot != null) {
144:                                 msgs = ((InternalEObject) newPathFromRoot).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
145:                                         - ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT, null, msgs);
146:                         }
147:                         msgs = basicSetPathFromRoot(newPathFromRoot, msgs);
148:•                        if (msgs != null) {
149:                                 msgs.dispatch();
150:                         }
151:•                } else if (eNotificationRequired()) {
152:                         eNotify(new ENotificationImpl(this, Notification.SET,
153:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT, newPathFromRoot,
154:                                 newPathFromRoot));
155:                 }
156:         }
157:
158:         /**
159:          * <!-- begin-user-doc -->
160:          * <!-- end-user-doc -->
161:          *
162:          * @generated
163:          */
164:         @Override
165:         public VDomainModelReference getPathFromBase() {
166:                 return pathFromBase;
167:         }
168:
169:         /**
170:          * <!-- begin-user-doc -->
171:          * <!-- end-user-doc -->
172:          *
173:          * @generated
174:          */
175:         public NotificationChain basicSetPathFromBase(VDomainModelReference newPathFromBase, NotificationChain msgs) {
176:                 final VDomainModelReference oldPathFromBase = pathFromBase;
177:                 pathFromBase = newPathFromBase;
178:•                if (eNotificationRequired()) {
179:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
180:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE, oldPathFromBase,
181:                                 newPathFromBase);
182:•                        if (msgs == null) {
183:                                 msgs = notification;
184:                         } else {
185:                                 msgs.add(notification);
186:                         }
187:                 }
188:                 return msgs;
189:         }
190:
191:         /**
192:          * <!-- begin-user-doc -->
193:          * <!-- end-user-doc -->
194:          *
195:          * @generated
196:          */
197:         @Override
198:         public void setPathFromBase(VDomainModelReference newPathFromBase) {
199:•                if (newPathFromBase != pathFromBase) {
200:                         NotificationChain msgs = null;
201:•                        if (pathFromBase != null) {
202:                                 msgs = ((InternalEObject) pathFromBase).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
203:                                         - ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE, null, msgs);
204:                         }
205:•                        if (newPathFromBase != null) {
206:                                 msgs = ((InternalEObject) newPathFromBase).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
207:                                         - ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE, null, msgs);
208:                         }
209:                         msgs = basicSetPathFromBase(newPathFromBase, msgs);
210:•                        if (msgs != null) {
211:                                 msgs.dispatch();
212:                         }
213:•                } else if (eNotificationRequired()) {
214:                         eNotify(new ENotificationImpl(this, Notification.SET,
215:                                 ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE, newPathFromBase,
216:                                 newPathFromBase));
217:                 }
218:         }
219:
220:         /**
221:          * <!-- begin-user-doc -->
222:          * <!-- end-user-doc -->
223:          *
224:          * @generated
225:          */
226:         @Override
227:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
228:•                switch (featureID) {
229:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT:
230:                         return basicSetPathFromRoot(null, msgs);
231:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE:
232:                         return basicSetPathFromBase(null, msgs);
233:                 }
234:                 return super.eInverseRemove(otherEnd, featureID, msgs);
235:         }
236:
237:         /**
238:          * <!-- begin-user-doc -->
239:          * <!-- end-user-doc -->
240:          *
241:          * @generated
242:          */
243:         @Override
244:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
245:•                switch (featureID) {
246:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT:
247:                         return getPathFromRoot();
248:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE:
249:                         return getPathFromBase();
250:                 }
251:                 return super.eGet(featureID, resolve, coreType);
252:         }
253:
254:         /**
255:          * <!-- begin-user-doc -->
256:          * <!-- end-user-doc -->
257:          *
258:          * @generated
259:          */
260:         @Override
261:         public void eSet(int featureID, Object newValue) {
262:•                switch (featureID) {
263:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT:
264:                         setPathFromRoot((VDomainModelReference) newValue);
265:                         return;
266:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE:
267:                         setPathFromBase((VDomainModelReference) newValue);
268:                         return;
269:                 }
270:                 super.eSet(featureID, newValue);
271:         }
272:
273:         /**
274:          * <!-- begin-user-doc -->
275:          * <!-- end-user-doc -->
276:          *
277:          * @generated
278:          */
279:         @Override
280:         public void eUnset(int featureID) {
281:•                switch (featureID) {
282:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT:
283:                         setPathFromRoot((VDomainModelReference) null);
284:                         return;
285:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE:
286:                         setPathFromBase((VDomainModelReference) null);
287:                         return;
288:                 }
289:                 super.eUnset(featureID);
290:         }
291:
292:         /**
293:          * <!-- begin-user-doc -->
294:          * <!-- end-user-doc -->
295:          *
296:          * @generated
297:          */
298:         @Override
299:         public boolean eIsSet(int featureID) {
300:•                switch (featureID) {
301:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_ROOT:
302:•                        return pathFromRoot != null;
303:                 case ModelPackage.DYNAMIC_CONTAINMENT_TREE_DOMAIN_MODEL_REFERENCE__PATH_FROM_BASE:
304:•                        return pathFromBase != null;
305:                 }
306:                 return super.eIsSet(featureID);
307:         }
308:
309:         /**
310:          *
311:          * {@inheritDoc}
312:          *
313:          * @see org.eclipse.emf.ecp.view.spi.model.VDomainModelReference#init(EObject)
314:          *
315:          * @generated NOT
316:          */
317:         @Deprecated
318:         @Override
319:         @SuppressWarnings("unchecked")
320:         public boolean init(EObject eObject) {
321:                 boolean init = getPathFromRoot().init(eObject);
322:                 final DynamicContainmentItem packingItem = getPackingItem();
323:•                if (packingItem == null || packingItem.getBaseItemIndex() == null || packingItem.getBaseItemIndex() < 0) {
324:                         return false;
325:                 }
326:                 final EList<EObject> eobjects = (EList<EObject>) getPathFromRoot().getIterator().next().get(true);
327:•                if (eobjects.size() < packingItem.getBaseItemIndex()) {
328:                         return false;
329:                 }
330:                 init = getPathFromBase().init(eobjects.get(packingItem.getBaseItemIndex()));
331:
332:                 return init;
333:         }
334:
335:         /**
336:          *
337:          * {@inheritDoc}
338:          *
339:          * @see org.eclipse.emf.ecp.view.spi.model.VDomainModelReference#getIterator()
340:          *
341:          * @generated NOT
342:          */
343:         @Deprecated
344:         @Override
345:         public Iterator<Setting> getIterator() {
346:                 return getPathFromBase().getIterator();
347:         }
348:
349:         /**
350:          *
351:          * {@inheritDoc}
352:          *
353:          * @see org.eclipse.emf.ecp.view.spi.model.VDomainModelReference#getEStructuralFeatureIterator()
354:          *
355:          * @generated NOT
356:          */
357:         @Deprecated
358:         @Override
359:         public Iterator<EStructuralFeature> getEStructuralFeatureIterator() {
360:                 return getPathFromBase().getEStructuralFeatureIterator();
361:         }
362:
363:         /**
364:          *
365:          * @generated NOT
366:          */
367:         private DynamicContainmentItem getPackingItem() {
368:
369:                 EObject parent = eContainer();
370:•                while (!DynamicContainmentItem.class.isInstance(parent) && parent != null) {
371:                         parent = parent.eContainer();
372:                 }
373:•                if (parent == null) {
374:                         return null;
375:                 }
376:                 final DynamicContainmentItem packingItem = (DynamicContainmentItem) parent;
377:                 return packingItem;
378:         }
379:
380:         /**
381:          * {@inheritDoc}
382:          *
383:          * @see org.eclipse.emf.ecp.view.spi.model.VDomainModelReference#getFullPathIterator()
384:          */
385:         @Deprecated
386:         @Override
387:         public Iterator<SettingPath> getFullPathIterator() {
388:                 return null;
389:         }
390:
391:         /**
392:          * {@inheritDoc}
393:          *
394:          * @see org.eclipse.emf.ecp.view.spi.model.ModelChangeListener#notifyChange(org.eclipse.emf.ecp.view.spi.model.ModelChangeNotification)
395:          */
396:         @Override
397:         public void notifyChange(ModelChangeNotification notification) {
398:         }
399:
400: } // DynamicContainmentTreeDomainModelReferenceImpl