Skip to content

Package: CrossReferenceContainerImpl

CrossReferenceContainerImpl

nameinstructionbranchcomplexitylinemethod
CrossReferenceContainerImpl()
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%
basicSetSingleContent(CrossReferenceContent, NotificationChain)
M: 0 C: 29
100%
M: 0 C: 4
100%
M: 0 C: 3
100%
M: 0 C: 10
100%
M: 0 C: 1
100%
eGet(int, boolean, boolean)
M: 14 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
eInverseAdd(InternalEObject, int, NotificationChain)
M: 33 C: 0
0%
M: 5 C: 0
0%
M: 4 C: 0
0%
M: 7 C: 0
0%
M: 1 C: 0
0%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 6 C: 14
70%
M: 1 C: 2
67%
M: 1 C: 2
67%
M: 1 C: 3
75%
M: 0 C: 1
100%
eIsSet(int)
M: 24 C: 0
0%
M: 9 C: 0
0%
M: 6 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
eSet(int, Object)
M: 22 C: 0
0%
M: 3 C: 0
0%
M: 3 C: 0
0%
M: 8 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%
getContents()
M: 0 C: 15
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getSingleContent()
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%
setSingleContent(CrossReferenceContent)
M: 13 C: 39
75%
M: 4 C: 6
60%
M: 3 C: 3
50%
M: 2 C: 13
87%
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.validation.test.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.InternalEObject;
23: import org.eclipse.emf.ecore.impl.ENotificationImpl;
24: import org.eclipse.emf.ecore.impl.EObjectImpl;
25: import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
26: import org.eclipse.emf.ecore.util.InternalEList;
27: import org.eclipse.emf.ecp.view.validation.test.model.CrossReferenceContainer;
28: import org.eclipse.emf.ecp.view.validation.test.model.CrossReferenceContent;
29: import org.eclipse.emf.ecp.view.validation.test.model.TestPackage;
30:
31: /**
32: * <!-- begin-user-doc -->
33: * An implementation of the model object '<em><b>Cross Reference Container</b></em>'.
34: * <!-- end-user-doc -->
35: * <p>
36: * The following features are implemented:
37: * </p>
38: * <ul>
39: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.CrossReferenceContainerImpl#getContents
40: * <em>Contents</em>}</li>
41: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.CrossReferenceContainerImpl#getSingleContent
42: * <em>Single Content</em>}</li>
43: * </ul>
44: *
45: * @generated
46: */
47: public class CrossReferenceContainerImpl extends EObjectImpl implements CrossReferenceContainer {
48:         /**
49:          * The cached value of the '{@link #getContents() <em>Contents</em>}' containment reference list.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @see #getContents()
54:          * @generated
55:          * @ordered
56:          */
57:         protected EList<CrossReferenceContent> contents;
58:
59:         /**
60:          * The cached value of the '{@link #getSingleContent() <em>Single Content</em>}' containment reference.
61:          * <!-- begin-user-doc -->
62:          * <!-- end-user-doc -->
63:          *
64:          * @see #getSingleContent()
65:          * @generated
66:          * @ordered
67:          */
68:         protected CrossReferenceContent singleContent;
69:
70:         /**
71:          * <!-- begin-user-doc -->
72:          * <!-- end-user-doc -->
73:          *
74:          * @generated
75:          */
76:         protected CrossReferenceContainerImpl() {
77:                 super();
78:         }
79:
80:         /**
81:          * <!-- begin-user-doc -->
82:          * <!-- end-user-doc -->
83:          *
84:          * @generated
85:          */
86:         @Override
87:         protected EClass eStaticClass() {
88:                 return TestPackage.Literals.CROSS_REFERENCE_CONTAINER;
89:         }
90:
91:         /**
92:          * <!-- begin-user-doc -->
93:          * <!-- end-user-doc -->
94:          *
95:          * @generated
96:          */
97:         @Override
98:         public EList<CrossReferenceContent> getContents() {
99:•                if (contents == null) {
100:                         contents = new EObjectContainmentWithInverseEList<CrossReferenceContent>(CrossReferenceContent.class, this,
101:                                 TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS, TestPackage.CROSS_REFERENCE_CONTENT__PARENT);
102:                 }
103:                 return contents;
104:         }
105:
106:         /**
107:          * <!-- begin-user-doc -->
108:          * <!-- end-user-doc -->
109:          *
110:          * @generated
111:          */
112:         @Override
113:         public CrossReferenceContent getSingleContent() {
114:                 return singleContent;
115:         }
116:
117:         /**
118:          * <!-- begin-user-doc -->
119:          * <!-- end-user-doc -->
120:          *
121:          * @generated
122:          */
123:         public NotificationChain basicSetSingleContent(CrossReferenceContent newSingleContent, NotificationChain msgs) {
124:                 final CrossReferenceContent oldSingleContent = singleContent;
125:                 singleContent = newSingleContent;
126:•                if (eNotificationRequired()) {
127:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
128:                                 TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT, oldSingleContent, newSingleContent);
129:•                        if (msgs == null) {
130:                                 msgs = notification;
131:                         } else {
132:                                 msgs.add(notification);
133:                         }
134:                 }
135:                 return msgs;
136:         }
137:
138:         /**
139:          * <!-- begin-user-doc -->
140:          * <!-- end-user-doc -->
141:          *
142:          * @generated
143:          */
144:         @Override
145:         public void setSingleContent(CrossReferenceContent newSingleContent) {
146:•                if (newSingleContent != singleContent) {
147:                         NotificationChain msgs = null;
148:•                        if (singleContent != null) {
149:                                 msgs = ((InternalEObject) singleContent).eInverseRemove(this,
150:                                         TestPackage.CROSS_REFERENCE_CONTENT__SINGLE_PARENT, CrossReferenceContent.class, msgs);
151:                         }
152:•                        if (newSingleContent != null) {
153:                                 msgs = ((InternalEObject) newSingleContent).eInverseAdd(this,
154:                                         TestPackage.CROSS_REFERENCE_CONTENT__SINGLE_PARENT, CrossReferenceContent.class, msgs);
155:                         }
156:                         msgs = basicSetSingleContent(newSingleContent, msgs);
157:•                        if (msgs != null) {
158:                                 msgs.dispatch();
159:                         }
160:•                } else if (eNotificationRequired()) {
161:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT,
162:                                 newSingleContent, newSingleContent));
163:                 }
164:         }
165:
166:         /**
167:          * <!-- begin-user-doc -->
168:          * <!-- end-user-doc -->
169:          *
170:          * @generated
171:          */
172:         @SuppressWarnings("unchecked")
173:         @Override
174:         public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
175:•                switch (featureID) {
176:                 case TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS:
177:                         return ((InternalEList<InternalEObject>) (InternalEList<?>) getContents()).basicAdd(otherEnd, msgs);
178:                 case TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT:
179:•                        if (singleContent != null) {
180:                                 msgs = ((InternalEObject) singleContent).eInverseRemove(this,
181:                                         EOPPOSITE_FEATURE_BASE - TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT, null, msgs);
182:                         }
183:                         return basicSetSingleContent((CrossReferenceContent) otherEnd, msgs);
184:                 }
185:                 return super.eInverseAdd(otherEnd, featureID, msgs);
186:         }
187:
188:         /**
189:          * <!-- begin-user-doc -->
190:          * <!-- end-user-doc -->
191:          *
192:          * @generated
193:          */
194:         @Override
195:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
196:•                switch (featureID) {
197:                 case TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS:
198:                         return ((InternalEList<?>) getContents()).basicRemove(otherEnd, msgs);
199:                 case TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT:
200:                         return basicSetSingleContent(null, msgs);
201:                 }
202:                 return super.eInverseRemove(otherEnd, featureID, msgs);
203:         }
204:
205:         /**
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @generated
210:          */
211:         @Override
212:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
213:•                switch (featureID) {
214:                 case TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS:
215:                         return getContents();
216:                 case TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT:
217:                         return getSingleContent();
218:                 }
219:                 return super.eGet(featureID, resolve, coreType);
220:         }
221:
222:         /**
223:          * <!-- begin-user-doc -->
224:          * <!-- end-user-doc -->
225:          *
226:          * @generated
227:          */
228:         @SuppressWarnings("unchecked")
229:         @Override
230:         public void eSet(int featureID, Object newValue) {
231:•                switch (featureID) {
232:                 case TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS:
233:                         getContents().clear();
234:                         getContents().addAll((Collection<? extends CrossReferenceContent>) newValue);
235:                         return;
236:                 case TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT:
237:                         setSingleContent((CrossReferenceContent) newValue);
238:                         return;
239:                 }
240:                 super.eSet(featureID, newValue);
241:         }
242:
243:         /**
244:          * <!-- begin-user-doc -->
245:          * <!-- end-user-doc -->
246:          *
247:          * @generated
248:          */
249:         @Override
250:         public void eUnset(int featureID) {
251:•                switch (featureID) {
252:                 case TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS:
253:                         getContents().clear();
254:                         return;
255:                 case TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT:
256:                         setSingleContent((CrossReferenceContent) null);
257:                         return;
258:                 }
259:                 super.eUnset(featureID);
260:         }
261:
262:         /**
263:          * <!-- begin-user-doc -->
264:          * <!-- end-user-doc -->
265:          *
266:          * @generated
267:          */
268:         @Override
269:         public boolean eIsSet(int featureID) {
270:•                switch (featureID) {
271:                 case TestPackage.CROSS_REFERENCE_CONTAINER__CONTENTS:
272:•                        return contents != null && !contents.isEmpty();
273:                 case TestPackage.CROSS_REFERENCE_CONTAINER__SINGLE_CONTENT:
274:•                        return singleContent != null;
275:                 }
276:                 return super.eIsSet(featureID);
277:         }
278:
279: } // CrossReferenceContainerImpl