Skip to content

Package: DynamicContainmentItemImpl

DynamicContainmentItemImpl

nameinstructionbranchcomplexitylinemethod
DynamicContainmentItemImpl()
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
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%
basicSetComposite(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: 11 C: 14
56%
M: 4 C: 3
43%
M: 3 C: 3
50%
M: 4 C: 4
50%
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: 29 C: 20
41%
M: 12 C: 7
37%
M: 8 C: 4
33%
M: 4 C: 4
50%
M: 0 C: 1
100%
eSet(int, Object)
M: 32 C: 0
0%
M: 5 C: 0
0%
M: 5 C: 0
0%
M: 12 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: 22 C: 0
0%
M: 5 C: 0
0%
M: 5 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
getBaseItemIndex()
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%
getComposite()
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%
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%
getECPActions()
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%
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%
setBaseItemIndex(Integer)
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%
setComposite(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%
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%
setECPActions(List)
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
static {...}
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%
toString()
M: 28 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%

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: import java.util.List;
18:
19: import org.eclipse.emf.common.notify.Notification;
20: import org.eclipse.emf.common.notify.NotificationChain;
21: import org.eclipse.emf.common.util.EList;
22: import org.eclipse.emf.ecore.EClass;
23: import org.eclipse.emf.ecore.EObject;
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.InternalEList;
28: import org.eclipse.emf.ecp.view.dynamictree.model.DynamicContainmentItem;
29: import org.eclipse.emf.ecp.view.dynamictree.model.ModelPackage;
30: import org.eclipse.emf.ecp.view.spi.categorization.model.ECPAction;
31: import org.eclipse.emf.ecp.view.spi.categorization.model.impl.VCategorizableElementImpl;
32: import org.eclipse.emf.ecp.view.spi.model.VContainedElement;
33:
34: /**
35: * <!-- begin-user-doc -->
36: * An implementation of the model object '<em><b>Dynamic Containment Item</b></em>'.
37: * <!-- end-user-doc -->
38: * <p>
39: * The following features are implemented:
40: * <ul>
41: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentItemImpl#getDomainModel <em>Domain Model
42: * </em>}</li>
43: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentItemImpl#getItems <em>Items</em>}</li>
44: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentItemImpl#getComposite <em>Composite
45: * </em>}</li>
46: * <li>{@link org.eclipse.emf.ecp.view.dynamictree.model.impl.DynamicContainmentItemImpl#getBaseItemIndex <em>Base Item
47: * Index</em>}</li>
48: * </ul>
49: * </p>
50: *
51: * @generated
52: */
53: public class DynamicContainmentItemImpl extends VCategorizableElementImpl implements DynamicContainmentItem {
54:         /**
55:          * The cached value of the '{@link #getDomainModel() <em>Domain Model</em>}' reference.
56:          * <!-- begin-user-doc -->
57:          * <!-- end-user-doc -->
58:          *
59:          * @see #getDomainModel()
60:          * @generated
61:          * @ordered
62:          */
63:         protected EObject domainModel;
64:
65:         /**
66:          * The cached value of the '{@link #getItems() <em>Items</em>}' containment reference list.
67:          * <!-- begin-user-doc -->
68:          * <!-- end-user-doc -->
69:          *
70:          * @see #getItems()
71:          * @generated
72:          * @ordered
73:          */
74:         protected EList<DynamicContainmentItem> items;
75:
76:         /**
77:          * The cached value of the '{@link #getComposite() <em>Composite</em>}' containment reference.
78:          * <!-- begin-user-doc -->
79:          * <!-- end-user-doc -->
80:          *
81:          * @see #getComposite()
82:          * @generated
83:          * @ordered
84:          */
85:         protected VContainedElement composite;
86:
87:         /**
88:          * The default value of the '{@link #getBaseItemIndex() <em>Base Item Index</em>}' attribute.
89:          * <!-- begin-user-doc -->
90:          * <!-- end-user-doc -->
91:          *
92:          * @see #getBaseItemIndex()
93:          * @generated
94:          * @ordered
95:          */
96:         protected static final Integer BASE_ITEM_INDEX_EDEFAULT = null;
97:
98:         /**
99:          * The cached value of the '{@link #getBaseItemIndex() <em>Base Item Index</em>}' attribute.
100:          * <!-- begin-user-doc -->
101:          * <!-- end-user-doc -->
102:          *
103:          * @see #getBaseItemIndex()
104:          * @generated
105:          * @ordered
106:          */
107:         protected Integer baseItemIndex = BASE_ITEM_INDEX_EDEFAULT;
108:
109:         /**
110:          * <!-- begin-user-doc -->
111:          * <!-- end-user-doc -->
112:          *
113:          * @generated NOT
114:          */
115:         protected DynamicContainmentItemImpl() {
116:                 super();
117:                 addLocalDependencyToLabelAdapter(ModelPackage.Literals.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL);
118:         }
119:
120:         /**
121:          * <!-- begin-user-doc -->
122:          * .
123:          * <!-- end-user-doc -->
124:          *
125:          * @generated
126:          */
127:         @Override
128:         protected EClass eStaticClass() {
129:                 return ModelPackage.Literals.DYNAMIC_CONTAINMENT_ITEM;
130:         }
131:
132:         /**
133:          * <!-- begin-user-doc -->
134:          * <!-- end-user-doc -->
135:          *
136:          * @generated
137:          */
138:         @Override
139:         public EObject getDomainModel() {
140:•                if (domainModel != null && domainModel.eIsProxy()) {
141:                         final InternalEObject oldDomainModel = (InternalEObject) domainModel;
142:                         domainModel = eResolveProxy(oldDomainModel);
143:•                        if (domainModel != oldDomainModel) {
144:•                                if (eNotificationRequired()) {
145:                                         eNotify(new ENotificationImpl(this, Notification.RESOLVE,
146:                                                 ModelPackage.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL, oldDomainModel, domainModel));
147:                                 }
148:                         }
149:                 }
150:                 return domainModel;
151:         }
152:
153:         /**
154:          * <!-- begin-user-doc -->
155:          * <!-- end-user-doc -->
156:          *
157:          * @generated
158:          */
159:         public EObject basicGetDomainModel() {
160:                 return domainModel;
161:         }
162:
163:         /**
164:          * <!-- begin-user-doc -->
165:          * <!-- end-user-doc -->
166:          *
167:          * @generated
168:          */
169:         @Override
170:         public void setDomainModel(EObject newDomainModel) {
171:                 final EObject oldDomainModel = domainModel;
172:                 domainModel = newDomainModel;
173:•                if (eNotificationRequired()) {
174:                         eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL,
175:                                 oldDomainModel, domainModel));
176:                 }
177:         }
178:
179:         /**
180:          * <!-- begin-user-doc -->
181:          * <!-- end-user-doc -->
182:          *
183:          * @generated
184:          */
185:         @Override
186:         public EList<DynamicContainmentItem> getItems() {
187:•                if (items == null) {
188:                         items = new EObjectContainmentEList<DynamicContainmentItem>(DynamicContainmentItem.class, this,
189:                                 ModelPackage.DYNAMIC_CONTAINMENT_ITEM__ITEMS);
190:                 }
191:                 return items;
192:         }
193:
194:         /**
195:          * <!-- begin-user-doc -->
196:          * <!-- end-user-doc -->
197:          *
198:          * @generated
199:          */
200:         @Override
201:         public VContainedElement getComposite() {
202:                 return composite;
203:         }
204:
205:         /**
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @generated
210:          */
211:         public NotificationChain basicSetComposite(VContainedElement newComposite, NotificationChain msgs) {
212:                 final VContainedElement oldComposite = composite;
213:                 composite = newComposite;
214:•                if (eNotificationRequired()) {
215:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
216:                                 ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE, oldComposite, newComposite);
217:•                        if (msgs == null) {
218:                                 msgs = notification;
219:                         } else {
220:                                 msgs.add(notification);
221:                         }
222:                 }
223:                 return msgs;
224:         }
225:
226:         /**
227:          * <!-- begin-user-doc -->
228:          * <!-- end-user-doc -->
229:          *
230:          * @generated
231:          */
232:         @Override
233:         public void setComposite(VContainedElement newComposite) {
234:•                if (newComposite != composite) {
235:                         NotificationChain msgs = null;
236:•                        if (composite != null) {
237:                                 msgs = ((InternalEObject) composite).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
238:                                         - ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE, null, msgs);
239:                         }
240:•                        if (newComposite != null) {
241:                                 msgs = ((InternalEObject) newComposite).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
242:                                         - ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE, null, msgs);
243:                         }
244:                         msgs = basicSetComposite(newComposite, msgs);
245:•                        if (msgs != null) {
246:                                 msgs.dispatch();
247:                         }
248:•                } else if (eNotificationRequired()) {
249:                         eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE,
250:                                 newComposite, newComposite));
251:                 }
252:         }
253:
254:         /**
255:          * <!-- begin-user-doc -->
256:          * <!-- end-user-doc -->
257:          *
258:          * @generated
259:          */
260:         @Override
261:         public Integer getBaseItemIndex() {
262:                 return baseItemIndex;
263:         }
264:
265:         /**
266:          * <!-- begin-user-doc -->
267:          * <!-- end-user-doc -->
268:          *
269:          * @generated
270:          */
271:         @Override
272:         public void setBaseItemIndex(Integer newBaseItemIndex) {
273:                 final Integer oldBaseItemIndex = baseItemIndex;
274:                 baseItemIndex = newBaseItemIndex;
275:•                if (eNotificationRequired()) {
276:                         eNotify(new ENotificationImpl(this, Notification.SET,
277:                                 ModelPackage.DYNAMIC_CONTAINMENT_ITEM__BASE_ITEM_INDEX, oldBaseItemIndex, baseItemIndex));
278:                 }
279:         }
280:
281:         /**
282:          * <!-- begin-user-doc -->
283:          * <!-- end-user-doc -->
284:          *
285:          * @generated
286:          */
287:         @Override
288:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
289:•                switch (featureID) {
290:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__ITEMS:
291:                         return ((InternalEList<?>) getItems()).basicRemove(otherEnd, msgs);
292:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE:
293:                         return basicSetComposite(null, msgs);
294:                 }
295:                 return super.eInverseRemove(otherEnd, featureID, msgs);
296:         }
297:
298:         /**
299:          * <!-- begin-user-doc -->
300:          * <!-- end-user-doc -->
301:          *
302:          * @generated
303:          */
304:         @Override
305:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
306:•                switch (featureID) {
307:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL:
308:•                        if (resolve) {
309:                                 return getDomainModel();
310:                         }
311:                         return basicGetDomainModel();
312:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__ITEMS:
313:                         return getItems();
314:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE:
315:                         return getComposite();
316:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__BASE_ITEM_INDEX:
317:                         return getBaseItemIndex();
318:                 }
319:                 return super.eGet(featureID, resolve, coreType);
320:         }
321:
322:         /**
323:          * <!-- begin-user-doc -->
324:          * <!-- end-user-doc -->
325:          *
326:          * @generated
327:          */
328:         @SuppressWarnings("unchecked")
329:         @Override
330:         public void eSet(int featureID, Object newValue) {
331:•                switch (featureID) {
332:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL:
333:                         setDomainModel((EObject) newValue);
334:                         return;
335:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__ITEMS:
336:                         getItems().clear();
337:                         getItems().addAll((Collection<? extends DynamicContainmentItem>) newValue);
338:                         return;
339:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE:
340:                         setComposite((VContainedElement) newValue);
341:                         return;
342:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__BASE_ITEM_INDEX:
343:                         setBaseItemIndex((Integer) newValue);
344:                         return;
345:                 }
346:                 super.eSet(featureID, newValue);
347:         }
348:
349:         /**
350:          * <!-- begin-user-doc -->
351:          * <!-- end-user-doc -->
352:          *
353:          * @generated
354:          */
355:         @Override
356:         public void eUnset(int featureID) {
357:•                switch (featureID) {
358:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL:
359:                         setDomainModel((EObject) null);
360:                         return;
361:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__ITEMS:
362:                         getItems().clear();
363:                         return;
364:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE:
365:                         setComposite((VContainedElement) null);
366:                         return;
367:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__BASE_ITEM_INDEX:
368:                         setBaseItemIndex(BASE_ITEM_INDEX_EDEFAULT);
369:                         return;
370:                 }
371:                 super.eUnset(featureID);
372:         }
373:
374:         /**
375:          * <!-- begin-user-doc -->
376:          * <!-- end-user-doc -->
377:          *
378:          * @generated
379:          */
380:         @Override
381:         public boolean eIsSet(int featureID) {
382:•                switch (featureID) {
383:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__DOMAIN_MODEL:
384:•                        return domainModel != null;
385:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__ITEMS:
386:•                        return items != null && !items.isEmpty();
387:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__COMPOSITE:
388:•                        return composite != null;
389:                 case ModelPackage.DYNAMIC_CONTAINMENT_ITEM__BASE_ITEM_INDEX:
390:•                        return BASE_ITEM_INDEX_EDEFAULT == null ? baseItemIndex != null
391:                                 : !BASE_ITEM_INDEX_EDEFAULT
392:•                                        .equals(baseItemIndex);
393:                 }
394:                 return super.eIsSet(featureID);
395:         }
396:
397:         /**
398:          * <!-- begin-user-doc -->
399:          * <!-- end-user-doc -->
400:          *
401:          * @generated
402:          */
403:         @Override
404:         public String toString() {
405:•                if (eIsProxy()) {
406:                         return super.toString();
407:                 }
408:
409:                 final StringBuffer result = new StringBuffer(super.toString());
410:                 result.append(" (baseItemIndex: ");
411:                 result.append(baseItemIndex);
412:                 result.append(')');
413:                 return result.toString();
414:         }
415:
416:         /**
417:          * {@inheritDoc}
418:          *
419:          * @see org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizableElement#getLabelObject()
420:          */
421:         @Override
422:         public EObject getLabelObject() {
423:                 return getDomainModel();
424:         }
425:
426:         private List<ECPAction> ecpActions;
427:
428:         /**
429:          * {@inheritDoc}
430:          *
431:          * @see org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizableElement#getECPActions()
432:          */
433:         @Override
434:         public List<ECPAction> getECPActions() {
435:                 return ecpActions;
436:         }
437:
438:         /**
439:          * {@inheritDoc}
440:          *
441:          * @see org.eclipse.emf.ecp.view.spi.categorization.model.VCategorizableElement#setECPActions(java.util.List)
442:          */
443:         @Override
444:         public void setECPActions(List<ECPAction> actions) {
445:                 ecpActions = actions;
446:         }
447:
448: } // DynamicContainmentItemImpl