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%
caseComponent(Component)
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%
caseComponent2(Component2)
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%
caseComposite(Composite)
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: 57 C: 0
0%
M: 12 C: 0
0%
M: 8 C: 0
0%
M: 19 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-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: * EclipseSource Muenchen GmbH - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emf.ecp.ui.view.editor.test.model.test.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.ui.view.editor.test.model.test.Component;
20: import org.eclipse.emf.ecp.ui.view.editor.test.model.test.Component2;
21: import org.eclipse.emf.ecp.ui.view.editor.test.model.test.Composite;
22: import org.eclipse.emf.ecp.ui.view.editor.test.model.test.TestPackage;
23:
24: /**
25: * <!-- begin-user-doc -->
26: * The <b>Switch</b> for the model's inheritance hierarchy.
27: * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each
28: * class of the model,
29: * starting with the actual class of the object
30: * and proceeding up the inheritance hierarchy
31: * until a non-null result is returned,
32: * which is the result of the switch.
33: * <!-- end-user-doc -->
34: *
35: * @see org.eclipse.emf.ecp.ui.view.editor.test.model.test.TestPackage
36: * @generated
37: */
38: public class TestSwitch<T> extends Switch<T> {
39:         /**
40:          * The cached model package
41:          * <!-- begin-user-doc -->
42:          * <!-- end-user-doc -->
43:          *
44:          * @generated
45:          */
46:         protected static TestPackage modelPackage;
47:
48:         /**
49:          * Creates an instance of the switch.
50:          * <!-- begin-user-doc -->
51:          * <!-- end-user-doc -->
52:          *
53:          * @generated
54:          */
55:         public TestSwitch() {
56:•                if (modelPackage == null) {
57:                         modelPackage = TestPackage.eINSTANCE;
58:                 }
59:         }
60:
61:         /**
62:          * Checks whether this is a switch for the given package.
63:          * <!-- begin-user-doc -->
64:          * <!-- end-user-doc -->
65:          *
66:          * @parameter ePackage the package in question.
67:          * @return whether this is a switch for the given package.
68:          * @generated
69:          */
70:         @Override
71:         protected boolean isSwitchFor(EPackage ePackage) {
72:•                return ePackage == modelPackage;
73:         }
74:
75:         /**
76:          * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
77:          * result.
78:          * <!-- begin-user-doc -->
79:          * <!-- end-user-doc -->
80:          *
81:          * @return the first non-null result returned by a <code>caseXXX</code> call.
82:          * @generated
83:          */
84:         @Override
85:         protected T doSwitch(int classifierID, EObject theEObject) {
86:•                switch (classifierID) {
87:                 case TestPackage.COMPONENT: {
88:                         final Component component = (Component) theEObject;
89:                         T result = caseComponent(component);
90:•                        if (result == null) {
91:                                 result = defaultCase(theEObject);
92:                         }
93:                         return result;
94:                 }
95:                 case TestPackage.COMPOSITE: {
96:                         final Composite composite = (Composite) theEObject;
97:                         T result = caseComposite(composite);
98:•                        if (result == null) {
99:                                 result = caseComponent(composite);
100:                         }
101:•                        if (result == null) {
102:                                 result = defaultCase(theEObject);
103:                         }
104:                         return result;
105:                 }
106:                 case TestPackage.COMPONENT2: {
107:                         final Component2 component2 = (Component2) theEObject;
108:                         T result = caseComponent2(component2);
109:•                        if (result == null) {
110:                                 result = defaultCase(theEObject);
111:                         }
112:                         return result;
113:                 }
114:                 default:
115:                         return defaultCase(theEObject);
116:                 }
117:         }
118:
119:         /**
120:          * Returns the result of interpreting the object as an instance of '<em>Component</em>'.
121:          * <!-- begin-user-doc -->
122:          * This implementation returns null;
123:          * returning a non-null result will terminate the switch.
124:          * <!-- end-user-doc -->
125:          *
126:          * @param object the target of the switch.
127:          * @return the result of interpreting the object as an instance of '<em>Component</em>'.
128:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
129:          * @generated
130:          */
131:         public T caseComponent(Component object) {
132:                 return null;
133:         }
134:
135:         /**
136:          * Returns the result of interpreting the object as an instance of '<em>Composite</em>'.
137:          * <!-- begin-user-doc -->
138:          * This implementation returns null;
139:          * returning a non-null result will terminate the switch.
140:          * <!-- end-user-doc -->
141:          *
142:          * @param object the target of the switch.
143:          * @return the result of interpreting the object as an instance of '<em>Composite</em>'.
144:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
145:          * @generated
146:          */
147:         public T caseComposite(Composite object) {
148:                 return null;
149:         }
150:
151:         /**
152:          * Returns the result of interpreting the object as an instance of '<em>Component2</em>'.
153:          * <!-- begin-user-doc -->
154:          * This implementation returns null;
155:          * returning a non-null result will terminate the switch.
156:          * <!-- end-user-doc -->
157:          *
158:          * @param object the target of the switch.
159:          * @return the result of interpreting the object as an instance of '<em>Component2</em>'.
160:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
161:          * @generated
162:          */
163:         public T caseComponent2(Component2 object) {
164:                 return null;
165:         }
166:
167:         /**
168:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
169:          * <!-- begin-user-doc -->
170:          * This implementation returns null;
171:          * returning a non-null result will terminate the switch, but this is the last case anyway.
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>EObject</em>'.
176:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
177:          * @generated
178:          */
179:         @Override
180:         public T defaultCase(EObject object) {
181:                 return null;
182:         }
183:
184: } // TestSwitch