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%
caseBook(Book)
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%
caseLibrary(Library)
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%
caseWriter(Writer)
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: 51 C: 0
0%
M: 10 C: 0
0%
M: 7 C: 0
0%
M: 17 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: * Eugen Neufeld - initial API and implementation
13: * Johannes Faltermeier
14: *
15: *******************************************************************************/
16: package org.eclipse.emf.ecp.validation.test.test.util;
17:
18: import org.eclipse.emf.ecore.EObject;
19: import org.eclipse.emf.ecore.EPackage;
20: import org.eclipse.emf.ecore.util.Switch;
21: import org.eclipse.emf.ecp.validation.test.test.Book;
22: import org.eclipse.emf.ecp.validation.test.test.Library;
23: import org.eclipse.emf.ecp.validation.test.test.TestPackage;
24: import org.eclipse.emf.ecp.validation.test.test.Writer;
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.validation.test.test.TestPackage
38: * @generated
39: */
40: public class TestSwitch<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 TestPackage modelPackage;
49:
50:         /**
51:          * Creates an instance of the switch.
52:          * <!-- begin-user-doc -->
53:          * <!-- end-user-doc -->
54:          *
55:          * @generated
56:          */
57:         public TestSwitch() {
58:•                if (modelPackage == null) {
59:                         modelPackage = TestPackage.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 TestPackage.LIBRARY: {
90:                         final Library library = (Library) theEObject;
91:                         T result = caseLibrary(library);
92:•                        if (result == null) {
93:                                 result = defaultCase(theEObject);
94:                         }
95:                         return result;
96:                 }
97:                 case TestPackage.WRITER: {
98:                         final Writer writer = (Writer) theEObject;
99:                         T result = caseWriter(writer);
100:•                        if (result == null) {
101:                                 result = defaultCase(theEObject);
102:                         }
103:                         return result;
104:                 }
105:                 case TestPackage.BOOK: {
106:                         final Book book = (Book) theEObject;
107:                         T result = caseBook(book);
108:•                        if (result == null) {
109:                                 result = defaultCase(theEObject);
110:                         }
111:                         return result;
112:                 }
113:                 default:
114:                         return defaultCase(theEObject);
115:                 }
116:         }
117:
118:         /**
119:          * Returns the result of interpreting the object as an instance of '<em>Library</em>'.
120:          * <!-- begin-user-doc -->
121:          * This implementation returns null;
122:          * returning a non-null result will terminate the switch.
123:          * <!-- end-user-doc -->
124:          *
125:          * @param object the target of the switch.
126:          * @return the result of interpreting the object as an instance of '<em>Library</em>'.
127:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
128:          * @generated
129:          */
130:         public T caseLibrary(Library object) {
131:                 return null;
132:         }
133:
134:         /**
135:          * Returns the result of interpreting the object as an instance of '<em>Writer</em>'.
136:          * <!-- begin-user-doc -->
137:          * This implementation returns null;
138:          * returning a non-null result will terminate the switch.
139:          * <!-- end-user-doc -->
140:          *
141:          * @param object the target of the switch.
142:          * @return the result of interpreting the object as an instance of '<em>Writer</em>'.
143:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
144:          * @generated
145:          */
146:         public T caseWriter(Writer object) {
147:                 return null;
148:         }
149:
150:         /**
151:          * Returns the result of interpreting the object as an instance of '<em>Book</em>'.
152:          * <!-- begin-user-doc -->
153:          * This implementation returns null;
154:          * returning a non-null result will terminate the switch.
155:          * <!-- end-user-doc -->
156:          *
157:          * @param object the target of the switch.
158:          * @return the result of interpreting the object as an instance of '<em>Book</em>'.
159:          * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
160:          * @generated
161:          */
162:         public T caseBook(Book object) {
163:                 return null;
164:         }
165:
166:         /**
167:          * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
168:          * <!-- begin-user-doc -->
169:          * This implementation returns null;
170:          * returning a non-null result will terminate the switch, but this is the last case anyway.
171:          * <!-- end-user-doc -->
172:          *
173:          * @param object the target of the switch.
174:          * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
175:          * @see #doSwitch(org.eclipse.emf.ecore.EObject)
176:          * @generated
177:          */
178:         @Override
179:         public T defaultCase(EObject object) {
180:                 return null;
181:         }
182:
183: } // TestSwitch