Skip to content

Package: LibraryImpl

LibraryImpl

nameinstructionbranchcomplexitylinemethod
LibraryImpl()
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%
eGet(int, boolean, boolean)
M: 9 C: 8
47%
M: 2 C: 2
50%
M: 2 C: 2
50%
M: 2 C: 3
60%
M: 0 C: 1
100%
eInverseAdd(InternalEObject, int, 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%
eInverseRemove(InternalEObject, int, NotificationChain)
M: 22 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: 36 C: 10
22%
M: 15 C: 3
17%
M: 10 C: 1
9%
M: 3 C: 2
40%
M: 0 C: 1
100%
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: 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: 18 C: 0
0%
M: 4 C: 0
0%
M: 4 C: 0
0%
M: 9 C: 0
0%
M: 1 C: 0
0%
getBooks()
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%
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%
getWriters()
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%
setName(String)
M: 11 C: 10
48%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 4
80%
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-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: * Johannes Faltermeier
14: *
15: *******************************************************************************/
16: package org.eclipse.emf.ecp.validation.test.test.impl;
17:
18: import java.util.Collection;
19:
20: import org.eclipse.emf.common.notify.Notification;
21: import org.eclipse.emf.common.notify.NotificationChain;
22: import org.eclipse.emf.common.util.EList;
23: import org.eclipse.emf.ecore.EClass;
24: import org.eclipse.emf.ecore.InternalEObject;
25: import org.eclipse.emf.ecore.impl.ENotificationImpl;
26: import org.eclipse.emf.ecore.impl.EObjectImpl;
27: import org.eclipse.emf.ecore.util.EObjectContainmentEList;
28: import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
29: import org.eclipse.emf.ecore.util.InternalEList;
30: import org.eclipse.emf.ecp.validation.test.test.Book;
31: import org.eclipse.emf.ecp.validation.test.test.Library;
32: import org.eclipse.emf.ecp.validation.test.test.TestPackage;
33: import org.eclipse.emf.ecp.validation.test.test.Writer;
34:
35: /**
36: * <!-- begin-user-doc -->
37: * An implementation of the model object '<em><b>Library</b></em>'.
38: * <!-- end-user-doc -->
39: * <p>
40: * The following features are implemented:
41: * <ul>
42: * <li>{@link org.eclipse.emf.ecp.validation.test.test.impl.LibraryImpl#getName <em>Name</em>}</li>
43: * <li>{@link org.eclipse.emf.ecp.validation.test.test.impl.LibraryImpl#getWriters <em>Writers</em>}</li>
44: * <li>{@link org.eclipse.emf.ecp.validation.test.test.impl.LibraryImpl#getBooks <em>Books</em>}</li>
45: * </ul>
46: * </p>
47: *
48: * @generated
49: */
50: public class LibraryImpl extends EObjectImpl implements Library {
51:         /**
52:          * The default value of the '{@link #getName() <em>Name</em>}' attribute.
53:          * <!-- begin-user-doc -->
54:          * <!-- end-user-doc -->
55:          *
56:          * @see #getName()
57:          * @generated
58:          * @ordered
59:          */
60:         protected static final String NAME_EDEFAULT = null;
61:
62:         /**
63:          * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
64:          * <!-- begin-user-doc -->
65:          * <!-- end-user-doc -->
66:          *
67:          * @see #getName()
68:          * @generated
69:          * @ordered
70:          */
71:         protected String name = NAME_EDEFAULT;
72:
73:         /**
74:          * The cached value of the '{@link #getWriters() <em>Writers</em>}' containment reference list.
75:          * <!-- begin-user-doc -->
76:          * <!-- end-user-doc -->
77:          *
78:          * @see #getWriters()
79:          * @generated
80:          * @ordered
81:          */
82:         protected EList<Writer> writers;
83:
84:         /**
85:          * The cached value of the '{@link #getBooks() <em>Books</em>}' containment reference list.
86:          * <!-- begin-user-doc -->
87:          * <!-- end-user-doc -->
88:          *
89:          * @see #getBooks()
90:          * @generated
91:          * @ordered
92:          */
93:         protected EList<Book> books;
94:
95:         /**
96:          * <!-- begin-user-doc -->
97:          * <!-- end-user-doc -->
98:          *
99:          * @generated
100:          */
101:         protected LibraryImpl() {
102:                 super();
103:         }
104:
105:         /**
106:          * <!-- begin-user-doc -->
107:          * <!-- end-user-doc -->
108:          *
109:          * @generated
110:          */
111:         @Override
112:         protected EClass eStaticClass() {
113:                 return TestPackage.Literals.LIBRARY;
114:         }
115:
116:         /**
117:          * <!-- begin-user-doc -->
118:          * <!-- end-user-doc -->
119:          *
120:          * @generated
121:          */
122:         @Override
123:         public String getName() {
124:                 return name;
125:         }
126:
127:         /**
128:          * <!-- begin-user-doc -->
129:          * <!-- end-user-doc -->
130:          *
131:          * @generated
132:          */
133:         @Override
134:         public void setName(String newName) {
135:                 final String oldName = name;
136:                 name = newName;
137:•                if (eNotificationRequired()) {
138:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.LIBRARY__NAME, oldName, name));
139:                 }
140:         }
141:
142:         /**
143:          * <!-- begin-user-doc -->
144:          * <!-- end-user-doc -->
145:          *
146:          * @generated
147:          */
148:         @Override
149:         public EList<Writer> getWriters() {
150:•                if (writers == null) {
151:                         writers = new EObjectContainmentWithInverseEList<Writer>(Writer.class, this, TestPackage.LIBRARY__WRITERS,
152:                                 TestPackage.WRITER__LIBRARY);
153:                 }
154:                 return writers;
155:         }
156:
157:         /**
158:          * <!-- begin-user-doc -->
159:          * <!-- end-user-doc -->
160:          *
161:          * @generated
162:          */
163:         @Override
164:         public EList<Book> getBooks() {
165:•                if (books == null) {
166:                         books = new EObjectContainmentEList<Book>(Book.class, this, TestPackage.LIBRARY__BOOKS);
167:                 }
168:                 return books;
169:         }
170:
171:         /**
172:          * <!-- begin-user-doc -->
173:          * <!-- end-user-doc -->
174:          *
175:          * @generated
176:          */
177:         @SuppressWarnings("unchecked")
178:         @Override
179:         public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
180:•                switch (featureID) {
181:                 case TestPackage.LIBRARY__WRITERS:
182:                         return ((InternalEList<InternalEObject>) (InternalEList<?>) getWriters()).basicAdd(otherEnd, msgs);
183:                 }
184:                 return super.eInverseAdd(otherEnd, featureID, msgs);
185:         }
186:
187:         /**
188:          * <!-- begin-user-doc -->
189:          * <!-- end-user-doc -->
190:          *
191:          * @generated
192:          */
193:         @Override
194:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
195:•                switch (featureID) {
196:                 case TestPackage.LIBRARY__WRITERS:
197:                         return ((InternalEList<?>) getWriters()).basicRemove(otherEnd, msgs);
198:                 case TestPackage.LIBRARY__BOOKS:
199:                         return ((InternalEList<?>) getBooks()).basicRemove(otherEnd, msgs);
200:                 }
201:                 return super.eInverseRemove(otherEnd, featureID, msgs);
202:         }
203:
204:         /**
205:          * <!-- begin-user-doc -->
206:          * <!-- end-user-doc -->
207:          *
208:          * @generated
209:          */
210:         @Override
211:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
212:•                switch (featureID) {
213:                 case TestPackage.LIBRARY__NAME:
214:                         return getName();
215:                 case TestPackage.LIBRARY__WRITERS:
216:                         return getWriters();
217:                 case TestPackage.LIBRARY__BOOKS:
218:                         return getBooks();
219:                 }
220:                 return super.eGet(featureID, resolve, coreType);
221:         }
222:
223:         /**
224:          * <!-- begin-user-doc -->
225:          * <!-- end-user-doc -->
226:          *
227:          * @generated
228:          */
229:         @SuppressWarnings("unchecked")
230:         @Override
231:         public void eSet(int featureID, Object newValue) {
232:•                switch (featureID) {
233:                 case TestPackage.LIBRARY__NAME:
234:                         setName((String) newValue);
235:                         return;
236:                 case TestPackage.LIBRARY__WRITERS:
237:                         getWriters().clear();
238:                         getWriters().addAll((Collection<? extends Writer>) newValue);
239:                         return;
240:                 case TestPackage.LIBRARY__BOOKS:
241:                         getBooks().clear();
242:                         getBooks().addAll((Collection<? extends Book>) newValue);
243:                         return;
244:                 }
245:                 super.eSet(featureID, newValue);
246:         }
247:
248:         /**
249:          * <!-- begin-user-doc -->
250:          * <!-- end-user-doc -->
251:          *
252:          * @generated
253:          */
254:         @Override
255:         public void eUnset(int featureID) {
256:•                switch (featureID) {
257:                 case TestPackage.LIBRARY__NAME:
258:                         setName(NAME_EDEFAULT);
259:                         return;
260:                 case TestPackage.LIBRARY__WRITERS:
261:                         getWriters().clear();
262:                         return;
263:                 case TestPackage.LIBRARY__BOOKS:
264:                         getBooks().clear();
265:                         return;
266:                 }
267:                 super.eUnset(featureID);
268:         }
269:
270:         /**
271:          * <!-- begin-user-doc -->
272:          * <!-- end-user-doc -->
273:          *
274:          * @generated
275:          */
276:         @Override
277:         public boolean eIsSet(int featureID) {
278:•                switch (featureID) {
279:                 case TestPackage.LIBRARY__NAME:
280:•                        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
281:                 case TestPackage.LIBRARY__WRITERS:
282:•                        return writers != null && !writers.isEmpty();
283:                 case TestPackage.LIBRARY__BOOKS:
284:•                        return books != null && !books.isEmpty();
285:                 }
286:                 return super.eIsSet(featureID);
287:         }
288:
289:         /**
290:          * <!-- begin-user-doc -->
291:          * <!-- end-user-doc -->
292:          *
293:          * @generated
294:          */
295:         @Override
296:         public String toString() {
297:•                if (eIsProxy()) {
298:                         return super.toString();
299:                 }
300:
301:                 final StringBuffer result = new StringBuffer(super.toString());
302:                 result.append(" (name: ");
303:                 result.append(name);
304:                 result.append(')');
305:                 return result.toString();
306:         }
307:
308: } // LibraryImpl