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%
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%
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: 96 C: 0
0%
M: 19 C: 0
0%
M: 13 C: 0
0%
M: 32 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: * Eugen Neufeld - initial API and implementation
13: */
14: package org.eclipse.emf.ecp.view.index.test.example.util;
15:
16: import org.eclipse.emf.ecore.EObject;
17: import org.eclipse.emf.ecore.EPackage;
18: import org.eclipse.emf.ecore.util.Switch;
19: import org.eclipse.emf.ecp.view.index.test.example.Child;
20: import org.eclipse.emf.ecp.view.index.test.example.Container;
21: import org.eclipse.emf.ecp.view.index.test.example.ExamplePackage;
22: import org.eclipse.emf.ecp.view.index.test.example.Intermediate;
23: import org.eclipse.emf.ecp.view.index.test.example.IntermediateTarget;
24: import org.eclipse.emf.ecp.view.index.test.example.Root;
25: import org.eclipse.emf.ecp.view.index.test.example.Target;
26:
27: /**
28: * <!-- begin-user-doc -->
29: * The <b>Switch</b> for the model's inheritance hierarchy.
30: * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each
31: * class of the model,
32: * starting with the actual class of the object
33: * and proceeding up the inheritance hierarchy
34: * until a non-null result is returned,
35: * which is the result of the switch.
36: * <!-- end-user-doc -->
37: *
38: * @see org.eclipse.emf.ecp.view.index.test.example.ExamplePackage
39: * @generated
40: */
41: public class ExampleSwitch<T> extends Switch<T> {
42:         /**
43:          * The cached model package
44:          * <!-- begin-user-doc -->
45:          * <!-- end-user-doc -->
46:          *
47:          * @generated
48:          */
49:         protected static ExamplePackage modelPackage;
50:
51:         /**
52:          * Creates an instance of the switch.
53:          * <!-- begin-user-doc -->
54:          * <!-- end-user-doc -->
55:          *
56:          * @generated
57:          */
58:         public ExampleSwitch() {
59:•                if (modelPackage == null) {
60:                         modelPackage = ExamplePackage.eINSTANCE;
61:                 }
62:         }
63:
64:         /**
65:          * Checks whether this is a switch for the given package.
66:          * <!-- begin-user-doc -->
67:          * <!-- end-user-doc -->
68:          *
69:          * @parameter ePackage the package in question.
70:          * @return whether this is a switch for the given package.
71:          * @generated
72:          */
73:         @Override
74:         protected boolean isSwitchFor(EPackage ePackage) {
75:•                return ePackage == modelPackage;
76:         }
77:
78:         /**
79:          * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
80:          * result.
81:          * <!-- begin-user-doc -->
82:          * <!-- end-user-doc -->
83:          *
84:          * @return the first non-null result returned by a <code>caseXXX</code> call.
85:          * @generated
86:          */
87:         @Override
88:         protected T doSwitch(int classifierID, EObject theEObject) {
89:•                switch (classifierID) {
90:                 case ExamplePackage.ROOT: {
91:                         final Root root = (Root) theEObject;
92:                         T result = caseRoot(root);
93:•                        if (result == null) {
94:                                 result = defaultCase(theEObject);
95:                         }
96:                         return result;
97:                 }
98:                 case ExamplePackage.INTERMEDIATE: {
99:                         final Intermediate intermediate = (Intermediate) theEObject;
100:                         T result = caseIntermediate(intermediate);
101:•                        if (result == null) {
102:                                 result = defaultCase(theEObject);
103:                         }
104:                         return result;
105:                 }
106:                 case ExamplePackage.CONTAINER: {
107:                         final Container container = (Container) theEObject;
108:                         T result = caseContainer(container);
109:•                        if (result == null) {
110:                                 result = defaultCase(theEObject);
111:                         }
112:                         return result;
113:                 }
114:                 case ExamplePackage.CHILD: {
115:                         final Child child = (Child) theEObject;
116:                         T result = caseChild(child);
117:•                        if (result == null) {
118:                                 result = defaultCase(theEObject);
119:                         }
120:                         return result;
121:                 }
122:                 case ExamplePackage.INTERMEDIATE_TARGET: {
123:                         final IntermediateTarget intermediateTarget = (IntermediateTarget) theEObject;
124:                         T result = caseIntermediateTarget(intermediateTarget);
125:•                        if (result == null) {
126:                                 result = defaultCase(theEObject);
127:                         }
128:                         return result;
129:                 }
130:                 case ExamplePackage.TARGET: {
131:                         final Target target = (Target) theEObject;
132:                         T result = caseTarget(target);
133:•                        if (result == null) {
134:                                 result = defaultCase(theEObject);
135:                         }
136:                         return result;
137:                 }
138:                 default:
139:                         return defaultCase(theEObject);
140:                 }
141:         }
142:
143:         /**
144:          * Returns the result of interpreting the object as an instance of '<em>Root</em>'.
145:          * <!-- begin-user-doc -->
146:          * This implementation returns null;
147:          * returning a non-null result will terminate the switch.
148:          * <!-- end-user-doc -->
149:          *
150:          * @param object the target of the switch.
151:          * @return the result of interpreting the object as an instance of '<em>Root</em>'.
152:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
153:          * @generated
154:          */
155:         public T caseRoot(Root object) {
156:                 return null;
157:         }
158:
159:         /**
160:          * Returns the result of interpreting the object as an instance of '<em>Intermediate</em>'.
161:          * <!-- begin-user-doc -->
162:          * This implementation returns null;
163:          * returning a non-null result will terminate the switch.
164:          * <!-- end-user-doc -->
165:          *
166:          * @param object the target of the switch.
167:          * @return the result of interpreting the object as an instance of '<em>Intermediate</em>'.
168:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
169:          * @generated
170:          */
171:         public T caseIntermediate(Intermediate object) {
172:                 return null;
173:         }
174:
175:         /**
176:          * Returns the result of interpreting the object as an instance of '<em>Container</em>'.
177:          * <!-- begin-user-doc -->
178:          * This implementation returns null;
179:          * returning a non-null result will terminate the switch.
180:          * <!-- end-user-doc -->
181:          *
182:          * @param object the target of the switch.
183:          * @return the result of interpreting the object as an instance of '<em>Container</em>'.
184:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
185:          * @generated
186:          */
187:         public T caseContainer(Container object) {
188:                 return null;
189:         }
190:
191:         /**
192:          * Returns the result of interpreting the object as an instance of '<em>Child</em>'.
193:          * <!-- begin-user-doc -->
194:          * This implementation returns null;
195:          * returning a non-null result will terminate the switch.
196:          * <!-- end-user-doc -->
197:          *
198:          * @param object the target of the switch.
199:          * @return the result of interpreting the object as an instance of '<em>Child</em>'.
200:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
201:          * @generated
202:          */
203:         public T caseChild(Child object) {
204:                 return null;
205:         }
206:
207:         /**
208:          * Returns the result of interpreting the object as an instance of '<em>Intermediate Target</em>'.
209:          * <!-- begin-user-doc -->
210:          * This implementation returns null;
211:          * returning a non-null result will terminate the switch.
212:          * <!-- end-user-doc -->
213:          *
214:          * @param object the target of the switch.
215:          * @return the result of interpreting the object as an instance of '<em>Intermediate Target</em>'.
216:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
217:          * @generated
218:          */
219:         public T caseIntermediateTarget(IntermediateTarget object) {
220:                 return null;
221:         }
222:
223:         /**
224:          * Returns the result of interpreting the object as an instance of '<em>Target</em>'.
225:          * <!-- begin-user-doc -->
226:          * This implementation returns null;
227:          * returning a non-null result will terminate the switch.
228:          * <!-- end-user-doc -->
229:          *
230:          * @param object the target of the switch.
231:          * @return the result of interpreting the object as an instance of '<em>Target</em>'.
232:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
233:          * @generated
234:          */
235:         public T caseTarget(Target object) {
236:                 return null;
237:         }
238:
239:         /**
240:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
241:          * <!-- begin-user-doc -->
242:          * This implementation returns null;
243:          * returning a non-null result will terminate the switch, but this is the last case anyway.
244:          * <!-- end-user-doc -->
245:          *
246:          * @param object the target of the switch.
247:          * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
248:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
249:          * @generated
250:          */
251:         @Override
252:         public T defaultCase(EObject object) {
253:                 return null;
254:         }
255:
256: } // ExampleSwitch