Skip to content

Package: ExampleSwitch

ExampleSwitch

nameinstructionbranchcomplexitylinemethod
ExampleSwitch()
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%
caseAbstractChild(AbstractChild)
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%
caseChild(Child)
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%
caseContainer(Container)
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%
caseEClassToAdditionMap(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%
caseIntermediate(Intermediate)
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%
caseIntermediateTarget(IntermediateTarget)
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%
caseRoot(Root)
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%
caseTarget(Target)
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: 132 C: 0
0%
M: 27 C: 0
0%
M: 18 C: 0
0%
M: 44 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-2014 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: * Johannes Faltermeier - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.mapping.test.example.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.emf.ecp.view.mapping.test.example.AbstractChild;
23: import org.eclipse.emf.ecp.view.mapping.test.example.Child;
24: import org.eclipse.emf.ecp.view.mapping.test.example.Container;
25: import org.eclipse.emf.ecp.view.mapping.test.example.ExamplePackage;
26: import org.eclipse.emf.ecp.view.mapping.test.example.Intermediate;
27: import org.eclipse.emf.ecp.view.mapping.test.example.IntermediateTarget;
28: import org.eclipse.emf.ecp.view.mapping.test.example.Root;
29: import org.eclipse.emf.ecp.view.mapping.test.example.Target;
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.emf.ecp.view.mapping.test.example.ExamplePackage
43: * @generated
44: */
45: public class ExampleSwitch<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 ExamplePackage modelPackage;
54:
55:         /**
56:          * Creates an instance of the switch.
57:          * <!-- begin-user-doc -->
58:          * <!-- end-user-doc -->
59:          *
60:          * @generated
61:          */
62:         public ExampleSwitch() {
63:•                if (modelPackage == null) {
64:                         modelPackage = ExamplePackage.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:          * @parameter 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 ExamplePackage.ROOT: {
95:                         final Root root = (Root) theEObject;
96:                         T result = caseRoot(root);
97:•                        if (result == null) {
98:                                 result = defaultCase(theEObject);
99:                         }
100:                         return result;
101:                 }
102:                 case ExamplePackage.INTERMEDIATE: {
103:                         final Intermediate intermediate = (Intermediate) theEObject;
104:                         T result = caseIntermediate(intermediate);
105:•                        if (result == null) {
106:                                 result = defaultCase(theEObject);
107:                         }
108:                         return result;
109:                 }
110:                 case ExamplePackage.CONTAINER: {
111:                         final Container container = (Container) theEObject;
112:                         T result = caseContainer(container);
113:•                        if (result == null) {
114:                                 result = defaultCase(theEObject);
115:                         }
116:                         return result;
117:                 }
118:                 case ExamplePackage.ABSTRACT_CHILD: {
119:                         final AbstractChild abstractChild = (AbstractChild) theEObject;
120:                         T result = caseAbstractChild(abstractChild);
121:•                        if (result == null) {
122:                                 result = defaultCase(theEObject);
123:                         }
124:                         return result;
125:                 }
126:                 case ExamplePackage.CHILD: {
127:                         final Child child = (Child) theEObject;
128:                         T result = caseChild(child);
129:•                        if (result == null) {
130:                                 result = caseAbstractChild(child);
131:                         }
132:•                        if (result == null) {
133:                                 result = defaultCase(theEObject);
134:                         }
135:                         return result;
136:                 }
137:                 case ExamplePackage.INTERMEDIATE_TARGET: {
138:                         final IntermediateTarget intermediateTarget = (IntermediateTarget) theEObject;
139:                         T result = caseIntermediateTarget(intermediateTarget);
140:•                        if (result == null) {
141:                                 result = defaultCase(theEObject);
142:                         }
143:                         return result;
144:                 }
145:                 case ExamplePackage.TARGET: {
146:                         final Target target = (Target) theEObject;
147:                         T result = caseTarget(target);
148:•                        if (result == null) {
149:                                 result = defaultCase(theEObject);
150:                         }
151:                         return result;
152:                 }
153:                 case ExamplePackage.ECLASS_TO_ADDITION_MAP: {
154:                         @SuppressWarnings("unchecked")
155:                         final Map.Entry<EClass, AbstractChild> eClassToAdditionMap = (Map.Entry<EClass, AbstractChild>) theEObject;
156:                         T result = caseEClassToAdditionMap(eClassToAdditionMap);
157:•                        if (result == null) {
158:                                 result = defaultCase(theEObject);
159:                         }
160:                         return result;
161:                 }
162:                 default:
163:                         return defaultCase(theEObject);
164:                 }
165:         }
166:
167:         /**
168:          * Returns the result of interpreting the object as an instance of '<em>Root</em>'.
169:          * <!-- begin-user-doc -->
170:          * This implementation returns null;
171:          * returning a non-null result will terminate the switch.
172:          * <!-- end-user-doc -->
173:          *
174:          * @param object the target of the switch.
175:          * @return the result of interpreting the object as an instance of '<em>Root</em>'.
176:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
177:          * @generated
178:          */
179:         public T caseRoot(Root object) {
180:                 return null;
181:         }
182:
183:         /**
184:          * Returns the result of interpreting the object as an instance of '<em>Intermediate</em>'.
185:          * <!-- begin-user-doc -->
186:          * This implementation returns null;
187:          * returning a non-null result will terminate the switch.
188:          * <!-- end-user-doc -->
189:          *
190:          * @param object the target of the switch.
191:          * @return the result of interpreting the object as an instance of '<em>Intermediate</em>'.
192:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
193:          * @generated
194:          */
195:         public T caseIntermediate(Intermediate object) {
196:                 return null;
197:         }
198:
199:         /**
200:          * Returns the result of interpreting the object as an instance of '<em>Container</em>'.
201:          * <!-- begin-user-doc -->
202:          * This implementation returns null;
203:          * returning a non-null result will terminate the switch.
204:          * <!-- end-user-doc -->
205:          *
206:          * @param object the target of the switch.
207:          * @return the result of interpreting the object as an instance of '<em>Container</em>'.
208:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
209:          * @generated
210:          */
211:         public T caseContainer(Container object) {
212:                 return null;
213:         }
214:
215:         /**
216:          * Returns the result of interpreting the object as an instance of '<em>Abstract Child</em>'.
217:          * <!-- begin-user-doc -->
218:          * This implementation returns null;
219:          * returning a non-null result will terminate the switch.
220:          * <!-- end-user-doc -->
221:          *
222:          * @param object the target of the switch.
223:          * @return the result of interpreting the object as an instance of '<em>Abstract Child</em>'.
224:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
225:          * @generated
226:          */
227:         public T caseAbstractChild(AbstractChild object) {
228:                 return null;
229:         }
230:
231:         /**
232:          * Returns the result of interpreting the object as an instance of '<em>Child</em>'.
233:          * <!-- begin-user-doc -->
234:          * This implementation returns null;
235:          * returning a non-null result will terminate the switch.
236:          * <!-- end-user-doc -->
237:          *
238:          * @param object the target of the switch.
239:          * @return the result of interpreting the object as an instance of '<em>Child</em>'.
240:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
241:          * @generated
242:          */
243:         public T caseChild(Child object) {
244:                 return null;
245:         }
246:
247:         /**
248:          * Returns the result of interpreting the object as an instance of '<em>Intermediate Target</em>'.
249:          * <!-- begin-user-doc -->
250:          * This implementation returns null;
251:          * returning a non-null result will terminate the switch.
252:          * <!-- end-user-doc -->
253:          *
254:          * @param object the target of the switch.
255:          * @return the result of interpreting the object as an instance of '<em>Intermediate Target</em>'.
256:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
257:          * @generated
258:          */
259:         public T caseIntermediateTarget(IntermediateTarget object) {
260:                 return null;
261:         }
262:
263:         /**
264:          * Returns the result of interpreting the object as an instance of '<em>Target</em>'.
265:          * <!-- begin-user-doc -->
266:          * This implementation returns null;
267:          * returning a non-null result will terminate the switch.
268:          * <!-- end-user-doc -->
269:          *
270:          * @param object the target of the switch.
271:          * @return the result of interpreting the object as an instance of '<em>Target</em>'.
272:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
273:          * @generated
274:          */
275:         public T caseTarget(Target object) {
276:                 return null;
277:         }
278:
279:         /**
280:          * Returns the result of interpreting the object as an instance of '<em>EClass To Addition Map</em>'.
281:          * <!-- begin-user-doc -->
282:          * This implementation returns null;
283:          * returning a non-null result will terminate the switch.
284:          * <!-- end-user-doc -->
285:          *
286:          * @param object the target of the switch.
287:          * @return the result of interpreting the object as an instance of '<em>EClass To Addition Map</em>'.
288:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
289:          * @generated
290:          */
291:         public T caseEClassToAdditionMap(Map.Entry<EClass, AbstractChild> object) {
292:                 return null;
293:         }
294:
295:         /**
296:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
297:          * <!-- begin-user-doc -->
298:          * This implementation returns null;
299:          * returning a non-null result will terminate the switch, but this is the last case anyway.
300:          * <!-- end-user-doc -->
301:          *
302:          * @param object the target of the switch.
303:          * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
304:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
305:          * @generated
306:          */
307:         @Override
308:         public T defaultCase(EObject object) {
309:                 return null;
310:         }
311:
312: } // ExampleSwitch