Skip to content

Package: TestSwitch

TestSwitch

nameinstructionbranchcomplexitylinemethod
TestSwitch()
M: 7 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%
caseA(A)
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%
caseB(B)
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%
caseC(C)
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%
caseD(D)
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%
caseDExtended(DExtended)
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%
caseE(E)
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%
caseEClassToAMap(Map.Entry)
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%
caseEClassToEMap(Map.Entry)
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%
caseEClassToEStringMap(Map.Entry)
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%
caseF(F)
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%
defaultCase(EObject)
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%
doSwitch(int, EObject)
M: 168 C: 0
0%
M: 35 C: 0
0%
M: 23 C: 0
0%
M: 56 C: 0
0%
M: 1 C: 0
0%
isSwitchFor(EPackage)
M: 7 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (c) 2011-2015 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: * Lucas Koehler - initial API and implementation
13: */
14: package org.eclipse.emfforms.core.services.databinding.testmodel.test.model.util;
15:
16: import java.util.Map;
17:
18: import org.eclipse.emf.ecore.EClass;
19: import org.eclipse.emf.ecore.EObject;
20: import org.eclipse.emf.ecore.EPackage;
21: import org.eclipse.emf.ecore.util.Switch;
22: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.A;
23: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.B;
24: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.C;
25: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.D;
26: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.DExtended;
27: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.E;
28: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.F;
29: import org.eclipse.emfforms.core.services.databinding.testmodel.test.model.TestPackage;
30:
31: /**
32: * <!-- begin-user-doc -->
33: * The <b>Switch</b> for the model's inheritance hierarchy.
34: * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each
35: * class of the model,
36: * starting with the actual class of the object
37: * and proceeding up the inheritance hierarchy
38: * until a non-null result is returned,
39: * which is the result of the switch.
40: * <!-- end-user-doc -->
41: *
42: * @see org.eclipse.emfforms.core.services.databinding.testmodel.test.model.TestPackage
43: * @generated
44: */
45: public class TestSwitch<T> extends Switch<T> {
46:         /**
47:          * The cached model package
48:          * <!-- begin-user-doc -->
49:          * <!-- end-user-doc -->
50:          *
51:          * @generated
52:          */
53:         protected static TestPackage modelPackage;
54:
55:         /**
56:          * Creates an instance of the switch.
57:          * <!-- begin-user-doc -->
58:          * <!-- end-user-doc -->
59:          *
60:          * @generated
61:          */
62:         public TestSwitch() {
63:•                if (modelPackage == null) {
64:                         modelPackage = TestPackage.eINSTANCE;
65:                 }
66:         }
67:
68:         /**
69:          * Checks whether this is a switch for the given package.
70:          * <!-- begin-user-doc -->
71:          * <!-- end-user-doc -->
72:          *
73:          * @param ePackage the package in question.
74:          * @return whether this is a switch for the given package.
75:          * @generated
76:          */
77:         @Override
78:         protected boolean isSwitchFor(EPackage ePackage) {
79:•                return ePackage == modelPackage;
80:         }
81:
82:         /**
83:          * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
84:          * result.
85:          * <!-- begin-user-doc -->
86:          * <!-- end-user-doc -->
87:          *
88:          * @return the first non-null result returned by a <code>caseXXX</code> call.
89:          * @generated
90:          */
91:         @Override
92:         protected T doSwitch(int classifierID, EObject theEObject) {
93:•                switch (classifierID) {
94:                 case TestPackage.A: {
95:                         final A a = (A) theEObject;
96:                         T result = caseA(a);
97:•                        if (result == null) {
98:                                 result = caseE(a);
99:                         }
100:•                        if (result == null) {
101:                                 result = defaultCase(theEObject);
102:                         }
103:                         return result;
104:                 }
105:                 case TestPackage.B: {
106:                         final B b = (B) theEObject;
107:                         T result = caseB(b);
108:•                        if (result == null) {
109:                                 result = defaultCase(theEObject);
110:                         }
111:                         return result;
112:                 }
113:                 case TestPackage.C: {
114:                         final C c = (C) theEObject;
115:                         T result = caseC(c);
116:•                        if (result == null) {
117:                                 result = defaultCase(theEObject);
118:                         }
119:                         return result;
120:                 }
121:                 case TestPackage.D: {
122:                         final D d = (D) theEObject;
123:                         T result = caseD(d);
124:•                        if (result == null) {
125:                                 result = defaultCase(theEObject);
126:                         }
127:                         return result;
128:                 }
129:                 case TestPackage.ECLASS_TO_ESTRING_MAP: {
130:                         @SuppressWarnings("unchecked")
131:                         final Map.Entry<EClass, String> eClassToEStringMap = (Map.Entry<EClass, String>) theEObject;
132:                         T result = caseEClassToEStringMap(eClassToEStringMap);
133:•                        if (result == null) {
134:                                 result = defaultCase(theEObject);
135:                         }
136:                         return result;
137:                 }
138:                 case TestPackage.ECLASS_TO_AMAP: {
139:                         @SuppressWarnings("unchecked")
140:                         final Map.Entry<EClass, A> eClassToAMap = (Map.Entry<EClass, A>) theEObject;
141:                         T result = caseEClassToAMap(eClassToAMap);
142:•                        if (result == null) {
143:                                 result = defaultCase(theEObject);
144:                         }
145:                         return result;
146:                 }
147:                 case TestPackage.DEXTENDED: {
148:                         final DExtended dExtended = (DExtended) theEObject;
149:                         T result = caseDExtended(dExtended);
150:•                        if (result == null) {
151:                                 result = caseD(dExtended);
152:                         }
153:•                        if (result == null) {
154:                                 result = defaultCase(theEObject);
155:                         }
156:                         return result;
157:                 }
158:                 case TestPackage.E: {
159:                         final E e = (E) theEObject;
160:                         T result = caseE(e);
161:•                        if (result == null) {
162:                                 result = defaultCase(theEObject);
163:                         }
164:                         return result;
165:                 }
166:                 case TestPackage.F: {
167:                         final F f = (F) theEObject;
168:                         T result = caseF(f);
169:•                        if (result == null) {
170:                                 result = defaultCase(theEObject);
171:                         }
172:                         return result;
173:                 }
174:                 case TestPackage.ECLASS_TO_EMAP: {
175:                         @SuppressWarnings("unchecked")
176:                         final Map.Entry<EClass, E> eClassToEMap = (Map.Entry<EClass, E>) theEObject;
177:                         T result = caseEClassToEMap(eClassToEMap);
178:•                        if (result == null) {
179:                                 result = defaultCase(theEObject);
180:                         }
181:                         return result;
182:                 }
183:                 default:
184:                         return defaultCase(theEObject);
185:                 }
186:         }
187:
188:         /**
189:          * Returns the result of interpreting the object as an instance of '<em>A</em>'.
190:          * <!-- begin-user-doc -->
191:          * This implementation returns null;
192:          * returning a non-null result will terminate the switch.
193:          * <!-- end-user-doc -->
194:          *
195:          * @param object the target of the switch.
196:          * @return the result of interpreting the object as an instance of '<em>A</em>'.
197:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
198:          * @generated
199:          */
200:         public T caseA(A object) {
201:                 return null;
202:         }
203:
204:         /**
205:          * Returns the result of interpreting the object as an instance of '<em>B</em>'.
206:          * <!-- begin-user-doc -->
207:          * This implementation returns null;
208:          * returning a non-null result will terminate the switch.
209:          * <!-- end-user-doc -->
210:          *
211:          * @param object the target of the switch.
212:          * @return the result of interpreting the object as an instance of '<em>B</em>'.
213:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
214:          * @generated
215:          */
216:         public T caseB(B object) {
217:                 return null;
218:         }
219:
220:         /**
221:          * Returns the result of interpreting the object as an instance of '<em>C</em>'.
222:          * <!-- begin-user-doc -->
223:          * This implementation returns null;
224:          * returning a non-null result will terminate the switch.
225:          * <!-- end-user-doc -->
226:          *
227:          * @param object the target of the switch.
228:          * @return the result of interpreting the object as an instance of '<em>C</em>'.
229:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
230:          * @generated
231:          */
232:         public T caseC(C object) {
233:                 return null;
234:         }
235:
236:         /**
237:          * Returns the result of interpreting the object as an instance of '<em>D</em>'.
238:          * <!-- begin-user-doc -->
239:          * This implementation returns null;
240:          * returning a non-null result will terminate the switch.
241:          * <!-- end-user-doc -->
242:          *
243:          * @param object the target of the switch.
244:          * @return the result of interpreting the object as an instance of '<em>D</em>'.
245:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
246:          * @generated
247:          */
248:         public T caseD(D object) {
249:                 return null;
250:         }
251:
252:         /**
253:          * Returns the result of interpreting the object as an instance of '<em>EClass To EString Map</em>'.
254:          * <!-- begin-user-doc -->
255:          * This implementation returns null;
256:          * returning a non-null result will terminate the switch.
257:          * <!-- end-user-doc -->
258:          *
259:          * @param object the target of the switch.
260:          * @return the result of interpreting the object as an instance of '<em>EClass To EString Map</em>'.
261:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
262:          * @generated
263:          */
264:         public T caseEClassToEStringMap(Map.Entry<EClass, String> object) {
265:                 return null;
266:         }
267:
268:         /**
269:          * Returns the result of interpreting the object as an instance of '<em>EClass To AMap</em>'.
270:          * <!-- begin-user-doc -->
271:          * This implementation returns null;
272:          * returning a non-null result will terminate the switch.
273:          * <!-- end-user-doc -->
274:          *
275:          * @param object the target of the switch.
276:          * @return the result of interpreting the object as an instance of '<em>EClass To AMap</em>'.
277:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
278:          * @generated
279:          */
280:         public T caseEClassToAMap(Map.Entry<EClass, A> object) {
281:                 return null;
282:         }
283:
284:         /**
285:          * Returns the result of interpreting the object as an instance of '<em>DExtended</em>'.
286:          * <!-- begin-user-doc -->
287:          * This implementation returns null;
288:          * returning a non-null result will terminate the switch.
289:          * <!-- end-user-doc -->
290:          *
291:          * @param object the target of the switch.
292:          * @return the result of interpreting the object as an instance of '<em>DExtended</em>'.
293:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
294:          * @generated
295:          */
296:         public T caseDExtended(DExtended object) {
297:                 return null;
298:         }
299:
300:         /**
301:          * Returns the result of interpreting the object as an instance of '<em>E</em>'.
302:          * <!-- begin-user-doc -->
303:          * This implementation returns null;
304:          * returning a non-null result will terminate the switch.
305:          * <!-- end-user-doc -->
306:          *
307:          * @param object the target of the switch.
308:          * @return the result of interpreting the object as an instance of '<em>E</em>'.
309:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
310:          * @generated
311:          */
312:         public T caseE(E object) {
313:                 return null;
314:         }
315:
316:         /**
317:          * Returns the result of interpreting the object as an instance of '<em>F</em>'.
318:          * <!-- begin-user-doc -->
319:          * This implementation returns null;
320:          * returning a non-null result will terminate the switch.
321:          * <!-- end-user-doc -->
322:          *
323:          * @param object the target of the switch.
324:          * @return the result of interpreting the object as an instance of '<em>F</em>'.
325:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
326:          * @generated
327:          */
328:         public T caseF(F object) {
329:                 return null;
330:         }
331:
332:         /**
333:          * Returns the result of interpreting the object as an instance of '<em>EClass To EMap</em>'.
334:          * <!-- begin-user-doc -->
335:          * This implementation returns null;
336:          * returning a non-null result will terminate the switch.
337:          * <!-- end-user-doc -->
338:          *
339:          * @param object the target of the switch.
340:          * @return the result of interpreting the object as an instance of '<em>EClass To EMap</em>'.
341:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
342:          * @generated
343:          */
344:         public T caseEClassToEMap(Map.Entry<EClass, E> object) {
345:                 return null;
346:         }
347:
348:         /**
349:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
350:          * <!-- begin-user-doc -->
351:          * This implementation returns null;
352:          * returning a non-null result will terminate the switch, but this is the last case anyway.
353:          * <!-- end-user-doc -->
354:          *
355:          * @param object the target of the switch.
356:          * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
357:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
358:          * @generated
359:          */
360:         @Override
361:         public T defaultCase(EObject object) {
362:                 return null;
363:         }
364:
365: } // TestSwitch