Skip to content

Package: WriterImpl

WriterImpl

nameinstructionbranchcomplexitylinemethod
WriterImpl()
M: 0 C: 24
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 9
100%
M: 0 C: 1
100%
basicSetLibrary(Library, NotificationChain)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
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: 25 C: 11
31%
M: 7 C: 3
30%
M: 7 C: 3
30%
M: 7 C: 4
36%
M: 0 C: 1
100%
eInverseAdd(InternalEObject, int, NotificationChain)
M: 10 C: 18
64%
M: 2 C: 3
60%
M: 2 C: 2
50%
M: 2 C: 4
67%
M: 0 C: 1
100%
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: 67 C: 68
50%
M: 26 C: 26
50%
M: 19 C: 12
39%
M: 2 C: 9
82%
M: 0 C: 1
100%
eSet(int, Object)
M: 58 C: 0
0%
M: 10 C: 0
0%
M: 10 C: 0
0%
M: 22 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: 42 C: 0
0%
M: 10 C: 0
0%
M: 10 C: 0
0%
M: 21 C: 0
0%
M: 1 C: 0
0%
getBirthDate()
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%
getBooks()
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%
getEMail()
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%
getFirstName()
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%
getInitials()
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%
getLastName()
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%
getLibrary()
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%
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%
isPseudonym()
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%
setBirthDate(Date)
M: 21 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
setEMail(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%
setFirstName(String)
M: 0 C: 21
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
setInitials(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%
setLastName(String)
M: 0 C: 21
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
setLibrary(Library)
M: 69 C: 0
0%
M: 16 C: 0
0%
M: 9 C: 0
0%
M: 16 C: 0
0%
M: 1 C: 0
0%
setPseudonym(boolean)
M: 21 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 6 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%
static {...}
M: 0 C: 13
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 6
100%
M: 0 C: 1
100%
toString()
M: 82 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 19 C: 0
0%
M: 1 C: 0
0%
validate(DiagnosticChain, Map)
M: 49 C: 115
70%
M: 10 C: 18
64%
M: 8 C: 7
47%
M: 15 C: 30
67%
M: 0 C: 1
100%

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: import java.util.Date;
18: import java.util.Map;
19:
20: import org.eclipse.emf.common.notify.Notification;
21: import org.eclipse.emf.common.notify.NotificationChain;
22: import org.eclipse.emf.common.util.BasicDiagnostic;
23: import org.eclipse.emf.common.util.Diagnostic;
24: import org.eclipse.emf.common.util.DiagnosticChain;
25: import org.eclipse.emf.common.util.EList;
26: import org.eclipse.emf.ecore.EClass;
27: import org.eclipse.emf.ecore.InternalEObject;
28: import org.eclipse.emf.ecore.impl.ENotificationImpl;
29: import org.eclipse.emf.ecore.impl.EObjectImpl;
30: import org.eclipse.emf.ecore.util.EObjectWithInverseResolvingEList;
31: import org.eclipse.emf.ecore.util.EcoreUtil;
32: import org.eclipse.emf.ecore.util.InternalEList;
33: import org.eclipse.emf.ecp.view.validation.test.model.Book;
34: import org.eclipse.emf.ecp.view.validation.test.model.Library;
35: import org.eclipse.emf.ecp.view.validation.test.model.TestPackage;
36: import org.eclipse.emf.ecp.view.validation.test.model.Writer;
37: import org.eclipse.emf.ecp.view.validation.test.model.util.TestValidator;
38:
39: /**
40: * <!-- begin-user-doc -->
41: * An implementation of the model object '<em><b>Writer</b></em>'.
42: * <!-- end-user-doc -->
43: * <p>
44: * The following features are implemented:
45: * </p>
46: * <ul>
47: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getFirstName <em>First Name</em>}</li>
48: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getLastName <em>Last Name</em>}</li>
49: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getEMail <em>EMail</em>}</li>
50: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getBirthDate <em>Birth Date</em>}</li>
51: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getBooks <em>Books</em>}</li>
52: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#isPseudonym <em>Pseudonym</em>}</li>
53: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getLibrary <em>Library</em>}</li>
54: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getInitials <em>Initials</em>}</li>
55: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.WriterImpl#getTitle <em>Title</em>}</li>
56: * </ul>
57: *
58: * @generated
59: */
60: public class WriterImpl extends EObjectImpl implements Writer {
61:         /**
62:          * The default value of the '{@link #getFirstName() <em>First Name</em>}' attribute.
63:          * <!-- begin-user-doc -->
64:          * <!-- end-user-doc -->
65:          *
66:          * @see #getFirstName()
67:          * @generated
68:          * @ordered
69:          */
70:         protected static final String FIRST_NAME_EDEFAULT = null;
71:
72:         /**
73:          * The cached value of the '{@link #getFirstName() <em>First Name</em>}' attribute.
74:          * <!-- begin-user-doc -->
75:          * <!-- end-user-doc -->
76:          *
77:          * @see #getFirstName()
78:          * @generated
79:          * @ordered
80:          */
81:         protected String firstName = FIRST_NAME_EDEFAULT;
82:
83:         /**
84:          * The default value of the '{@link #getLastName() <em>Last Name</em>}' attribute.
85:          * <!-- begin-user-doc -->
86:          * <!-- end-user-doc -->
87:          *
88:          * @see #getLastName()
89:          * @generated
90:          * @ordered
91:          */
92:         protected static final String LAST_NAME_EDEFAULT = null;
93:
94:         /**
95:          * The cached value of the '{@link #getLastName() <em>Last Name</em>}' attribute.
96:          * <!-- begin-user-doc -->
97:          * <!-- end-user-doc -->
98:          *
99:          * @see #getLastName()
100:          * @generated
101:          * @ordered
102:          */
103:         protected String lastName = LAST_NAME_EDEFAULT;
104:
105:         /**
106:          * The default value of the '{@link #getEMail() <em>EMail</em>}' attribute.
107:          * <!-- begin-user-doc -->
108:          * <!-- end-user-doc -->
109:          *
110:          * @see #getEMail()
111:          * @generated
112:          * @ordered
113:          */
114:         protected static final String EMAIL_EDEFAULT = null;
115:
116:         /**
117:          * The cached value of the '{@link #getEMail() <em>EMail</em>}' attribute.
118:          * <!-- begin-user-doc -->
119:          * <!-- end-user-doc -->
120:          *
121:          * @see #getEMail()
122:          * @generated
123:          * @ordered
124:          */
125:         protected String eMail = EMAIL_EDEFAULT;
126:
127:         /**
128:          * The default value of the '{@link #getBirthDate() <em>Birth Date</em>}' attribute.
129:          * <!-- begin-user-doc -->
130:          * <!-- end-user-doc -->
131:          *
132:          * @see #getBirthDate()
133:          * @generated
134:          * @ordered
135:          */
136:         protected static final Date BIRTH_DATE_EDEFAULT = null;
137:
138:         /**
139:          * The cached value of the '{@link #getBirthDate() <em>Birth Date</em>}' attribute.
140:          * <!-- begin-user-doc -->
141:          * <!-- end-user-doc -->
142:          *
143:          * @see #getBirthDate()
144:          * @generated
145:          * @ordered
146:          */
147:         protected Date birthDate = BIRTH_DATE_EDEFAULT;
148:
149:         /**
150:          * The cached value of the '{@link #getBooks() <em>Books</em>}' reference list.
151:          * <!-- begin-user-doc -->
152:          * <!-- end-user-doc -->
153:          *
154:          * @see #getBooks()
155:          * @generated
156:          * @ordered
157:          */
158:         protected EList<Book> books;
159:
160:         /**
161:          * The default value of the '{@link #isPseudonym() <em>Pseudonym</em>}' attribute.
162:          * <!-- begin-user-doc -->
163:          * <!-- end-user-doc -->
164:          *
165:          * @see #isPseudonym()
166:          * @generated
167:          * @ordered
168:          */
169:         protected static final boolean PSEUDONYM_EDEFAULT = false;
170:
171:         /**
172:          * The cached value of the '{@link #isPseudonym() <em>Pseudonym</em>}' attribute.
173:          * <!-- begin-user-doc -->
174:          * <!-- end-user-doc -->
175:          *
176:          * @see #isPseudonym()
177:          * @generated
178:          * @ordered
179:          */
180:         protected boolean pseudonym = PSEUDONYM_EDEFAULT;
181:
182:         /**
183:          * The default value of the '{@link #getInitials() <em>Initials</em>}' attribute.
184:          * <!-- begin-user-doc -->
185:          * <!-- end-user-doc -->
186:          *
187:          * @see #getInitials()
188:          * @generated
189:          * @ordered
190:          */
191:         protected static final String INITIALS_EDEFAULT = null;
192:
193:         /**
194:          * The cached value of the '{@link #getInitials() <em>Initials</em>}' attribute.
195:          * <!-- begin-user-doc -->
196:          * <!-- end-user-doc -->
197:          *
198:          * @see #getInitials()
199:          * @generated
200:          * @ordered
201:          */
202:         protected String initials = INITIALS_EDEFAULT;
203:
204:         /**
205:          * The default value of the '{@link #getTitle() <em>Title</em>}' attribute.
206:          * <!-- begin-user-doc -->
207:          * <!-- end-user-doc -->
208:          *
209:          * @see #getTitle()
210:          * @generated
211:          * @ordered
212:          */
213:         protected static final String TITLE_EDEFAULT = null;
214:
215:         /**
216:          * The cached value of the '{@link #getTitle() <em>Title</em>}' attribute.
217:          * <!-- begin-user-doc -->
218:          * <!-- end-user-doc -->
219:          *
220:          * @see #getTitle()
221:          * @generated
222:          * @ordered
223:          */
224:         protected String title = TITLE_EDEFAULT;
225:
226:         /**
227:          * <!-- begin-user-doc -->
228:          * <!-- end-user-doc -->
229:          *
230:          * @generated
231:          */
232:         protected WriterImpl() {
233:                 super();
234:         }
235:
236:         /**
237:          * <!-- begin-user-doc -->
238:          * <!-- end-user-doc -->
239:          *
240:          * @generated
241:          */
242:         @Override
243:         protected EClass eStaticClass() {
244:                 return TestPackage.Literals.WRITER;
245:         }
246:
247:         /**
248:          * <!-- begin-user-doc -->
249:          * <!-- end-user-doc -->
250:          *
251:          * @generated
252:          */
253:         @Override
254:         public String getFirstName() {
255:                 return firstName;
256:         }
257:
258:         /**
259:          * <!-- begin-user-doc -->
260:          * <!-- end-user-doc -->
261:          *
262:          * @generated
263:          */
264:         @Override
265:         public void setFirstName(String newFirstName) {
266:                 final String oldFirstName = firstName;
267:                 firstName = newFirstName;
268:•                if (eNotificationRequired()) {
269:                         eNotify(
270:                                 new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__FIRST_NAME, oldFirstName, firstName));
271:                 }
272:         }
273:
274:         /**
275:          * <!-- begin-user-doc -->
276:          * <!-- end-user-doc -->
277:          *
278:          * @generated
279:          */
280:         @Override
281:         public String getLastName() {
282:                 return lastName;
283:         }
284:
285:         /**
286:          * <!-- begin-user-doc -->
287:          * <!-- end-user-doc -->
288:          *
289:          * @generated
290:          */
291:         @Override
292:         public void setLastName(String newLastName) {
293:                 final String oldLastName = lastName;
294:                 lastName = newLastName;
295:•                if (eNotificationRequired()) {
296:                         eNotify(
297:                                 new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__LAST_NAME, oldLastName, lastName));
298:                 }
299:         }
300:
301:         /**
302:          * <!-- begin-user-doc -->
303:          * <!-- end-user-doc -->
304:          *
305:          * @generated
306:          */
307:         @Override
308:         public String getEMail() {
309:                 return eMail;
310:         }
311:
312:         /**
313:          * <!-- begin-user-doc -->
314:          * <!-- end-user-doc -->
315:          *
316:          * @generated
317:          */
318:         @Override
319:         public void setEMail(String newEMail) {
320:                 final String oldEMail = eMail;
321:                 eMail = newEMail;
322:•                if (eNotificationRequired()) {
323:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__EMAIL, oldEMail, eMail));
324:                 }
325:         }
326:
327:         /**
328:          * <!-- begin-user-doc -->
329:          * <!-- end-user-doc -->
330:          *
331:          * @generated
332:          */
333:         @Override
334:         public Date getBirthDate() {
335:                 return birthDate;
336:         }
337:
338:         /**
339:          * <!-- begin-user-doc -->
340:          * <!-- end-user-doc -->
341:          *
342:          * @generated
343:          */
344:         @Override
345:         public void setBirthDate(Date newBirthDate) {
346:                 final Date oldBirthDate = birthDate;
347:                 birthDate = newBirthDate;
348:•                if (eNotificationRequired()) {
349:                         eNotify(
350:                                 new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__BIRTH_DATE, oldBirthDate, birthDate));
351:                 }
352:         }
353:
354:         /**
355:          * <!-- begin-user-doc -->
356:          * <!-- end-user-doc -->
357:          *
358:          * @generated
359:          */
360:         @Override
361:         public EList<Book> getBooks() {
362:•                if (books == null) {
363:                         books = new EObjectWithInverseResolvingEList<Book>(Book.class, this, TestPackage.WRITER__BOOKS,
364:                                 TestPackage.BOOK__WRITERS);
365:                 }
366:                 return books;
367:         }
368:
369:         /**
370:          * <!-- begin-user-doc -->
371:          * <!-- end-user-doc -->
372:          *
373:          * @generated
374:          */
375:         @Override
376:         public boolean isPseudonym() {
377:                 return pseudonym;
378:         }
379:
380:         /**
381:          * <!-- begin-user-doc -->
382:          * <!-- end-user-doc -->
383:          *
384:          * @generated
385:          */
386:         @Override
387:         public void setPseudonym(boolean newPseudonym) {
388:                 final boolean oldPseudonym = pseudonym;
389:                 pseudonym = newPseudonym;
390:•                if (eNotificationRequired()) {
391:                         eNotify(
392:                                 new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__PSEUDONYM, oldPseudonym, pseudonym));
393:                 }
394:         }
395:
396:         /**
397:          * <!-- begin-user-doc -->
398:          * <!-- end-user-doc -->
399:          *
400:          * @generated
401:          */
402:         @Override
403:         public Library getLibrary() {
404:•                if (eContainerFeatureID() != TestPackage.WRITER__LIBRARY) {
405:                         return null;
406:                 }
407:                 return (Library) eInternalContainer();
408:         }
409:
410:         /**
411:          * <!-- begin-user-doc -->
412:          * <!-- end-user-doc -->
413:          *
414:          * @generated
415:          */
416:         public NotificationChain basicSetLibrary(Library newLibrary, NotificationChain msgs) {
417:                 msgs = eBasicSetContainer((InternalEObject) newLibrary, TestPackage.WRITER__LIBRARY, msgs);
418:                 return msgs;
419:         }
420:
421:         /**
422:          * <!-- begin-user-doc -->
423:          * <!-- end-user-doc -->
424:          *
425:          * @generated
426:          */
427:         @Override
428:         public void setLibrary(Library newLibrary) {
429:•                if (newLibrary != eInternalContainer()
430:•                        || eContainerFeatureID() != TestPackage.WRITER__LIBRARY && newLibrary != null) {
431:•                        if (EcoreUtil.isAncestor(this, newLibrary)) {
432:                                 throw new IllegalArgumentException("Recursive containment not allowed for " + toString());
433:                         }
434:                         NotificationChain msgs = null;
435:•                        if (eInternalContainer() != null) {
436:                                 msgs = eBasicRemoveFromContainer(msgs);
437:                         }
438:•                        if (newLibrary != null) {
439:                                 msgs = ((InternalEObject) newLibrary).eInverseAdd(this, TestPackage.LIBRARY__WRITERS, Library.class,
440:                                         msgs);
441:                         }
442:                         msgs = basicSetLibrary(newLibrary, msgs);
443:•                        if (msgs != null) {
444:                                 msgs.dispatch();
445:                         }
446:•                } else if (eNotificationRequired()) {
447:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__LIBRARY, newLibrary, newLibrary));
448:                 }
449:         }
450:
451:         /**
452:          * <!-- begin-user-doc -->
453:          * <!-- end-user-doc -->
454:          *
455:          * @generated
456:          */
457:         @Override
458:         public String getInitials() {
459:                 return initials;
460:         }
461:
462:         /**
463:          * <!-- begin-user-doc -->
464:          * <!-- end-user-doc -->
465:          *
466:          * @generated
467:          */
468:         @Override
469:         public void setInitials(String newInitials) {
470:                 final String oldInitials = initials;
471:                 initials = newInitials;
472:•                if (eNotificationRequired()) {
473:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__INITIALS, oldInitials, initials));
474:                 }
475:         }
476:
477:         /**
478:          * <!-- begin-user-doc -->
479:          * <!-- end-user-doc -->
480:          *
481:          * @generated
482:          */
483:         @Override
484:         public String getTitle() {
485:                 return title;
486:         }
487:
488:         /**
489:          * <!-- begin-user-doc -->
490:          * <!-- end-user-doc -->
491:          *
492:          * @generated
493:          */
494:         @Override
495:         public void setTitle(String newTitle) {
496:                 final String oldTitle = title;
497:                 title = newTitle;
498:•                if (eNotificationRequired()) {
499:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.WRITER__TITLE, oldTitle, title));
500:                 }
501:         }
502:
503:         /**
504:          * Validates the writer. Only adds one diagnostic item to the chain.
505:          *
506:          * @generated NOT
507:          */
508:         // BEGIN COMPLEX CODE
509:         @Override
510:         public boolean validate(DiagnosticChain chain, Map<Object, Object> context) {
511:                 boolean valid = true;
512:                 // cancel if name is offensive
513:•                if (getFirstName() != null && getFirstName().equals("Offensive")
514:                 // || getLastName() != null && getLastName().equals("Offensive")
515:                 ) {
516:•                        if (chain != null) {
517:                                 chain.add(new BasicDiagnostic(Diagnostic.CANCEL,
518:                                         TestValidator.DIAGNOSTIC_SOURCE,
519:                                         TestValidator.WRITER__VALIDATE,
520:                                         "Name is too offensive to even validate.",
521:                                         new Object[] { this, TestPackage.eINSTANCE.getWriter_FirstName()
522:                                         // ,TestPackage.eINSTANCE.getWriter_LastName()
523:                                         }));
524:                         }
525:                         valid = false;
526:                 }
527:
528:                 // error when no first or last name
529:•                else if (getFirstName() == null || getFirstName().equals("")
530:                 // || getLastName() == null || getLastName().equals("")
531:                 ) {
532:•                        if (chain != null) {
533:                                 chain.add(new BasicDiagnostic(Diagnostic.ERROR,
534:                                         TestValidator.DIAGNOSTIC_SOURCE,
535:                                         TestValidator.WRITER__VALIDATE,
536:                                         "Writers need to have a first name",
537:                                         new Object[] { this, TestPackage.eINSTANCE.getWriter_FirstName()
538:                                         // , TestPackage.eINSTANCE.getWriter_LastName()
539:                                         }));
540:                         }
541:                         valid = false;
542:                 }
543:
544:                 // warning when firstname equals lastname
545:                 // else if (getFirstName() != null && getLastName() != null && getLastName().equals(getFirstName())) {
546:•                else if (getFirstName() != null && getFirstName().equals("H")) {
547:•                        if (chain != null) {
548:                                 chain.add(new BasicDiagnostic(Diagnostic.WARNING,
549:                                         TestValidator.DIAGNOSTIC_SOURCE,
550:                                         TestValidator.WRITER__VALIDATE,
551:                                         "First name is the same as last name",
552:                                         new Object[] { this, TestPackage.eINSTANCE.getWriter_FirstName()
553:                                         // , TestPackage.eINSTANCE.getWriter_LastName()
554:                                         }));
555:                         }
556:                         valid = false;
557:                 }
558:
559:                 // info when first or last name is very short
560:                 // else if (getFirstName().length() == 1 || getLastName().length() == 1) {
561:•                else if (getFirstName().equals("Ha")) {
562:•                        if (chain != null) {
563:                                 chain.add(new BasicDiagnostic(Diagnostic.INFO,
564:                                         TestValidator.DIAGNOSTIC_SOURCE,
565:                                         TestValidator.WRITER__VALIDATE,
566:                                         "First or last name is very short. Is this correct?",
567:                                         new Object[] { this, TestPackage.eINSTANCE.getWriter_FirstName()
568:                                         // , TestPackage.eINSTANCE.getWriter_LastName()
569:                                         }));
570:                         }
571:                         valid = false;
572:                 }
573:
574:•                if (getLastName() != null && getLastName().equals("foo")) {
575:•                        if (chain != null) {
576:                                 chain.add(new BasicDiagnostic(Diagnostic.ERROR,
577:                                         TestValidator.DIAGNOSTIC_SOURCE,
578:                                         TestValidator.WRITER__VALIDATE,
579:                                         "Last name must not be 'foo'.",
580:                                         new Object[] { this, TestPackage.eINSTANCE.getWriter_LastName()
581:                                         }));
582:                         }
583:                         valid = false;
584:                 }
585:
586:                 return valid;
587:         }
588:
589:         // END COMPLEX CODE
590:
591:         /**
592:          * <!-- begin-user-doc -->
593:          * <!-- end-user-doc -->
594:          *
595:          * @generated
596:          */
597:         @SuppressWarnings("unchecked")
598:         @Override
599:         public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
600:•                switch (featureID) {
601:                 case TestPackage.WRITER__BOOKS:
602:                         return ((InternalEList<InternalEObject>) (InternalEList<?>) getBooks()).basicAdd(otherEnd, msgs);
603:                 case TestPackage.WRITER__LIBRARY:
604:•                        if (eInternalContainer() != null) {
605:                                 msgs = eBasicRemoveFromContainer(msgs);
606:                         }
607:                         return basicSetLibrary((Library) otherEnd, msgs);
608:                 }
609:                 return super.eInverseAdd(otherEnd, featureID, msgs);
610:         }
611:
612:         /**
613:          * <!-- begin-user-doc -->
614:          * <!-- end-user-doc -->
615:          *
616:          * @generated
617:          */
618:         @Override
619:         public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
620:•                switch (featureID) {
621:                 case TestPackage.WRITER__BOOKS:
622:                         return ((InternalEList<?>) getBooks()).basicRemove(otherEnd, msgs);
623:                 case TestPackage.WRITER__LIBRARY:
624:                         return basicSetLibrary(null, msgs);
625:                 }
626:                 return super.eInverseRemove(otherEnd, featureID, msgs);
627:         }
628:
629:         /**
630:          * <!-- begin-user-doc -->
631:          * <!-- end-user-doc -->
632:          *
633:          * @generated
634:          */
635:         @Override
636:         public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) {
637:•                switch (eContainerFeatureID()) {
638:                 case TestPackage.WRITER__LIBRARY:
639:                         return eInternalContainer().eInverseRemove(this, TestPackage.LIBRARY__WRITERS, Library.class, msgs);
640:                 }
641:                 return super.eBasicRemoveFromContainerFeature(msgs);
642:         }
643:
644:         /**
645:          * <!-- begin-user-doc -->
646:          * <!-- end-user-doc -->
647:          *
648:          * @generated
649:          */
650:         @Override
651:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
652:•                switch (featureID) {
653:                 case TestPackage.WRITER__FIRST_NAME:
654:                         return getFirstName();
655:                 case TestPackage.WRITER__LAST_NAME:
656:                         return getLastName();
657:                 case TestPackage.WRITER__EMAIL:
658:                         return getEMail();
659:                 case TestPackage.WRITER__BIRTH_DATE:
660:                         return getBirthDate();
661:                 case TestPackage.WRITER__BOOKS:
662:                         return getBooks();
663:                 case TestPackage.WRITER__PSEUDONYM:
664:                         return isPseudonym();
665:                 case TestPackage.WRITER__LIBRARY:
666:                         return getLibrary();
667:                 case TestPackage.WRITER__INITIALS:
668:                         return getInitials();
669:                 case TestPackage.WRITER__TITLE:
670:                         return getTitle();
671:                 }
672:                 return super.eGet(featureID, resolve, coreType);
673:         }
674:
675:         /**
676:          * <!-- begin-user-doc -->
677:          * <!-- end-user-doc -->
678:          *
679:          * @generated
680:          */
681:         @SuppressWarnings("unchecked")
682:         @Override
683:         public void eSet(int featureID, Object newValue) {
684:•                switch (featureID) {
685:                 case TestPackage.WRITER__FIRST_NAME:
686:                         setFirstName((String) newValue);
687:                         return;
688:                 case TestPackage.WRITER__LAST_NAME:
689:                         setLastName((String) newValue);
690:                         return;
691:                 case TestPackage.WRITER__EMAIL:
692:                         setEMail((String) newValue);
693:                         return;
694:                 case TestPackage.WRITER__BIRTH_DATE:
695:                         setBirthDate((Date) newValue);
696:                         return;
697:                 case TestPackage.WRITER__BOOKS:
698:                         getBooks().clear();
699:                         getBooks().addAll((Collection<? extends Book>) newValue);
700:                         return;
701:                 case TestPackage.WRITER__PSEUDONYM:
702:                         setPseudonym((Boolean) newValue);
703:                         return;
704:                 case TestPackage.WRITER__LIBRARY:
705:                         setLibrary((Library) newValue);
706:                         return;
707:                 case TestPackage.WRITER__INITIALS:
708:                         setInitials((String) newValue);
709:                         return;
710:                 case TestPackage.WRITER__TITLE:
711:                         setTitle((String) newValue);
712:                         return;
713:                 }
714:                 super.eSet(featureID, newValue);
715:         }
716:
717:         /**
718:          * <!-- begin-user-doc -->
719:          * <!-- end-user-doc -->
720:          *
721:          * @generated
722:          */
723:         @Override
724:         public void eUnset(int featureID) {
725:•                switch (featureID) {
726:                 case TestPackage.WRITER__FIRST_NAME:
727:                         setFirstName(FIRST_NAME_EDEFAULT);
728:                         return;
729:                 case TestPackage.WRITER__LAST_NAME:
730:                         setLastName(LAST_NAME_EDEFAULT);
731:                         return;
732:                 case TestPackage.WRITER__EMAIL:
733:                         setEMail(EMAIL_EDEFAULT);
734:                         return;
735:                 case TestPackage.WRITER__BIRTH_DATE:
736:                         setBirthDate(BIRTH_DATE_EDEFAULT);
737:                         return;
738:                 case TestPackage.WRITER__BOOKS:
739:                         getBooks().clear();
740:                         return;
741:                 case TestPackage.WRITER__PSEUDONYM:
742:                         setPseudonym(PSEUDONYM_EDEFAULT);
743:                         return;
744:                 case TestPackage.WRITER__LIBRARY:
745:                         setLibrary((Library) null);
746:                         return;
747:                 case TestPackage.WRITER__INITIALS:
748:                         setInitials(INITIALS_EDEFAULT);
749:                         return;
750:                 case TestPackage.WRITER__TITLE:
751:                         setTitle(TITLE_EDEFAULT);
752:                         return;
753:                 }
754:                 super.eUnset(featureID);
755:         }
756:
757:         /**
758:          * <!-- begin-user-doc -->
759:          * <!-- end-user-doc -->
760:          *
761:          * @generated
762:          */
763:         @Override
764:         public boolean eIsSet(int featureID) {
765:•                switch (featureID) {
766:                 case TestPackage.WRITER__FIRST_NAME:
767:•                        return FIRST_NAME_EDEFAULT == null ? firstName != null : !FIRST_NAME_EDEFAULT.equals(firstName);
768:                 case TestPackage.WRITER__LAST_NAME:
769:•                        return LAST_NAME_EDEFAULT == null ? lastName != null : !LAST_NAME_EDEFAULT.equals(lastName);
770:                 case TestPackage.WRITER__EMAIL:
771:•                        return EMAIL_EDEFAULT == null ? eMail != null : !EMAIL_EDEFAULT.equals(eMail);
772:                 case TestPackage.WRITER__BIRTH_DATE:
773:•                        return BIRTH_DATE_EDEFAULT == null ? birthDate != null : !BIRTH_DATE_EDEFAULT.equals(birthDate);
774:                 case TestPackage.WRITER__BOOKS:
775:•                        return books != null && !books.isEmpty();
776:                 case TestPackage.WRITER__PSEUDONYM:
777:                         return pseudonym != PSEUDONYM_EDEFAULT;
778:                 case TestPackage.WRITER__LIBRARY:
779:•                        return getLibrary() != null;
780:                 case TestPackage.WRITER__INITIALS:
781:•                        return INITIALS_EDEFAULT == null ? initials != null : !INITIALS_EDEFAULT.equals(initials);
782:                 case TestPackage.WRITER__TITLE:
783:•                        return TITLE_EDEFAULT == null ? title != null : !TITLE_EDEFAULT.equals(title);
784:                 }
785:                 return super.eIsSet(featureID);
786:         }
787:
788:         /**
789:          * <!-- begin-user-doc -->
790:          * <!-- end-user-doc -->
791:          *
792:          * @generated
793:          */
794:         @Override
795:         public String toString() {
796:•                if (eIsProxy()) {
797:                         return super.toString();
798:                 }
799:
800:                 final StringBuffer result = new StringBuffer(super.toString());
801:                 result.append(" (firstName: ");
802:                 result.append(firstName);
803:                 result.append(", lastName: ");
804:                 result.append(lastName);
805:                 result.append(", EMail: ");
806:                 result.append(eMail);
807:                 result.append(", BirthDate: ");
808:                 result.append(birthDate);
809:                 result.append(", Pseudonym: ");
810:                 result.append(pseudonym);
811:                 result.append(", initials: ");
812:                 result.append(initials);
813:                 result.append(", title: ");
814:                 result.append(title);
815:                 result.append(')');
816:                 return result.toString();
817:         }
818:
819: } // WriterImpl