Skip to content

Package: BookImpl

BookImpl

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