Skip to content

Package: ComponentImpl

ComponentImpl

nameinstructionbranchcomplexitylinemethod
ComponentImpl()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
basicSetParent(Component, NotificationChain)
M: 9 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
eBasicRemoveFromContainerFeature(NotificationChain)
M: 15 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
eGet(int, boolean, boolean)
M: 17 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
eInverseAdd(InternalEObject, int, NotificationChain)
M: 28 C: 0
0%
M: 5 C: 0
0%
M: 4 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 27 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
eIsSet(int)
M: 35 C: 0
0%
M: 14 C: 0
0%
M: 9 C: 0
0%
M: 5 C: 0
0%
M: 1 C: 0
0%
eSet(int, Object)
M: 32 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 11 C: 0
0%
M: 1 C: 0
0%
eStaticClass()
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%
eUnset(int)
M: 18 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
getActivities()
M: 14 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getChildren()
M: 15 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
getParent()
M: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
setParent(Component)
M: 69 C: 0
0%
M: 16 C: 0
0%
M: 9 C: 0
0%
M: 17 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (c) 2011-2018 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: * EclipseSource Munich - initial API and implementation
13: */
14: package org.eclipse.emfforms.coffee.model.coffee.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.MinimalEObjectImpl;
25: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
26: import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
27: import org.eclipse.emf.ecore.util.EcoreUtil;
28: import org.eclipse.emf.ecore.util.InternalEList;
29: import org.eclipse.emfforms.coffee.model.coffee.Activity;
30: import org.eclipse.emfforms.coffee.model.coffee.CoffeePackage;
31: import org.eclipse.emfforms.coffee.model.coffee.Component;
32:
33: /**
34: * <!-- begin-user-doc -->
35: * An implementation of the model object '<em><b>Component</b></em>'.
36: * <!-- end-user-doc -->
37: * <p>
38: * The following features are implemented:
39: * </p>
40: * <ul>
41: * <li>{@link org.eclipse.emfforms.coffee.model.coffee.impl.ComponentImpl#getChildren <em>Children</em>}</li>
42: * <li>{@link org.eclipse.emfforms.coffee.model.coffee.impl.ComponentImpl#getParent <em>Parent</em>}</li>
43: * <li>{@link org.eclipse.emfforms.coffee.model.coffee.impl.ComponentImpl#getActivities <em>Activities</em>}</li>
44: * </ul>
45: *
46: * @generated
47: */
48: public abstract class ComponentImpl extends MinimalEObjectImpl.Container implements Component {
49:         /**
50:          * The cached value of the '{@link #getChildren() <em>Children</em>}' containment reference list.
51:          * <!-- begin-user-doc -->
52:          * <!-- end-user-doc -->
53:          *
54:          * @see #getChildren()
55:          * @generated
56:          * @ordered
57:          */
58:         protected EList<Component> children;
59:
60:         /**
61:          * The cached value of the '{@link #getActivities() <em>Activities</em>}' containment reference list.
62:          * <!-- begin-user-doc -->
63:          * <!-- end-user-doc -->
64:          *
65:          * @see #getActivities()
66:          * @generated
67:          * @ordered
68:          */
69:         protected EList<Activity> activities;
70:
71:         /**
72:          * <!-- begin-user-doc -->
73:          * <!-- end-user-doc -->
74:          *
75:          * @generated
76:          */
77:         protected ComponentImpl() {
78:                 super();
79:         }
80:
81:         /**
82:          * <!-- begin-user-doc -->
83:          * <!-- end-user-doc -->
84:          *
85:          * @generated
86:          */
87:         @Override
88:         protected EClass eStaticClass() {
89:                 return CoffeePackage.Literals.COMPONENT;
90:         }
91:
92:         /**
93:          * <!-- begin-user-doc -->
94:          * <!-- end-user-doc -->
95:          *
96:          * @generated
97:          */
98:         @Override
99:         public EList<Component> getChildren() {
100:•                if (children == null) {
101:                         children = new EObjectContainmentWithInverseEList<Component>(Component.class, this,
102:                                 CoffeePackage.COMPONENT__CHILDREN, CoffeePackage.COMPONENT__PARENT);
103:                 }
104:                 return children;
105:         }
106:
107:         /**
108:          * <!-- begin-user-doc -->
109:          * <!-- end-user-doc -->
110:          *
111:          * @generated
112:          */
113:         @Override
114:         public Component getParent() {
115:•                if (eContainerFeatureID() != CoffeePackage.COMPONENT__PARENT) {
116:                         return null;
117:                 }
118:                 return (Component) eInternalContainer();
119:         }
120:
121:         /**
122:          * <!-- begin-user-doc -->
123:          * <!-- end-user-doc -->
124:          *
125:          * @generated
126:          */
127:         public NotificationChain basicSetParent(Component newParent, NotificationChain msgs) {
128:                 msgs = eBasicSetContainer((InternalEObject) newParent, CoffeePackage.COMPONENT__PARENT, msgs);
129:                 return msgs;
130:         }
131:
132:         /**
133:          * <!-- begin-user-doc -->
134:          * <!-- end-user-doc -->
135:          *
136:          * @generated
137:          */
138:         @Override
139:         public void setParent(Component newParent) {
140:•                if (newParent != eInternalContainer()
141:•                        || eContainerFeatureID() != CoffeePackage.COMPONENT__PARENT && newParent != null) {
142:•                        if (EcoreUtil.isAncestor(this, newParent)) {
143:                                 throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); //$NON-NLS-1$
144:                         }
145:                         NotificationChain msgs = null;
146:•                        if (eInternalContainer() != null) {
147:                                 msgs = eBasicRemoveFromContainer(msgs);
148:                         }
149:•                        if (newParent != null) {
150:                                 msgs = ((InternalEObject) newParent).eInverseAdd(this, CoffeePackage.COMPONENT__CHILDREN,
151:                                         Component.class, msgs);
152:                         }
153:                         msgs = basicSetParent(newParent, msgs);
154:•                        if (msgs != null) {
155:                                 msgs.dispatch();
156:                         }
157:•                } else if (eNotificationRequired()) {
158:                         eNotify(
159:                                 new ENotificationImpl(this, Notification.SET, CoffeePackage.COMPONENT__PARENT, newParent, newParent));
160:                 }
161:         }
162:
163:         /**
164:          * <!-- begin-user-doc -->
165:          * <!-- end-user-doc -->
166:          *
167:          * @generated
168:          */
169:         @Override
170:         public EList<Activity> getActivities() {
171:•                if (activities == null) {
172:                         activities = new EObjectContainmentEList<Activity>(Activity.class, this,
173:                                 CoffeePackage.COMPONENT__ACTIVITIES);
174:                 }
175:                 return activities;
176:         }
177:
178:         /**
179:          * <!-- begin-user-doc -->
180:          * <!-- end-user-doc -->
181:          *
182:          * @generated
183:          */
184:         @SuppressWarnings("unchecked")
185:         @Override
186:         public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
187:•                switch (featureID) {
188:                 case CoffeePackage.COMPONENT__CHILDREN:
189:                         return ((InternalEList<InternalEObject>) (InternalEList<?>) getChildren()).basicAdd(otherEnd, msgs);
190:                 case CoffeePackage.COMPONENT__PARENT:
191:•                        if (eInternalContainer() != null) {
192:                                 msgs = eBasicRemoveFromContainer(msgs);
193:                         }
194:                         return basicSetParent((Component) otherEnd, msgs);
195:                 }
196:                 return super.eInverseAdd(otherEnd, featureID, msgs);
197:         }
198:
199:         /**
200:          * <!-- begin-user-doc -->
201:          * <!-- end-user-doc -->
202:          *
203:          * @generated
204:          */
205:         @Override
206:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
207:•                switch (featureID) {
208:                 case CoffeePackage.COMPONENT__CHILDREN:
209:                         return ((InternalEList<?>) getChildren()).basicRemove(otherEnd, msgs);
210:                 case CoffeePackage.COMPONENT__PARENT:
211:                         return basicSetParent(null, msgs);
212:                 case CoffeePackage.COMPONENT__ACTIVITIES:
213:                         return ((InternalEList<?>) getActivities()).basicRemove(otherEnd, msgs);
214:                 }
215:                 return super.eInverseRemove(otherEnd, featureID, msgs);
216:         }
217:
218:         /**
219:          * <!-- begin-user-doc -->
220:          * <!-- end-user-doc -->
221:          *
222:          * @generated
223:          */
224:         @Override
225:         public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
226:•                switch (eContainerFeatureID()) {
227:                 case CoffeePackage.COMPONENT__PARENT:
228:                         return eInternalContainer().eInverseRemove(this, CoffeePackage.COMPONENT__CHILDREN, Component.class, msgs);
229:                 }
230:                 return super.eBasicRemoveFromContainerFeature(msgs);
231:         }
232:
233:         /**
234:          * <!-- begin-user-doc -->
235:          * <!-- end-user-doc -->
236:          *
237:          * @generated
238:          */
239:         @Override
240:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
241:•                switch (featureID) {
242:                 case CoffeePackage.COMPONENT__CHILDREN:
243:                         return getChildren();
244:                 case CoffeePackage.COMPONENT__PARENT:
245:                         return getParent();
246:                 case CoffeePackage.COMPONENT__ACTIVITIES:
247:                         return getActivities();
248:                 }
249:                 return super.eGet(featureID, resolve, coreType);
250:         }
251:
252:         /**
253:          * <!-- begin-user-doc -->
254:          * <!-- end-user-doc -->
255:          *
256:          * @generated
257:          */
258:         @SuppressWarnings("unchecked")
259:         @Override
260:         public void eSet(int featureID, Object newValue) {
261:•                switch (featureID) {
262:                 case CoffeePackage.COMPONENT__CHILDREN:
263:                         getChildren().clear();
264:                         getChildren().addAll((Collection<? extends Component>) newValue);
265:                         return;
266:                 case CoffeePackage.COMPONENT__PARENT:
267:                         setParent((Component) newValue);
268:                         return;
269:                 case CoffeePackage.COMPONENT__ACTIVITIES:
270:                         getActivities().clear();
271:                         getActivities().addAll((Collection<? extends Activity>) newValue);
272:                         return;
273:                 }
274:                 super.eSet(featureID, newValue);
275:         }
276:
277:         /**
278:          * <!-- begin-user-doc -->
279:          * <!-- end-user-doc -->
280:          *
281:          * @generated
282:          */
283:         @Override
284:         public void eUnset(int featureID) {
285:•                switch (featureID) {
286:                 case CoffeePackage.COMPONENT__CHILDREN:
287:                         getChildren().clear();
288:                         return;
289:                 case CoffeePackage.COMPONENT__PARENT:
290:                         setParent((Component) null);
291:                         return;
292:                 case CoffeePackage.COMPONENT__ACTIVITIES:
293:                         getActivities().clear();
294:                         return;
295:                 }
296:                 super.eUnset(featureID);
297:         }
298:
299:         /**
300:          * <!-- begin-user-doc -->
301:          * <!-- end-user-doc -->
302:          *
303:          * @generated
304:          */
305:         @Override
306:         public boolean eIsSet(int featureID) {
307:•                switch (featureID) {
308:                 case CoffeePackage.COMPONENT__CHILDREN:
309:•                        return children != null && !children.isEmpty();
310:                 case CoffeePackage.COMPONENT__PARENT:
311:•                        return getParent() != null;
312:                 case CoffeePackage.COMPONENT__ACTIVITIES:
313:•                        return activities != null && !activities.isEmpty();
314:                 }
315:                 return super.eIsSet(featureID);
316:         }
317:
318: } // ComponentImpl