Skip to content

Package: VMappingDomainModelReferenceImpl

VMappingDomainModelReferenceImpl

nameinstructionbranchcomplexitylinemethod
VMappingDomainModelReferenceImpl()
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%
basicGetMappedClass()
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%
basicSetDomainModelReference(VDomainModelReference, NotificationChain)
M: 18 C: 11
38%
M: 3 C: 1
25%
M: 2 C: 1
33%
M: 9 C: 4
31%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 3 C: 16
84%
M: 1 C: 4
80%
M: 1 C: 3
75%
M: 1 C: 5
83%
M: 0 C: 1
100%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 13 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
eIsSet(int)
M: 9 C: 11
55%
M: 4 C: 3
43%
M: 3 C: 2
40%
M: 1 C: 3
75%
M: 0 C: 1
100%
eSet(int, Object)
M: 17 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 7 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: 14 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
getDomainModelReference()
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%
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%
getMappedClass()
M: 28 C: 10
26%
M: 6 C: 2
25%
M: 4 C: 1
20%
M: 9 C: 2
18%
M: 0 C: 1
100%
init(EObject)
M: 47 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
setDomainModelReference(VDomainModelReference)
M: 16 C: 36
69%
M: 4 C: 6
60%
M: 3 C: 3
50%
M: 7 C: 17
71%
M: 0 C: 1
100%
setMappedClass(EClass)
M: 11 C: 10
48%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 5 C: 4
44%
M: 0 C: 1
100%

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.mappingdmr.model.impl;
15:
16: import java.util.Collections;
17: import java.util.Iterator;
18: import java.util.Set;
19:
20: import org.eclipse.emf.common.notify.Notification;
21: import org.eclipse.emf.common.notify.NotificationChain;
22: import org.eclipse.emf.common.util.EMap;
23: import org.eclipse.emf.ecore.EClass;
24: import org.eclipse.emf.ecore.EObject;
25: import org.eclipse.emf.ecore.EStructuralFeature;
26: import org.eclipse.emf.ecore.EStructuralFeature.Setting;
27: import org.eclipse.emf.ecore.InternalEObject;
28: import org.eclipse.emf.ecore.impl.ENotificationImpl;
29: import org.eclipse.emf.ecp.view.spi.mappingdmr.model.VMappingDomainModelReference;
30: import org.eclipse.emf.ecp.view.spi.mappingdmr.model.VMappingdmrPackage;
31: import org.eclipse.emf.ecp.view.spi.model.VDomainModelReference;
32: import org.eclipse.emf.ecp.view.spi.model.impl.VFeaturePathDomainModelReferenceImpl;
33:
34: /**
35: * <!-- begin-user-doc --> An implementation of the model object ' <em><b>Mapping Domain Model Reference</b></em>'. <!--
36: * end-user-doc -->
37: * <p>
38: * The following features are implemented:
39: * <ul>
40: * <li>
41: * {@link org.eclipse.emf.ecp.view.spi.mappingdmr.model.impl.VMappingDomainModelReferenceImpl#getMappedClass
42: * <em>Mapped Class</em>}</li>
43: * <li>
44: * {@link org.eclipse.emf.ecp.view.spi.mappingdmr.model.impl.VMappingDomainModelReferenceImpl#getDomainModelReference
45: * <em>Domain Model Reference</em>}</li>
46: * </ul>
47: * </p>
48: *
49: * @generated
50: */
51: public class VMappingDomainModelReferenceImpl extends
52:         VFeaturePathDomainModelReferenceImpl implements
53:         VMappingDomainModelReference {
54:         /**
55:          * The cached value of the '{@link #getMappedClass() <em>Mapped Class</em>}'
56:          * reference. <!-- begin-user-doc --> <!-- end-user-doc -->
57:          *
58:          * @see #getMappedClass()
59:          * @generated
60:          * @ordered
61:          */
62:         protected EClass mappedClass;
63:
64:         /**
65:          * The cached value of the '{@link #getDomainModelReference()
66:          * <em>Domain Model Reference</em>}' containment reference. <!--
67:          * begin-user-doc --> <!-- end-user-doc -->
68:          *
69:          * @see #getDomainModelReference()
70:          * @generated
71:          * @ordered
72:          */
73:         protected VDomainModelReference domainModelReference;
74:
75:         /**
76:          * <!-- begin-user-doc --> <!-- end-user-doc -->
77:          *
78:          * @generated
79:          */
80:         protected VMappingDomainModelReferenceImpl() {
81:                 super();
82:         }
83:
84:         /**
85:          * <!-- begin-user-doc --> <!-- end-user-doc -->
86:          *
87:          * @generated
88:          */
89:         @Override
90:         protected EClass eStaticClass() {
91:                 return VMappingdmrPackage.Literals.MAPPING_DOMAIN_MODEL_REFERENCE;
92:         }
93:
94:         /**
95:          * <!-- begin-user-doc --> <!-- end-user-doc -->
96:          *
97:          * @generated
98:          */
99:         @Override
100:         public EClass getMappedClass() {
101:•                if (mappedClass != null && mappedClass.eIsProxy()) {
102:                         final InternalEObject oldMappedClass = (InternalEObject) mappedClass;
103:                         mappedClass = (EClass) eResolveProxy(oldMappedClass);
104:•                        if (mappedClass != oldMappedClass) {
105:•                                if (eNotificationRequired()) {
106:                                         eNotify(new ENotificationImpl(
107:                                                 this,
108:                                                 Notification.RESOLVE,
109:                                                 VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__MAPPED_CLASS,
110:                                                 oldMappedClass, mappedClass));
111:                                 }
112:                         }
113:                 }
114:                 return mappedClass;
115:         }
116:
117:         /**
118:          * <!-- begin-user-doc --> <!-- end-user-doc -->
119:          *
120:          * @generated
121:          */
122:         public EClass basicGetMappedClass() {
123:                 return mappedClass;
124:         }
125:
126:         /**
127:          * <!-- begin-user-doc --> <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public void setMappedClass(EClass newMappedClass) {
133:                 final EClass oldMappedClass = mappedClass;
134:                 mappedClass = newMappedClass;
135:•                if (eNotificationRequired()) {
136:                         eNotify(new ENotificationImpl(
137:                                 this,
138:                                 Notification.SET,
139:                                 VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__MAPPED_CLASS,
140:                                 oldMappedClass, mappedClass));
141:                 }
142:         }
143:
144:         /**
145:          * <!-- begin-user-doc --> <!-- end-user-doc -->
146:          *
147:          * @generated
148:          */
149:         @Override
150:         public VDomainModelReference getDomainModelReference() {
151:                 return domainModelReference;
152:         }
153:
154:         /**
155:          * <!-- begin-user-doc --> <!-- end-user-doc -->
156:          *
157:          * @generated
158:          */
159:         public NotificationChain basicSetDomainModelReference(
160:                 VDomainModelReference newDomainModelReference,
161:                 NotificationChain msgs) {
162:                 final VDomainModelReference oldDomainModelReference = domainModelReference;
163:                 domainModelReference = newDomainModelReference;
164:•                if (eNotificationRequired()) {
165:                         final ENotificationImpl notification = new ENotificationImpl(
166:                                 this,
167:                                 Notification.SET,
168:                                 VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE,
169:                                 oldDomainModelReference, newDomainModelReference);
170:•                        if (msgs == null) {
171:                                 msgs = notification;
172:                         } else {
173:                                 msgs.add(notification);
174:                         }
175:                 }
176:                 return msgs;
177:         }
178:
179:         /**
180:          * <!-- begin-user-doc --> <!-- end-user-doc -->
181:          *
182:          * @generated
183:          */
184:         @Override
185:         public void setDomainModelReference(
186:                 VDomainModelReference newDomainModelReference) {
187:•                if (newDomainModelReference != domainModelReference) {
188:                         NotificationChain msgs = null;
189:•                        if (domainModelReference != null) {
190:                                 msgs = ((InternalEObject) domainModelReference)
191:                                         .eInverseRemove(
192:                                                 this,
193:                                                 EOPPOSITE_FEATURE_BASE
194:                                                         - VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE,
195:                                                 null, msgs);
196:                         }
197:•                        if (newDomainModelReference != null) {
198:                                 msgs = ((InternalEObject) newDomainModelReference)
199:                                         .eInverseAdd(
200:                                                 this,
201:                                                 EOPPOSITE_FEATURE_BASE
202:                                                         - VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE,
203:                                                 null, msgs);
204:                         }
205:                         msgs = basicSetDomainModelReference(newDomainModelReference, msgs);
206:•                        if (msgs != null) {
207:                                 msgs.dispatch();
208:                         }
209:•                } else if (eNotificationRequired()) {
210:                         eNotify(new ENotificationImpl(
211:                                 this,
212:                                 Notification.SET,
213:                                 VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE,
214:                                 newDomainModelReference, newDomainModelReference));
215:                 }
216:         }
217:
218:         /**
219:          * <!-- begin-user-doc --> <!-- end-user-doc -->
220:          *
221:          * @generated
222:          */
223:         @Override
224:         public NotificationChain eInverseRemove(InternalEObject otherEnd,
225:                 int featureID, NotificationChain msgs) {
226:•                switch (featureID) {
227:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE:
228:                         return basicSetDomainModelReference(null, msgs);
229:                 }
230:                 return super.eInverseRemove(otherEnd, featureID, msgs);
231:         }
232:
233:         /**
234:          * <!-- begin-user-doc --> <!-- end-user-doc -->
235:          *
236:          * @generated
237:          */
238:         @Override
239:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
240:•                switch (featureID) {
241:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__MAPPED_CLASS:
242:•                        if (resolve) {
243:                                 return getMappedClass();
244:                         }
245:                         return basicGetMappedClass();
246:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE:
247:                         return getDomainModelReference();
248:                 }
249:                 return super.eGet(featureID, resolve, coreType);
250:         }
251:
252:         /**
253:          * <!-- begin-user-doc --> <!-- end-user-doc -->
254:          *
255:          * @generated
256:          */
257:         @Override
258:         public void eSet(int featureID, Object newValue) {
259:•                switch (featureID) {
260:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__MAPPED_CLASS:
261:                         setMappedClass((EClass) newValue);
262:                         return;
263:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE:
264:                         setDomainModelReference((VDomainModelReference) newValue);
265:                         return;
266:                 }
267:                 super.eSet(featureID, newValue);
268:         }
269:
270:         /**
271:          * <!-- begin-user-doc --> <!-- end-user-doc -->
272:          *
273:          * @generated
274:          */
275:         @Override
276:         public void eUnset(int featureID) {
277:•                switch (featureID) {
278:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__MAPPED_CLASS:
279:                         setMappedClass((EClass) null);
280:                         return;
281:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE:
282:                         setDomainModelReference((VDomainModelReference) null);
283:                         return;
284:                 }
285:                 super.eUnset(featureID);
286:         }
287:
288:         /**
289:          * <!-- begin-user-doc --> <!-- end-user-doc -->
290:          *
291:          * @generated
292:          */
293:         @Override
294:         public boolean eIsSet(int featureID) {
295:•                switch (featureID) {
296:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__MAPPED_CLASS:
297:•                        return mappedClass != null;
298:                 case VMappingdmrPackage.MAPPING_DOMAIN_MODEL_REFERENCE__DOMAIN_MODEL_REFERENCE:
299:•                        return domainModelReference != null;
300:                 }
301:                 return super.eIsSet(featureID);
302:         }
303:
304:         @SuppressWarnings("unchecked")
305:         @Deprecated
306:         @Override
307:         public boolean init(EObject eObject) {
308:                 final boolean init = super.init(eObject);
309:                 final EMap<EClass, EObject> map = (EMap<EClass, EObject>) lastResolvedEObject.eGet(getDomainModelEFeature());
310:•                if (!map.containsKey(getMappedClass())) {
311:                         map.put(getMappedClass(), getMappedClass().getEPackage().getEFactoryInstance().create(getMappedClass()));
312:                 }
313:                 final EObject mappedEObject = map.get(getMappedClass());
314:                 final boolean subDMRInit = getDomainModelReference().init(mappedEObject);
315:•                return init && subDMRInit;
316:         }
317:
318:         @Deprecated
319:         @Override
320:         public Iterator<Setting> getIterator() {
321:•                if (getDomainModelReference() == null) {
322:                         final Set<Setting> settings = Collections.emptySet();
323:                         return settings.iterator();
324:                 }
325:                 return getDomainModelReference().getIterator();
326:         }
327:
328:         @Deprecated
329:         @Override
330:         public Iterator<EStructuralFeature> getEStructuralFeatureIterator() {
331:•                if (getDomainModelReference() == null) {
332:                         final Set<EStructuralFeature> features = Collections.emptySet();
333:                         return features.iterator();
334:                 }
335:                 return getDomainModelReference().getEStructuralFeatureIterator();
336:         }
337:
338: } // VMappingDomainModelReferenceImpl