Skip to content

Package: ComputerImpl

ComputerImpl

nameinstructionbranchcomplexitylinemethod
ComputerImpl()
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%
basicSetMainboard(Mainboard, NotificationChain)
M: 4 C: 25
86%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 1 C: 9
90%
M: 0 C: 1
100%
basicSetPowerBlock(PowerBlock, 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: 9 C: 11
55%
M: 2 C: 3
60%
M: 2 C: 3
60%
M: 2 C: 4
67%
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: 18 C: 31
63%
M: 7 C: 12
63%
M: 5 C: 7
58%
M: 1 C: 5
83%
M: 0 C: 1
100%
eSet(int, Object)
M: 25 C: 7
22%
M: 4 C: 1
20%
M: 4 C: 1
20%
M: 9 C: 3
25%
M: 0 C: 1
100%
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%
getColors()
M: 14 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%
getMainboard()
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%
getName()
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%
getPowerBlock()
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%
setMainboard(Mainboard)
M: 22 C: 30
58%
M: 5 C: 5
50%
M: 4 C: 2
33%
M: 4 C: 11
73%
M: 0 C: 1
100%
setName(String)
M: 0 C: 21
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
setPowerBlock(PowerBlock)
M: 25 C: 27
52%
M: 6 C: 4
40%
M: 5 C: 1
17%
M: 6 C: 9
60%
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: 37 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 9 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: * 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.EDataTypeUniqueEList;
26: import org.eclipse.emf.ecp.view.validation.test.model.Color;
27: import org.eclipse.emf.ecp.view.validation.test.model.Computer;
28: import org.eclipse.emf.ecp.view.validation.test.model.Mainboard;
29: import org.eclipse.emf.ecp.view.validation.test.model.PowerBlock;
30: import org.eclipse.emf.ecp.view.validation.test.model.TestPackage;
31:
32: /**
33: * <!-- begin-user-doc -->
34: * An implementation of the model object '<em><b>Computer</b></em>'.
35: * <!-- end-user-doc -->
36: * <p>
37: * The following features are implemented:
38: * </p>
39: * <ul>
40: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.ComputerImpl#getMainboard <em>Mainboard</em>}</li>
41: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.ComputerImpl#getName <em>Name</em>}</li>
42: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.ComputerImpl#getPowerBlock <em>Power Block</em>}</li>
43: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.ComputerImpl#getColors <em>Colors</em>}</li>
44: * </ul>
45: *
46: * @generated
47: */
48: public class ComputerImpl extends EObjectImpl implements Computer {
49:         /**
50:          * The cached value of the '{@link #getMainboard() <em>Mainboard</em>}' containment reference.
51:          * <!-- begin-user-doc -->
52:          * <!-- end-user-doc -->
53:          *
54:          * @see #getMainboard()
55:          * @generated
56:          * @ordered
57:          */
58:         protected Mainboard mainboard;
59:
60:         /**
61:          * The default value of the '{@link #getName() <em>Name</em>}' attribute.
62:          * <!-- begin-user-doc -->
63:          * <!-- end-user-doc -->
64:          *
65:          * @see #getName()
66:          * @generated
67:          * @ordered
68:          */
69:         protected static final String NAME_EDEFAULT = null;
70:
71:         /**
72:          * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
73:          * <!-- begin-user-doc -->
74:          * <!-- end-user-doc -->
75:          *
76:          * @see #getName()
77:          * @generated
78:          * @ordered
79:          */
80:         protected String name = NAME_EDEFAULT;
81:
82:         /**
83:          * The cached value of the '{@link #getPowerBlock() <em>Power Block</em>}' containment reference.
84:          * <!-- begin-user-doc -->
85:          * <!-- end-user-doc -->
86:          *
87:          * @see #getPowerBlock()
88:          * @generated
89:          * @ordered
90:          */
91:         protected PowerBlock powerBlock;
92:
93:         /**
94:          * The cached value of the '{@link #getColors() <em>Colors</em>}' attribute list.
95:          * <!-- begin-user-doc -->
96:          * <!-- end-user-doc -->
97:          *
98:          * @see #getColors()
99:          * @generated
100:          * @ordered
101:          */
102:         protected EList<Color> colors;
103:
104:         /**
105:          * <!-- begin-user-doc -->
106:          * <!-- end-user-doc -->
107:          *
108:          * @generated
109:          */
110:         protected ComputerImpl() {
111:                 super();
112:         }
113:
114:         /**
115:          * <!-- begin-user-doc -->
116:          * <!-- end-user-doc -->
117:          *
118:          * @generated
119:          */
120:         @Override
121:         protected EClass eStaticClass() {
122:                 return TestPackage.Literals.COMPUTER;
123:         }
124:
125:         /**
126:          * <!-- begin-user-doc -->
127:          * <!-- end-user-doc -->
128:          *
129:          * @generated
130:          */
131:         @Override
132:         public Mainboard getMainboard() {
133:                 return mainboard;
134:         }
135:
136:         /**
137:          * <!-- begin-user-doc -->
138:          * <!-- end-user-doc -->
139:          *
140:          * @generated
141:          */
142:         public NotificationChain basicSetMainboard(Mainboard newMainboard, NotificationChain msgs) {
143:                 final Mainboard oldMainboard = mainboard;
144:                 mainboard = newMainboard;
145:•                if (eNotificationRequired()) {
146:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
147:                                 TestPackage.COMPUTER__MAINBOARD, oldMainboard, newMainboard);
148:•                        if (msgs == null) {
149:                                 msgs = notification;
150:                         } else {
151:                                 msgs.add(notification);
152:                         }
153:                 }
154:                 return msgs;
155:         }
156:
157:         /**
158:          * <!-- begin-user-doc -->
159:          * <!-- end-user-doc -->
160:          *
161:          * @generated
162:          */
163:         @Override
164:         public void setMainboard(Mainboard newMainboard) {
165:•                if (newMainboard != mainboard) {
166:                         NotificationChain msgs = null;
167:•                        if (mainboard != null) {
168:                                 msgs = ((InternalEObject) mainboard).eInverseRemove(this,
169:                                         EOPPOSITE_FEATURE_BASE - TestPackage.COMPUTER__MAINBOARD, null, msgs);
170:                         }
171:•                        if (newMainboard != null) {
172:                                 msgs = ((InternalEObject) newMainboard).eInverseAdd(this,
173:                                         EOPPOSITE_FEATURE_BASE - TestPackage.COMPUTER__MAINBOARD, null, msgs);
174:                         }
175:                         msgs = basicSetMainboard(newMainboard, msgs);
176:•                        if (msgs != null) {
177:                                 msgs.dispatch();
178:                         }
179:•                } else if (eNotificationRequired()) {
180:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.COMPUTER__MAINBOARD, newMainboard,
181:                                 newMainboard));
182:                 }
183:         }
184:
185:         /**
186:          * <!-- begin-user-doc -->
187:          * <!-- end-user-doc -->
188:          *
189:          * @generated
190:          */
191:         @Override
192:         public String getName() {
193:                 return name;
194:         }
195:
196:         /**
197:          * <!-- begin-user-doc -->
198:          * <!-- end-user-doc -->
199:          *
200:          * @generated
201:          */
202:         @Override
203:         public void setName(String newName) {
204:                 final String oldName = name;
205:                 name = newName;
206:•                if (eNotificationRequired()) {
207:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.COMPUTER__NAME, oldName, name));
208:                 }
209:         }
210:
211:         /**
212:          * <!-- begin-user-doc -->
213:          * <!-- end-user-doc -->
214:          *
215:          * @generated
216:          */
217:         @Override
218:         public PowerBlock getPowerBlock() {
219:                 return powerBlock;
220:         }
221:
222:         /**
223:          * <!-- begin-user-doc -->
224:          * <!-- end-user-doc -->
225:          *
226:          * @generated
227:          */
228:         public NotificationChain basicSetPowerBlock(PowerBlock newPowerBlock, NotificationChain msgs) {
229:                 final PowerBlock oldPowerBlock = powerBlock;
230:                 powerBlock = newPowerBlock;
231:•                if (eNotificationRequired()) {
232:                         final ENotificationImpl notification = new ENotificationImpl(this, Notification.SET,
233:                                 TestPackage.COMPUTER__POWER_BLOCK, oldPowerBlock, newPowerBlock);
234:•                        if (msgs == null) {
235:                                 msgs = notification;
236:                         } else {
237:                                 msgs.add(notification);
238:                         }
239:                 }
240:                 return msgs;
241:         }
242:
243:         /**
244:          * <!-- begin-user-doc -->
245:          * <!-- end-user-doc -->
246:          *
247:          * @generated
248:          */
249:         @Override
250:         public void setPowerBlock(PowerBlock newPowerBlock) {
251:•                if (newPowerBlock != powerBlock) {
252:                         NotificationChain msgs = null;
253:•                        if (powerBlock != null) {
254:                                 msgs = ((InternalEObject) powerBlock).eInverseRemove(this,
255:                                         EOPPOSITE_FEATURE_BASE - TestPackage.COMPUTER__POWER_BLOCK, null, msgs);
256:                         }
257:•                        if (newPowerBlock != null) {
258:                                 msgs = ((InternalEObject) newPowerBlock).eInverseAdd(this,
259:                                         EOPPOSITE_FEATURE_BASE - TestPackage.COMPUTER__POWER_BLOCK, null, msgs);
260:                         }
261:                         msgs = basicSetPowerBlock(newPowerBlock, msgs);
262:•                        if (msgs != null) {
263:                                 msgs.dispatch();
264:                         }
265:•                } else if (eNotificationRequired()) {
266:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.COMPUTER__POWER_BLOCK, newPowerBlock,
267:                                 newPowerBlock));
268:                 }
269:         }
270:
271:         /**
272:          * <!-- begin-user-doc -->
273:          * <!-- end-user-doc -->
274:          *
275:          * @generated
276:          */
277:         @Override
278:         public EList<Color> getColors() {
279:•                if (colors == null) {
280:                         colors = new EDataTypeUniqueEList<Color>(Color.class, this, TestPackage.COMPUTER__COLORS);
281:                 }
282:                 return colors;
283:         }
284:
285:         /**
286:          * <!-- begin-user-doc -->
287:          * <!-- end-user-doc -->
288:          *
289:          * @generated
290:          */
291:         @Override
292:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
293:•                switch (featureID) {
294:                 case TestPackage.COMPUTER__MAINBOARD:
295:                         return basicSetMainboard(null, msgs);
296:                 case TestPackage.COMPUTER__POWER_BLOCK:
297:                         return basicSetPowerBlock(null, msgs);
298:                 }
299:                 return super.eInverseRemove(otherEnd, featureID, msgs);
300:         }
301:
302:         /**
303:          * <!-- begin-user-doc -->
304:          * <!-- end-user-doc -->
305:          *
306:          * @generated
307:          */
308:         @Override
309:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
310:•                switch (featureID) {
311:                 case TestPackage.COMPUTER__MAINBOARD:
312:                         return getMainboard();
313:                 case TestPackage.COMPUTER__NAME:
314:                         return getName();
315:                 case TestPackage.COMPUTER__POWER_BLOCK:
316:                         return getPowerBlock();
317:                 case TestPackage.COMPUTER__COLORS:
318:                         return getColors();
319:                 }
320:                 return super.eGet(featureID, resolve, coreType);
321:         }
322:
323:         /**
324:          * <!-- begin-user-doc -->
325:          * <!-- end-user-doc -->
326:          *
327:          * @generated
328:          */
329:         @SuppressWarnings("unchecked")
330:         @Override
331:         public void eSet(int featureID, Object newValue) {
332:•                switch (featureID) {
333:                 case TestPackage.COMPUTER__MAINBOARD:
334:                         setMainboard((Mainboard) newValue);
335:                         return;
336:                 case TestPackage.COMPUTER__NAME:
337:                         setName((String) newValue);
338:                         return;
339:                 case TestPackage.COMPUTER__POWER_BLOCK:
340:                         setPowerBlock((PowerBlock) newValue);
341:                         return;
342:                 case TestPackage.COMPUTER__COLORS:
343:                         getColors().clear();
344:                         getColors().addAll((Collection<? extends Color>) newValue);
345:                         return;
346:                 }
347:                 super.eSet(featureID, newValue);
348:         }
349:
350:         /**
351:          * <!-- begin-user-doc -->
352:          * <!-- end-user-doc -->
353:          *
354:          * @generated
355:          */
356:         @Override
357:         public void eUnset(int featureID) {
358:•                switch (featureID) {
359:                 case TestPackage.COMPUTER__MAINBOARD:
360:                         setMainboard((Mainboard) null);
361:                         return;
362:                 case TestPackage.COMPUTER__NAME:
363:                         setName(NAME_EDEFAULT);
364:                         return;
365:                 case TestPackage.COMPUTER__POWER_BLOCK:
366:                         setPowerBlock((PowerBlock) null);
367:                         return;
368:                 case TestPackage.COMPUTER__COLORS:
369:                         getColors().clear();
370:                         return;
371:                 }
372:                 super.eUnset(featureID);
373:         }
374:
375:         /**
376:          * <!-- begin-user-doc -->
377:          * <!-- end-user-doc -->
378:          *
379:          * @generated
380:          */
381:         @Override
382:         public boolean eIsSet(int featureID) {
383:•                switch (featureID) {
384:                 case TestPackage.COMPUTER__MAINBOARD:
385:•                        return mainboard != null;
386:                 case TestPackage.COMPUTER__NAME:
387:•                        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
388:                 case TestPackage.COMPUTER__POWER_BLOCK:
389:•                        return powerBlock != null;
390:                 case TestPackage.COMPUTER__COLORS:
391:•                        return colors != null && !colors.isEmpty();
392:                 }
393:                 return super.eIsSet(featureID);
394:         }
395:
396:         /**
397:          * <!-- begin-user-doc -->
398:          * <!-- end-user-doc -->
399:          *
400:          * @generated
401:          */
402:         @Override
403:         public String toString() {
404:•                if (eIsProxy()) {
405:                         return super.toString();
406:                 }
407:
408:                 final StringBuffer result = new StringBuffer(super.toString());
409:                 result.append(" (name: ");
410:                 result.append(name);
411:                 result.append(", colors: ");
412:                 result.append(colors);
413:                 result.append(')');
414:                 return result.toString();
415:         }
416:
417: } // ComputerImpl