Skip to content

Package: VKeyAttributeDomainModelReferenceImpl

VKeyAttributeDomainModelReferenceImpl

nameinstructionbranchcomplexitylinemethod
VKeyAttributeDomainModelReferenceImpl()
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%
basicSetKeyDMR(VDomainModelReference, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 6 C: 4
40%
M: 0 C: 1
100%
basicSetValueDMR(VDomainModelReference, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 6 C: 4
40%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 0 C: 17
100%
M: 0 C: 4
100%
M: 0 C: 4
100%
M: 0 C: 5
100%
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: 22 C: 16
42%
M: 9 C: 5
36%
M: 6 C: 3
33%
M: 2 C: 3
60%
M: 0 C: 1
100%
eSet(int, Object)
M: 21 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 9 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: 12 C: 6
33%
M: 3 C: 1
25%
M: 3 C: 1
25%
M: 6 C: 3
33%
M: 0 C: 1
100%
getEStructuralFeatureIterator()
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getIterator()
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getKeyDMR()
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%
getKeyValue()
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%
getValueDMR()
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: 137 C: 0
0%
M: 18 C: 0
0%
M: 10 C: 0
0%
M: 29 C: 0
0%
M: 1 C: 0
0%
setKeyDMR(VDomainModelReference)
M: 16 C: 36
69%
M: 4 C: 6
60%
M: 3 C: 3
50%
M: 4 C: 11
73%
M: 0 C: 1
100%
setKeyValue(Object)
M: 11 C: 10
48%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 2 C: 4
67%
M: 0 C: 1
100%
setValueDMR(VDomainModelReference)
M: 16 C: 36
69%
M: 4 C: 6
60%
M: 3 C: 3
50%
M: 4 C: 11
73%
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-2014 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: * Eugen Neufeld - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.spi.keyattributedmr.model.impl;
15:
16: import java.util.Collections;
17: import java.util.Iterator;
18: import java.util.List;
19: import java.util.Set;
20:
21: import org.eclipse.emf.common.notify.Notification;
22: import org.eclipse.emf.common.notify.NotificationChain;
23: import org.eclipse.emf.common.util.Enumerator;
24: import org.eclipse.emf.ecore.EClass;
25: import org.eclipse.emf.ecore.EEnum;
26: import org.eclipse.emf.ecore.EObject;
27: import org.eclipse.emf.ecore.EReference;
28: import org.eclipse.emf.ecore.EStructuralFeature;
29: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
30: import org.eclipse.emf.ecore.EcorePackage;
31: import org.eclipse.emf.ecore.InternalEObject;
32: import org.eclipse.emf.ecore.impl.ENotificationImpl;
33: import org.eclipse.emf.ecore.util.EcoreUtil;
34: import org.eclipse.emf.ecp.view.spi.keyattributedmr.model.VKeyAttributeDomainModelReference;
35: import org.eclipse.emf.ecp.view.spi.keyattributedmr.model.VKeyattributedmrPackage;
36: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
37: import org.eclipse.emf.ecp.view.spi.model.impl.VFeaturePathDomainModelReferenceImpl;
38:
39: /**
40: * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Key Attribute Domain Model Reference</b></em>
41: * '. <!-- end-user-doc -->
42: * <p>
43: * The following features are implemented:
44: * <ul>
45: * <li>{@link org.eclipse.emf.ecp.view.spi.keyattributedmr.model.impl.VKeyAttributeDomainModelReferenceImpl#getKeyDMR
46: * <em>Key DMR</em>}</li>
47: * <li>{@link org.eclipse.emf.ecp.view.spi.keyattributedmr.model.impl.VKeyAttributeDomainModelReferenceImpl#getKeyValue
48: * <em>Key Value</em>}</li>
49: * <li>{@link org.eclipse.emf.ecp.view.spi.keyattributedmr.model.impl.VKeyAttributeDomainModelReferenceImpl#getValueDMR
50: * <em>Value DMR</em>}</li>
51: * </ul>
52: * </p>
53: *
54: * @generated
55: */
56: public class VKeyAttributeDomainModelReferenceImpl extends
57:         VFeaturePathDomainModelReferenceImpl implements
58:         VKeyAttributeDomainModelReference {
59:         /**
60:          * The cached value of the '{@link #getKeyDMR() <em>Key DMR</em>}' containment reference.
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @see #getKeyDMR()
65:          * @generated
66:          * @ordered
67:          */
68:         protected VDomainModelReference keyDMR;
69:         /**
70:          * The default value of the '{@link #getKeyValue() <em>Key Value</em>}' attribute.
71:          * <!-- begin-user-doc -->
72:          * <!-- end-user-doc -->
73:          *
74:          * @see #getKeyValue()
75:          * @generated
76:          * @ordered
77:          */
78:         protected static final Object KEY_VALUE_EDEFAULT = null;
79:         /**
80:          * The cached value of the '{@link #getKeyValue() <em>Key Value</em>}' attribute.
81:          * <!-- begin-user-doc -->
82:          * <!-- end-user-doc -->
83:          *
84:          * @see #getKeyValue()
85:          * @generated
86:          * @ordered
87:          */
88:         protected Object keyValue = KEY_VALUE_EDEFAULT;
89:         /**
90:          * The cached value of the '{@link #getValueDMR() <em>Value DMR</em>}' containment reference.
91:          * <!-- begin-user-doc -->
92:          * <!-- end-user-doc -->
93:          *
94:          * @see #getValueDMR()
95:          * @generated
96:          * @ordered
97:          */
98:         protected VDomainModelReference valueDMR;
99:
100:         /**
101:          * <!-- begin-user-doc --> <!-- end-user-doc -->
102:          *
103:          * @generated
104:          */
105:         protected VKeyAttributeDomainModelReferenceImpl() {
106:                 super();
107:         }
108:
109:         /**
110:          * <!-- begin-user-doc --> <!-- end-user-doc -->
111:          *
112:          * @generated
113:          */
114:         @Override
115:         protected EClass eStaticClass() {
116:                 return VKeyattributedmrPackage.Literals.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE;
117:         }
118:
119:         /**
120:          * <!-- begin-user-doc -->
121:          * <!-- end-user-doc -->
122:          *
123:          * @generated
124:          */
125:         @Override
126:         public VDomainModelReference getKeyDMR() {
127:                 return keyDMR;
128:         }
129:
130:         /**
131:          * <!-- begin-user-doc -->
132:          * <!-- end-user-doc -->
133:          *
134:          * @generated
135:          */
136:         public NotificationChain basicSetKeyDMR(VDomainModelReference newKeyDMR, NotificationChain msgs) {
137:                 final VDomainModelReference oldKeyDMR = keyDMR;
138:                 keyDMR = newKeyDMR;
139:•                if (eNotificationRequired()) {
140:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
141:                                 VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR, oldKeyDMR, newKeyDMR);
142:•                        if (msgs == null) {
143:                                 msgs = notification;
144:                         } else {
145:                                 msgs.add(notification);
146:                         }
147:                 }
148:                 return msgs;
149:         }
150:
151:         /**
152:          * <!-- begin-user-doc -->
153:          * <!-- end-user-doc -->
154:          *
155:          * @generated
156:          */
157:         @Override
158:         public void setKeyDMR(VDomainModelReference newKeyDMR) {
159:•                if (newKeyDMR != keyDMR) {
160:                         NotificationChain msgs = null;
161:•                        if (keyDMR != null) {
162:                                 msgs = ((InternalEObject) keyDMR).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
163:                                         - VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR, null, msgs);
164:                         }
165:•                        if (newKeyDMR != null) {
166:                                 msgs = ((InternalEObject) newKeyDMR).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
167:                                         - VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR, null, msgs);
168:                         }
169:                         msgs = basicSetKeyDMR(newKeyDMR, msgs);
170:•                        if (msgs != null) {
171:                                 msgs.dispatch();
172:                         }
173:•                } else if (eNotificationRequired()) {
174:                         eNotify(new ENotificationImpl(this, Notification.SET,
175:                                 VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR, newKeyDMR, newKeyDMR));
176:                 }
177:         }
178:
179:         /**
180:          * <!-- begin-user-doc -->
181:          * <!-- end-user-doc -->
182:          *
183:          * @generated
184:          */
185:         @Override
186:         public Object getKeyValue() {
187:                 return keyValue;
188:         }
189:
190:         /**
191:          * <!-- begin-user-doc -->
192:          * <!-- end-user-doc -->
193:          *
194:          * @generated
195:          */
196:         @Override
197:         public void setKeyValue(Object newKeyValue) {
198:                 final Object oldKeyValue = keyValue;
199:                 keyValue = newKeyValue;
200:•                if (eNotificationRequired()) {
201:                         eNotify(new ENotificationImpl(this, Notification.SET,
202:                                 VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE, oldKeyValue, keyValue));
203:                 }
204:         }
205:
206:         /**
207:          * <!-- begin-user-doc -->
208:          * <!-- end-user-doc -->
209:          *
210:          * @generated
211:          */
212:         @Override
213:         public VDomainModelReference getValueDMR() {
214:                 return valueDMR;
215:         }
216:
217:         /**
218:          * <!-- begin-user-doc -->
219:          * <!-- end-user-doc -->
220:          *
221:          * @generated
222:          */
223:         public NotificationChain basicSetValueDMR(VDomainModelReference newValueDMR, NotificationChain msgs) {
224:                 final VDomainModelReference oldValueDMR = valueDMR;
225:                 valueDMR = newValueDMR;
226:•                if (eNotificationRequired()) {
227:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
228:                                 VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR, oldValueDMR, newValueDMR);
229:•                        if (msgs == null) {
230:                                 msgs = notification;
231:                         } else {
232:                                 msgs.add(notification);
233:                         }
234:                 }
235:                 return msgs;
236:         }
237:
238:         /**
239:          * <!-- begin-user-doc -->
240:          * <!-- end-user-doc -->
241:          *
242:          * @generated
243:          */
244:         @Override
245:         public void setValueDMR(VDomainModelReference newValueDMR) {
246:•                if (newValueDMR != valueDMR) {
247:                         NotificationChain msgs = null;
248:•                        if (valueDMR != null) {
249:                                 msgs = ((InternalEObject) valueDMR).eInverseRemove(this, EOPPOSITE_FEATURE_BASE
250:                                         - VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR, null, msgs);
251:                         }
252:•                        if (newValueDMR != null) {
253:                                 msgs = ((InternalEObject) newValueDMR).eInverseAdd(this, EOPPOSITE_FEATURE_BASE
254:                                         - VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR, null, msgs);
255:                         }
256:                         msgs = basicSetValueDMR(newValueDMR, msgs);
257:•                        if (msgs != null) {
258:                                 msgs.dispatch();
259:                         }
260:•                } else if (eNotificationRequired()) {
261:                         eNotify(new ENotificationImpl(this, Notification.SET,
262:                                 VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR, newValueDMR, newValueDMR));
263:                 }
264:         }
265:
266:         /**
267:          * <!-- begin-user-doc -->
268:          * <!-- end-user-doc -->
269:          *
270:          * @generated
271:          */
272:         @Override
273:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
274:•                switch (featureID) {
275:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR:
276:                         return basicSetKeyDMR(null, msgs);
277:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR:
278:                         return basicSetValueDMR(null, msgs);
279:                 }
280:                 return super.eInverseRemove(otherEnd, featureID, msgs);
281:         }
282:
283:         /**
284:          * <!-- begin-user-doc -->
285:          * <!-- end-user-doc -->
286:          *
287:          * @generated
288:          */
289:         @Override
290:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
291:•                switch (featureID) {
292:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR:
293:                         return getKeyDMR();
294:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE:
295:                         return getKeyValue();
296:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR:
297:                         return getValueDMR();
298:                 }
299:                 return super.eGet(featureID, resolve, coreType);
300:         }
301:
302:         /**
303:          * <!-- begin-user-doc -->
304:          * <!-- end-user-doc -->
305:          *
306:          * @generated
307:          */
308:         @Override
309:         public void eSet(int featureID, Object newValue) {
310:•                switch (featureID) {
311:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR:
312:                         setKeyDMR((VDomainModelReference) newValue);
313:                         return;
314:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE:
315:                         setKeyValue(newValue);
316:                         return;
317:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR:
318:                         setValueDMR((VDomainModelReference) newValue);
319:                         return;
320:                 }
321:                 super.eSet(featureID, newValue);
322:         }
323:
324:         /**
325:          * <!-- begin-user-doc -->
326:          * <!-- end-user-doc -->
327:          *
328:          * @generated
329:          */
330:         @Override
331:         public void eUnset(int featureID) {
332:•                switch (featureID) {
333:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR:
334:                         setKeyDMR((VDomainModelReference) null);
335:                         return;
336:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE:
337:                         setKeyValue(KEY_VALUE_EDEFAULT);
338:                         return;
339:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR:
340:                         setValueDMR((VDomainModelReference) null);
341:                         return;
342:                 }
343:                 super.eUnset(featureID);
344:         }
345:
346:         /**
347:          * <!-- begin-user-doc -->
348:          * <!-- end-user-doc -->
349:          *
350:          * @generated
351:          */
352:         @Override
353:         public boolean eIsSet(int featureID) {
354:•                switch (featureID) {
355:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_DMR:
356:•                        return keyDMR != null;
357:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__KEY_VALUE:
358:•                        return KEY_VALUE_EDEFAULT == null ? keyValue != null : !KEY_VALUE_EDEFAULT.equals(keyValue);
359:                 case VKeyattributedmrPackage.KEY_ATTRIBUTE_DOMAIN_MODEL_REFERENCE__VALUE_DMR:
360:•                        return valueDMR != null;
361:                 }
362:                 return super.eIsSet(featureID);
363:         }
364:
365:         /**
366:          * <!-- begin-user-doc -->
367:          * <!-- end-user-doc -->
368:          *
369:          * @generated
370:          */
371:         @Override
372:         public String toString() {
373:•                if (eIsProxy()) {
374:                         return super.toString();
375:                 }
376:
377:                 final StringBuffer result = new StringBuffer(super.toString());
378:                 result.append(" (keyValue: "); //$NON-NLS-1$
379:                 result.append(keyValue);
380:                 result.append(')');
381:                 return result.toString();
382:         }
383:
384:         @SuppressWarnings("unchecked")
385:         @Deprecated
386:         @Override
387:         public boolean init(EObject eObject) {
388:•                if (getKeyValue() == null) {
389:                         return false;
390:                 }
391:                 final boolean init = super.init(eObject);
392:                 final List<EObject> list = (List<EObject>) lastResolvedEObject.eGet(getDomainModelEFeature());
393:                 EObject foundChild = null;
394:•                if (list.size() == 0) {
395:                         final EReference eReference = (EReference) getDomainModelEFeature();
396:                         foundChild = EcoreUtil.create(eReference.getEReferenceType());
397:                         list.add(foundChild);
398:                         getKeyDMR().init(foundChild);
399:                         final Setting keySetting = getKeyDMR().getIterator().next();
400:                         Object keyValue = getKeyValue();
401:•                        if (EcorePackage.eINSTANCE.getEEnum().isInstance(keySetting.getEStructuralFeature().getEType())) {
402:                                 final EEnum eenum = EEnum.class.cast(keySetting.getEStructuralFeature().getEType());
403:                                 keyValue = eenum.getEEnumLiteralByLiteral((String) keyValue).getInstance();
404:
405:                         }
406:                         keySetting.set(keyValue);
407:                 } else {
408:•                        for (final EObject child : list) {
409:                                 getKeyDMR().init(child);
410:                                 final Setting setting = getKeyDMR().getIterator().next();
411:•                                if (EcorePackage.eINSTANCE.getEEnum().isInstance(setting.getEStructuralFeature().getEType())) {
412:•                                        if (getKeyValue().equals(Enumerator.class.cast(setting.get(true)).getLiteral())) {
413:                                                 foundChild = child;
414:                                                 break;
415:                                         }
416:
417:•                                } else if (getKeyValue().equals(setting.get(true))) {
418:                                         foundChild = child;
419:                                         break;
420:                                 }
421:                         }
422:                 }
423:
424:                 final boolean valueDMR = getValueDMR().init(foundChild);
425:•                return init && valueDMR;
426:         }
427:
428:         @Deprecated
429:         @Override
430:         public Iterator<Setting> getIterator() {
431:•                if (getValueDMR() == null) {
432:                         final Set<Setting> settings = Collections.emptySet();
433:                         return settings.iterator();
434:                 }
435:                 return getValueDMR().getIterator();
436:         }
437:
438:         @Deprecated
439:         @Override
440:         public Iterator<EStructuralFeature> getEStructuralFeatureIterator() {
441:•                if (getValueDMR() == null) {
442:                         final Set<EStructuralFeature> features = Collections.emptySet();
443:                         return features.iterator();
444:                 }
445:                 return getValueDMR().getEStructuralFeatureIterator();
446:         }
447:
448: } // VKeyAttributeDomainModelReferenceImpl