Skip to content

Package: StackSwitch

StackSwitch

nameinstructionbranchcomplexitylinemethod
StackSwitch()
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%
caseContainedElement(VContainedElement)
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(VContainer)
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%
caseElement(VElement)
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%
caseStackItem(VStackItem)
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%
caseStackLayout(VStackLayout)
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: 28 C: 32
53%
M: 7 C: 8
53%
M: 7 C: 2
22%
M: 7 C: 13
65%
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-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.spi.stack.model.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.spi.model.VContainedElement;
20: import org.eclipse.emf.ecp.view.spi.model.VContainer;
21: import org.eclipse.emf.ecp.view.spi.model.VElement;
22: import org.eclipse.emf.ecp.view.spi.stack.model.VStackItem;
23: import org.eclipse.emf.ecp.view.spi.stack.model.VStackLayout;
24: import org.eclipse.emf.ecp.view.spi.stack.model.VStackPackage;
25:
26: /**
27: * <!-- begin-user-doc -->
28: * The <b>Switch</b> for the model's inheritance hierarchy.
29: * It supports the call {@link #doSwitch(EObject) doSwitch(object)} to invoke the <code>caseXXX</code> method for each
30: * class of the model,
31: * starting with the actual class of the object
32: * and proceeding up the inheritance hierarchy
33: * until a non-null result is returned,
34: * which is the result of the switch.
35: * <!-- end-user-doc -->
36: *
37: * @see org.eclipse.emf.ecp.view.spi.stack.model.VStackPackage
38: * @generated
39: */
40: public class StackSwitch<T> extends Switch<T> {
41:         /**
42:          * The cached model package
43:          * <!-- begin-user-doc -->
44:          * <!-- end-user-doc -->
45:          *
46:          * @generated
47:          */
48:         protected static VStackPackage modelPackage;
49:
50:         /**
51:          * Creates an instance of the switch.
52:          * <!-- begin-user-doc -->
53:          * <!-- end-user-doc -->
54:          *
55:          * @generated
56:          */
57:         public StackSwitch() {
58:•                if (modelPackage == null) {
59:                         modelPackage = VStackPackage.eINSTANCE;
60:                 }
61:         }
62:
63:         /**
64:          * Checks whether this is a switch for the given package.
65:          * <!-- begin-user-doc -->
66:          * <!-- end-user-doc -->
67:          *
68:          * @parameter ePackage the package in question.
69:          * @return whether this is a switch for the given package.
70:          * @generated
71:          */
72:         @Override
73:         protected boolean isSwitchFor(EPackage ePackage) {
74:•                return ePackage == modelPackage;
75:         }
76:
77:         /**
78:          * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that
79:          * result.
80:          * <!-- begin-user-doc -->
81:          * <!-- end-user-doc -->
82:          *
83:          * @return the first non-null result returned by a <code>caseXXX</code> call.
84:          * @generated
85:          */
86:         @Override
87:         protected T doSwitch(int classifierID, EObject theEObject) {
88:•                switch (classifierID) {
89:                 case VStackPackage.STACK_LAYOUT: {
90:                         final VStackLayout stackLayout = (VStackLayout) theEObject;
91:                         T result = caseStackLayout(stackLayout);
92:•                        if (result == null) {
93:                                 result = caseContainedElement(stackLayout);
94:                         }
95:•                        if (result == null) {
96:                                 result = caseElement(stackLayout);
97:                         }
98:•                        if (result == null) {
99:                                 result = defaultCase(theEObject);
100:                         }
101:                         return result;
102:                 }
103:                 case VStackPackage.STACK_ITEM: {
104:                         final VStackItem stackItem = (VStackItem) theEObject;
105:                         T result = caseStackItem(stackItem);
106:•                        if (result == null) {
107:                                 result = caseContainer(stackItem);
108:                         }
109:•                        if (result == null) {
110:                                 result = caseElement(stackItem);
111:                         }
112:•                        if (result == null) {
113:                                 result = defaultCase(theEObject);
114:                         }
115:                         return result;
116:                 }
117:                 default:
118:                         return defaultCase(theEObject);
119:                 }
120:         }
121:
122:         /**
123:          * Returns the result of interpreting the object as an instance of '<em>Layout</em>'.
124:          * <!-- begin-user-doc -->
125:          * This implementation returns null;
126:          * returning a non-null result will terminate the switch.
127:          * <!-- end-user-doc -->
128:          *
129:          * @param object the target of the switch.
130:          * @return the result of interpreting the object as an instance of '<em>Layout</em>'.
131:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
132:          * @generated
133:          */
134:         public T caseStackLayout(VStackLayout object) {
135:                 return null;
136:         }
137:
138:         /**
139:          * Returns the result of interpreting the object as an instance of '<em>Item</em>'.
140:          * <!-- begin-user-doc -->
141:          * This implementation returns null;
142:          * returning a non-null result will terminate the switch.
143:          * <!-- end-user-doc -->
144:          *
145:          * @param object the target of the switch.
146:          * @return the result of interpreting the object as an instance of '<em>Item</em>'.
147:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
148:          * @generated
149:          */
150:         public T caseStackItem(VStackItem object) {
151:                 return null;
152:         }
153:
154:         /**
155:          * Returns the result of interpreting the object as an instance of '<em>Element</em>'.
156:          * <!-- begin-user-doc -->
157:          * This implementation returns null;
158:          * returning a non-null result will terminate the switch.
159:          * <!-- end-user-doc -->
160:          *
161:          * @param object the target of the switch.
162:          * @return the result of interpreting the object as an instance of '<em>Element</em>'.
163:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
164:          * @generated
165:          */
166:         public T caseElement(VElement object) {
167:                 return null;
168:         }
169:
170:         /**
171:          * Returns the result of interpreting the object as an instance of '<em>Contained Element</em>'.
172:          * <!-- begin-user-doc -->
173:          * This implementation returns null;
174:          * returning a non-null result will terminate the switch.
175:          * <!-- end-user-doc -->
176:          *
177:          * @param object the target of the switch.
178:          * @return the result of interpreting the object as an instance of '<em>Contained Element</em>'.
179:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
180:          * @generated
181:          */
182:         public T caseContainedElement(VContainedElement object) {
183:                 return null;
184:         }
185:
186:         /**
187:          * Returns the result of interpreting the object as an instance of '<em>Container</em>'.
188:          * <!-- begin-user-doc -->
189:          * This implementation returns null;
190:          * returning a non-null result will terminate the switch.
191:          * <!-- end-user-doc -->
192:          *
193:          * @param object the target of the switch.
194:          * @return the result of interpreting the object as an instance of '<em>Container</em>'.
195:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
196:          * @generated
197:          */
198:         public T caseContainer(VContainer object) {
199:                 return null;
200:         }
201:
202:         /**
203:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
204:          * <!-- begin-user-doc -->
205:          * This implementation returns null;
206:          * returning a non-null result will terminate the switch, but this is the last case anyway.
207:          * <!-- end-user-doc -->
208:          *
209:          * @param object the target of the switch.
210:          * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
211:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
212:          * @generated
213:          */
214:         @Override
215:         public T defaultCase(EObject object) {
216:                 return null;
217:         }
218:
219: } // StackSwitch