Skip to content

Package: LibrarianImpl

LibrarianImpl

nameinstructionbranchcomplexitylinemethod
LibrarianImpl()
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: 6 C: 5
45%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 1 C: 2
67%
M: 0 C: 1
100%
eIsSet(int)
M: 12 C: 12
50%
M: 4 C: 4
50%
M: 3 C: 2
40%
M: 1 C: 2
67%
M: 0 C: 1
100%
eSet(int, Object)
M: 12 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 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: 10 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 5 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%
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%
validate(DiagnosticChain, Map)
M: 0 C: 34
100%
M: 1 C: 5
83%
M: 1 C: 3
75%
M: 0 C: 9
100%
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.Map;
17:
18: import org.eclipse.emf.common.notify.Notification;
19: import org.eclipse.emf.common.util.BasicDiagnostic;
20: import org.eclipse.emf.common.util.Diagnostic;
21: import org.eclipse.emf.common.util.DiagnosticChain;
22: import org.eclipse.emf.ecore.EClass;
23: import org.eclipse.emf.ecore.impl.ENotificationImpl;
24: import org.eclipse.emf.ecore.impl.EObjectImpl;
25: import org.eclipse.emf.ecp.view.validation.test.model.Librarian;
26: import org.eclipse.emf.ecp.view.validation.test.model.TestPackage;
27: import org.eclipse.emf.ecp.view.validation.test.model.util.TestValidator;
28:
29: /**
30: * <!-- begin-user-doc -->
31: * An implementation of the model object '<em><b>Librarian</b></em>'.
32: * <!-- end-user-doc -->
33: * <p>
34: * The following features are implemented:
35: * </p>
36: * <ul>
37: * <li>{@link org.eclipse.emf.ecp.view.validation.test.model.impl.LibrarianImpl#getName <em>Name</em>}</li>
38: * </ul>
39: *
40: * @generated
41: */
42: public class LibrarianImpl extends EObjectImpl implements Librarian {
43:         /**
44:          * The default value of the '{@link #getName() <em>Name</em>}' attribute.
45:          * <!-- begin-user-doc -->
46:          * <!-- end-user-doc -->
47:          *
48:          * @see #getName()
49:          * @generated
50:          * @ordered
51:          */
52:         protected static final String NAME_EDEFAULT = null;
53:
54:         /**
55:          * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
56:          * <!-- begin-user-doc -->
57:          * <!-- end-user-doc -->
58:          *
59:          * @see #getName()
60:          * @generated
61:          * @ordered
62:          */
63:         protected String name = NAME_EDEFAULT;
64:
65:         /**
66:          * <!-- begin-user-doc -->
67:          * <!-- end-user-doc -->
68:          *
69:          * @generated
70:          */
71:         protected LibrarianImpl() {
72:                 super();
73:         }
74:
75:         /**
76:          * <!-- begin-user-doc -->
77:          * <!-- end-user-doc -->
78:          *
79:          * @generated
80:          */
81:         @Override
82:         protected EClass eStaticClass() {
83:                 return TestPackage.Literals.LIBRARIAN;
84:         }
85:
86:         /**
87:          * <!-- begin-user-doc -->
88:          * <!-- end-user-doc -->
89:          *
90:          * @generated
91:          */
92:         @Override
93:         public String getName() {
94:                 return name;
95:         }
96:
97:         /**
98:          * <!-- begin-user-doc -->
99:          * <!-- end-user-doc -->
100:          *
101:          * @generated
102:          */
103:         @Override
104:         public void setName(String newName) {
105:                 final String oldName = name;
106:                 name = newName;
107:•                if (eNotificationRequired()) {
108:                         eNotify(new ENotificationImpl(this, Notification.SET, TestPackage.LIBRARIAN__NAME, oldName, name));
109:                 }
110:         }
111:
112:         /**
113:          * <!-- begin-user-doc -->
114:          * <!-- end-user-doc -->
115:          *
116:          * @generated NOT
117:          */
118:         @Override
119:         public boolean validate(DiagnosticChain diagnostic, Map<Object, Object> context) {
120:•                if (getName() == null || getName().equals("")) {
121:•                        if (diagnostic != null) {
122:                                 diagnostic.add(new BasicDiagnostic(Diagnostic.ERROR,
123:                                         TestValidator.DIAGNOSTIC_SOURCE,
124:                                         TestValidator.LIBRARIAN__VALIDATE,
125:                                         "Pens need to have an id",
126:                                         new Object[] { this, TestPackage.eINSTANCE.getLibrarian_Name() }));
127:                         }
128:                         return false;
129:                 }
130:                 return true;
131:         }
132:
133:         /**
134:          * <!-- begin-user-doc -->
135:          * <!-- end-user-doc -->
136:          *
137:          * @generated
138:          */
139:         @Override
140:         public Object eGet(int featureID, boolean resolve, boolean coreType) {
141:•                switch (featureID) {
142:                 case TestPackage.LIBRARIAN__NAME:
143:                         return getName();
144:                 }
145:                 return super.eGet(featureID, resolve, coreType);
146:         }
147:
148:         /**
149:          * <!-- begin-user-doc -->
150:          * <!-- end-user-doc -->
151:          *
152:          * @generated
153:          */
154:         @Override
155:         public void eSet(int featureID, Object newValue) {
156:•                switch (featureID) {
157:                 case TestPackage.LIBRARIAN__NAME:
158:                         setName((String) newValue);
159:                         return;
160:                 }
161:                 super.eSet(featureID, newValue);
162:         }
163:
164:         /**
165:          * <!-- begin-user-doc -->
166:          * <!-- end-user-doc -->
167:          *
168:          * @generated
169:          */
170:         @Override
171:         public void eUnset(int featureID) {
172:•                switch (featureID) {
173:                 case TestPackage.LIBRARIAN__NAME:
174:                         setName(NAME_EDEFAULT);
175:                         return;
176:                 }
177:                 super.eUnset(featureID);
178:         }
179:
180:         /**
181:          * <!-- begin-user-doc -->
182:          * <!-- end-user-doc -->
183:          *
184:          * @generated
185:          */
186:         @Override
187:         public boolean eIsSet(int featureID) {
188:•                switch (featureID) {
189:                 case TestPackage.LIBRARIAN__NAME:
190:•                        return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
191:                 }
192:                 return super.eIsSet(featureID);
193:         }
194:
195:         /**
196:          * <!-- begin-user-doc -->
197:          * <!-- end-user-doc -->
198:          *
199:          * @generated
200:          */
201:         @Override
202:         public String toString() {
203:•                if (eIsProxy()) {
204:                         return super.toString();
205:                 }
206:
207:                 final StringBuffer result = new StringBuffer(super.toString());
208:                 result.append(" (name: ");
209:                 result.append(name);
210:                 result.append(')');
211:                 return result.toString();
212:         }
213:
214: } // LibrarianImpl