1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.seff_performance.util; |
7 | |
8 | import java.util.List; |
9 | |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EObject; |
12 | |
13 | import de.uka.ipd.sdq.pcm.seff.CallAction; |
14 | import de.uka.ipd.sdq.pcm.seff.seff_performance.*; |
15 | import de.uka.ipd.sdq.pcm.seff.seff_performance.InfrastructureCall; |
16 | import de.uka.ipd.sdq.pcm.seff.seff_performance.ParametricResourceDemand; |
17 | import de.uka.ipd.sdq.pcm.seff.seff_performance.ResourceCall; |
18 | import de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performancePackage; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * The <b>Switch</b> for the model's inheritance hierarchy. |
23 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
24 | * to invoke the <code>caseXXX</code> method for each class of the model, |
25 | * starting with the actual class of the object |
26 | * and proceeding up the inheritance hierarchy |
27 | * until a non-null result is returned, |
28 | * which is the result of the switch. |
29 | * <!-- end-user-doc --> |
30 | * @see de.uka.ipd.sdq.pcm.seff.seff_performance.Seff_performancePackage |
31 | * @generated |
32 | */ |
33 | public class Seff_performanceSwitch<T> { |
34 | /** |
35 | * <!-- begin-user-doc --> |
36 | * <!-- end-user-doc --> |
37 | * @generated |
38 | */ |
39 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
40 | |
41 | /** |
42 | * The cached model package |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @generated |
46 | */ |
47 | protected static Seff_performancePackage modelPackage; |
48 | |
49 | /** |
50 | * Creates an instance of the switch. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | public Seff_performanceSwitch() { |
56 | if (modelPackage == null) { |
57 | modelPackage = Seff_performancePackage.eINSTANCE; |
58 | } |
59 | } |
60 | |
61 | /** |
62 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
66 | * @generated |
67 | */ |
68 | public T doSwitch(EObject theEObject) { |
69 | return doSwitch(theEObject.eClass(), theEObject); |
70 | } |
71 | |
72 | /** |
73 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
77 | * @generated |
78 | */ |
79 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
80 | if (theEClass.eContainer() == modelPackage) { |
81 | return doSwitch(theEClass.getClassifierID(), theEObject); |
82 | } |
83 | else { |
84 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
85 | return |
86 | eSuperTypes.isEmpty() ? |
87 | defaultCase(theEObject) : |
88 | doSwitch(eSuperTypes.get(0), theEObject); |
89 | } |
90 | } |
91 | |
92 | /** |
93 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
97 | * @generated |
98 | */ |
99 | protected T doSwitch(int classifierID, EObject theEObject) { |
100 | switch (classifierID) { |
101 | case Seff_performancePackage.INFRASTRUCTURE_CALL: { |
102 | InfrastructureCall infrastructureCall = (InfrastructureCall)theEObject; |
103 | T result = caseInfrastructureCall(infrastructureCall); |
104 | if (result == null) result = caseCallAction(infrastructureCall); |
105 | if (result == null) result = defaultCase(theEObject); |
106 | return result; |
107 | } |
108 | case Seff_performancePackage.RESOURCE_CALL: { |
109 | ResourceCall resourceCall = (ResourceCall)theEObject; |
110 | T result = caseResourceCall(resourceCall); |
111 | if (result == null) result = caseCallAction(resourceCall); |
112 | if (result == null) result = defaultCase(theEObject); |
113 | return result; |
114 | } |
115 | case Seff_performancePackage.PARAMETRIC_RESOURCE_DEMAND: { |
116 | ParametricResourceDemand parametricResourceDemand = (ParametricResourceDemand)theEObject; |
117 | T result = caseParametricResourceDemand(parametricResourceDemand); |
118 | if (result == null) result = defaultCase(theEObject); |
119 | return result; |
120 | } |
121 | default: return defaultCase(theEObject); |
122 | } |
123 | } |
124 | |
125 | /** |
126 | * Returns the result of interpreting the object as an instance of '<em>Infrastructure Call</em>'. |
127 | * <!-- begin-user-doc --> |
128 | * This implementation returns null; |
129 | * returning a non-null result will terminate the switch. |
130 | * <!-- end-user-doc --> |
131 | * @param object the target of the switch. |
132 | * @return the result of interpreting the object as an instance of '<em>Infrastructure Call</em>'. |
133 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
134 | * @generated |
135 | */ |
136 | public T caseInfrastructureCall(InfrastructureCall object) { |
137 | return null; |
138 | } |
139 | |
140 | /** |
141 | * Returns the result of interpreting the object as an instance of '<em>Resource Call</em>'. |
142 | * <!-- begin-user-doc --> |
143 | * This implementation returns null; |
144 | * returning a non-null result will terminate the switch. |
145 | * <!-- end-user-doc --> |
146 | * @param object the target of the switch. |
147 | * @return the result of interpreting the object as an instance of '<em>Resource Call</em>'. |
148 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
149 | * @generated |
150 | */ |
151 | public T caseResourceCall(ResourceCall object) { |
152 | return null; |
153 | } |
154 | |
155 | /** |
156 | * Returns the result of interpreting the object as an instance of '<em>Parametric Resource Demand</em>'. |
157 | * <!-- begin-user-doc --> |
158 | * This implementation returns null; |
159 | * returning a non-null result will terminate the switch. |
160 | * <!-- end-user-doc --> |
161 | * @param object the target of the switch. |
162 | * @return the result of interpreting the object as an instance of '<em>Parametric Resource Demand</em>'. |
163 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
164 | * @generated |
165 | */ |
166 | public T caseParametricResourceDemand(ParametricResourceDemand object) { |
167 | return null; |
168 | } |
169 | |
170 | /** |
171 | * Returns the result of interpreting the object as an instance of '<em>Call Action</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 | * @param object the target of the switch. |
177 | * @return the result of interpreting the object as an instance of '<em>Call Action</em>'. |
178 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
179 | * @generated |
180 | */ |
181 | public T caseCallAction(CallAction object) { |
182 | return null; |
183 | } |
184 | |
185 | /** |
186 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
187 | * <!-- begin-user-doc --> |
188 | * This implementation returns null; |
189 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
190 | * <!-- end-user-doc --> |
191 | * @param object the target of the switch. |
192 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
193 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
194 | * @generated |
195 | */ |
196 | public T defaultCase(EObject object) { |
197 | return null; |
198 | } |
199 | |
200 | } //Seff_performanceSwitch |