Skip to content

Package: TestSwitch

TestSwitch

nameinstructionbranchcomplexitylinemethod
TestSwitch()
M: 0 C: 7
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
caseInnerObject(InnerObject)
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%
caseSimpleTestObject(SimpleTestObject)
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: 23 C: 13
36%
M: 5 C: 2
29%
M: 4 C: 1
20%
M: 7 C: 5
42%
M: 0 C: 1
100%
isSwitchFor(EPackage)
M: 2 C: 5
71%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 1
100%
M: 0 C: 1
100%

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: * Eugen Neufeld - initial API and implementation
13: * Lucas Koehler - extension for EnumComboViewerRenderer_PTest
14: */
15: package org.eclipse.emf.ecp.view.core.swt.test.model.util;
16:
17: import org.eclipse.emf.ecore.EObject;
18: import org.eclipse.emf.ecore.EPackage;
19: import org.eclipse.emf.ecore.util.Switch;
20: import org.eclipse.emf.ecp.view.core.swt.test.model.InnerObject;
21: import org.eclipse.emf.ecp.view.core.swt.test.model.SimpleTestObject;
22: import org.eclipse.emf.ecp.view.core.swt.test.model.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)}
28: * to invoke the <code>caseXXX</code> method for each 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.view.core.swt.test.model.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:          * @param 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.SIMPLE_TEST_OBJECT: {
88:                         final SimpleTestObject simpleTestObject = (SimpleTestObject) theEObject;
89:                         T result = caseSimpleTestObject(simpleTestObject);
90:•                        if (result == null) {
91:                                 result = defaultCase(theEObject);
92:                         }
93:                         return result;
94:                 }
95:                 case TestPackage.INNER_OBJECT: {
96:                         final InnerObject innerObject = (InnerObject) theEObject;
97:                         T result = caseInnerObject(innerObject);
98:•                        if (result == null) {
99:                                 result = defaultCase(theEObject);
100:                         }
101:                         return result;
102:                 }
103:                 default:
104:                         return defaultCase(theEObject);
105:                 }
106:         }
107:
108:         /**
109:          * Returns the result of interpreting the object as an instance of '<em>Simple Test Object</em>'.
110:          * <!-- begin-user-doc -->
111:          * This implementation returns null;
112:          * returning a non-null result will terminate the switch.
113:          * <!-- end-user-doc -->
114:          *
115:          * @param object the target of the switch.
116:          * @return the result of interpreting the object as an instance of '<em>Simple Test Object</em>'.
117:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
118:          * @generated
119:          */
120:         public T caseSimpleTestObject(SimpleTestObject object) {
121:                 return null;
122:         }
123:
124:         /**
125:          * Returns the result of interpreting the object as an instance of '<em>Inner Object</em>'.
126:          * <!-- begin-user-doc -->
127:          * This implementation returns null;
128:          * returning a non-null result will terminate the switch.
129:          * <!-- end-user-doc -->
130:          *
131:          * @param object the target of the switch.
132:          * @return the result of interpreting the object as an instance of '<em>Inner Object</em>'.
133:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
134:          * @generated
135:          */
136:         public T caseInnerObject(InnerObject object) {
137:                 return null;
138:         }
139:
140:         /**
141:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
142:          * <!-- begin-user-doc -->
143:          * This implementation returns null;
144:          * returning a non-null result will terminate the switch, but this is the last case anyway.
145:          * <!-- end-user-doc -->
146:          *
147:          * @param object the target of the switch.
148:          * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
149:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
150:          * @generated
151:          */
152:         @Override
153:         public T defaultCase(EObject object) {
154:                 return null;
155:         }
156:
157: } // TestSwitch