Skip to content

Package: TemplateImpl

TemplateImpl

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