1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.cost.util; |
8 | |
9 | import de.uka.ipd.sdq.pcm.cost.*; |
10 | |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.ecore.EClass; |
14 | import org.eclipse.emf.ecore.EObject; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * The <b>Switch</b> for the model's inheritance hierarchy. |
19 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
20 | * to invoke the <code>caseXXX</code> method for each class of the model, |
21 | * starting with the actual class of the object |
22 | * and proceeding up the inheritance hierarchy |
23 | * until a non-null result is returned, |
24 | * which is the result of the switch. |
25 | * <!-- end-user-doc --> |
26 | * @see de.uka.ipd.sdq.pcm.cost.costPackage |
27 | * @generated |
28 | */ |
29 | public class costSwitch<T> { |
30 | /** |
31 | * The cached model package |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | protected static costPackage modelPackage; |
37 | |
38 | /** |
39 | * Creates an instance of the switch. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public costSwitch() { |
45 | if (modelPackage == null) { |
46 | modelPackage = costPackage.eINSTANCE; |
47 | } |
48 | } |
49 | |
50 | /** |
51 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
55 | * @generated |
56 | */ |
57 | public T doSwitch(EObject theEObject) { |
58 | return doSwitch(theEObject.eClass(), theEObject); |
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 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
69 | if (theEClass.eContainer() == modelPackage) { |
70 | return doSwitch(theEClass.getClassifierID(), theEObject); |
71 | } |
72 | else { |
73 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
74 | return |
75 | eSuperTypes.isEmpty() ? |
76 | defaultCase(theEObject) : |
77 | doSwitch(eSuperTypes.get(0), theEObject); |
78 | } |
79 | } |
80 | |
81 | /** |
82 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
86 | * @generated |
87 | */ |
88 | protected T doSwitch(int classifierID, EObject theEObject) { |
89 | switch (classifierID) { |
90 | case costPackage.COMPONENT_COST: { |
91 | ComponentCost componentCost = (ComponentCost)theEObject; |
92 | T result = caseComponentCost(componentCost); |
93 | if (result == null) result = caseCost(componentCost); |
94 | if (result == null) result = defaultCase(theEObject); |
95 | return result; |
96 | } |
97 | case costPackage.COST: { |
98 | Cost cost = (Cost)theEObject; |
99 | T result = caseCost(cost); |
100 | if (result == null) result = defaultCase(theEObject); |
101 | return result; |
102 | } |
103 | case costPackage.FIXED_LINKING_RESOURCE_COST: { |
104 | FixedLinkingResourceCost fixedLinkingResourceCost = (FixedLinkingResourceCost)theEObject; |
105 | T result = caseFixedLinkingResourceCost(fixedLinkingResourceCost); |
106 | if (result == null) result = caseLinkingResourceCost(fixedLinkingResourceCost); |
107 | if (result == null) result = caseCost(fixedLinkingResourceCost); |
108 | if (result == null) result = defaultCase(theEObject); |
109 | return result; |
110 | } |
111 | case costPackage.LINKING_RESOURCE_COST: { |
112 | LinkingResourceCost linkingResourceCost = (LinkingResourceCost)theEObject; |
113 | T result = caseLinkingResourceCost(linkingResourceCost); |
114 | if (result == null) result = caseCost(linkingResourceCost); |
115 | if (result == null) result = defaultCase(theEObject); |
116 | return result; |
117 | } |
118 | case costPackage.FIXED_PROCESSING_RESOURCE_COST: { |
119 | FixedProcessingResourceCost fixedProcessingResourceCost = (FixedProcessingResourceCost)theEObject; |
120 | T result = caseFixedProcessingResourceCost(fixedProcessingResourceCost); |
121 | if (result == null) result = caseProcessingResourceCost(fixedProcessingResourceCost); |
122 | if (result == null) result = caseCost(fixedProcessingResourceCost); |
123 | if (result == null) result = defaultCase(theEObject); |
124 | return result; |
125 | } |
126 | case costPackage.PROCESSING_RESOURCE_COST: { |
127 | ProcessingResourceCost processingResourceCost = (ProcessingResourceCost)theEObject; |
128 | T result = caseProcessingResourceCost(processingResourceCost); |
129 | if (result == null) result = caseCost(processingResourceCost); |
130 | if (result == null) result = defaultCase(theEObject); |
131 | return result; |
132 | } |
133 | case costPackage.VARIABLE_COST: { |
134 | VariableCost variableCost = (VariableCost)theEObject; |
135 | T result = caseVariableCost(variableCost); |
136 | if (result == null) result = caseCost(variableCost); |
137 | if (result == null) result = defaultCase(theEObject); |
138 | return result; |
139 | } |
140 | case costPackage.VARIABLE_LINKING_RESOURCE_COST: { |
141 | VariableLinkingResourceCost variableLinkingResourceCost = (VariableLinkingResourceCost)theEObject; |
142 | T result = caseVariableLinkingResourceCost(variableLinkingResourceCost); |
143 | if (result == null) result = caseVariableCost(variableLinkingResourceCost); |
144 | if (result == null) result = caseLinkingResourceCost(variableLinkingResourceCost); |
145 | if (result == null) result = caseCost(variableLinkingResourceCost); |
146 | if (result == null) result = defaultCase(theEObject); |
147 | return result; |
148 | } |
149 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST: { |
150 | VariableProcessingResourceCost variableProcessingResourceCost = (VariableProcessingResourceCost)theEObject; |
151 | T result = caseVariableProcessingResourceCost(variableProcessingResourceCost); |
152 | if (result == null) result = caseVariableCost(variableProcessingResourceCost); |
153 | if (result == null) result = caseProcessingResourceCost(variableProcessingResourceCost); |
154 | if (result == null) result = caseCost(variableProcessingResourceCost); |
155 | if (result == null) result = defaultCase(theEObject); |
156 | return result; |
157 | } |
158 | case costPackage.SCALAR_FUNCTION: { |
159 | ScalarFunction scalarFunction = (ScalarFunction)theEObject; |
160 | T result = caseScalarFunction(scalarFunction); |
161 | if (result == null) result = defaultCase(theEObject); |
162 | return result; |
163 | } |
164 | case costPackage.COST_REPOSITORY: { |
165 | CostRepository costRepository = (CostRepository)theEObject; |
166 | T result = caseCostRepository(costRepository); |
167 | if (result == null) result = defaultCase(theEObject); |
168 | return result; |
169 | } |
170 | case costPackage.COMPONENT_COST_PER_INSTANCE: { |
171 | ComponentCostPerInstance componentCostPerInstance = (ComponentCostPerInstance)theEObject; |
172 | T result = caseComponentCostPerInstance(componentCostPerInstance); |
173 | if (result == null) result = caseComponentCost(componentCostPerInstance); |
174 | if (result == null) result = caseCost(componentCostPerInstance); |
175 | if (result == null) result = defaultCase(theEObject); |
176 | return result; |
177 | } |
178 | default: return defaultCase(theEObject); |
179 | } |
180 | } |
181 | |
182 | /** |
183 | * Returns the result of interpreting the object as an instance of '<em>Component Cost</em>'. |
184 | * <!-- begin-user-doc --> |
185 | * This implementation returns null; |
186 | * returning a non-null result will terminate the switch. |
187 | * <!-- end-user-doc --> |
188 | * @param object the target of the switch. |
189 | * @return the result of interpreting the object as an instance of '<em>Component Cost</em>'. |
190 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
191 | * @generated |
192 | */ |
193 | public T caseComponentCost(ComponentCost object) { |
194 | return null; |
195 | } |
196 | |
197 | /** |
198 | * Returns the result of interpreting the object as an instance of '<em>Cost</em>'. |
199 | * <!-- begin-user-doc --> |
200 | * This implementation returns null; |
201 | * returning a non-null result will terminate the switch. |
202 | * <!-- end-user-doc --> |
203 | * @param object the target of the switch. |
204 | * @return the result of interpreting the object as an instance of '<em>Cost</em>'. |
205 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
206 | * @generated |
207 | */ |
208 | public T caseCost(Cost object) { |
209 | return null; |
210 | } |
211 | |
212 | /** |
213 | * Returns the result of interpreting the object as an instance of '<em>Fixed Linking Resource Cost</em>'. |
214 | * <!-- begin-user-doc --> |
215 | * This implementation returns null; |
216 | * returning a non-null result will terminate the switch. |
217 | * <!-- end-user-doc --> |
218 | * @param object the target of the switch. |
219 | * @return the result of interpreting the object as an instance of '<em>Fixed Linking Resource Cost</em>'. |
220 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
221 | * @generated |
222 | */ |
223 | public T caseFixedLinkingResourceCost(FixedLinkingResourceCost object) { |
224 | return null; |
225 | } |
226 | |
227 | /** |
228 | * Returns the result of interpreting the object as an instance of '<em>Linking Resource Cost</em>'. |
229 | * <!-- begin-user-doc --> |
230 | * This implementation returns null; |
231 | * returning a non-null result will terminate the switch. |
232 | * <!-- end-user-doc --> |
233 | * @param object the target of the switch. |
234 | * @return the result of interpreting the object as an instance of '<em>Linking Resource Cost</em>'. |
235 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
236 | * @generated |
237 | */ |
238 | public T caseLinkingResourceCost(LinkingResourceCost object) { |
239 | return null; |
240 | } |
241 | |
242 | /** |
243 | * Returns the result of interpreting the object as an instance of '<em>Fixed Processing Resource Cost</em>'. |
244 | * <!-- begin-user-doc --> |
245 | * This implementation returns null; |
246 | * returning a non-null result will terminate the switch. |
247 | * <!-- end-user-doc --> |
248 | * @param object the target of the switch. |
249 | * @return the result of interpreting the object as an instance of '<em>Fixed Processing Resource Cost</em>'. |
250 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
251 | * @generated |
252 | */ |
253 | public T caseFixedProcessingResourceCost(FixedProcessingResourceCost object) { |
254 | return null; |
255 | } |
256 | |
257 | /** |
258 | * Returns the result of interpreting the object as an instance of '<em>Processing Resource Cost</em>'. |
259 | * <!-- begin-user-doc --> |
260 | * This implementation returns null; |
261 | * returning a non-null result will terminate the switch. |
262 | * <!-- end-user-doc --> |
263 | * @param object the target of the switch. |
264 | * @return the result of interpreting the object as an instance of '<em>Processing Resource Cost</em>'. |
265 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
266 | * @generated |
267 | */ |
268 | public T caseProcessingResourceCost(ProcessingResourceCost object) { |
269 | return null; |
270 | } |
271 | |
272 | /** |
273 | * Returns the result of interpreting the object as an instance of '<em>Variable Cost</em>'. |
274 | * <!-- begin-user-doc --> |
275 | * This implementation returns null; |
276 | * returning a non-null result will terminate the switch. |
277 | * <!-- end-user-doc --> |
278 | * @param object the target of the switch. |
279 | * @return the result of interpreting the object as an instance of '<em>Variable Cost</em>'. |
280 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
281 | * @generated |
282 | */ |
283 | public T caseVariableCost(VariableCost object) { |
284 | return null; |
285 | } |
286 | |
287 | /** |
288 | * Returns the result of interpreting the object as an instance of '<em>Variable Linking Resource Cost</em>'. |
289 | * <!-- begin-user-doc --> |
290 | * This implementation returns null; |
291 | * returning a non-null result will terminate the switch. |
292 | * <!-- end-user-doc --> |
293 | * @param object the target of the switch. |
294 | * @return the result of interpreting the object as an instance of '<em>Variable Linking Resource Cost</em>'. |
295 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
296 | * @generated |
297 | */ |
298 | public T caseVariableLinkingResourceCost(VariableLinkingResourceCost object) { |
299 | return null; |
300 | } |
301 | |
302 | /** |
303 | * Returns the result of interpreting the object as an instance of '<em>Variable Processing Resource Cost</em>'. |
304 | * <!-- begin-user-doc --> |
305 | * This implementation returns null; |
306 | * returning a non-null result will terminate the switch. |
307 | * <!-- end-user-doc --> |
308 | * @param object the target of the switch. |
309 | * @return the result of interpreting the object as an instance of '<em>Variable Processing Resource Cost</em>'. |
310 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
311 | * @generated |
312 | */ |
313 | public T caseVariableProcessingResourceCost(VariableProcessingResourceCost object) { |
314 | return null; |
315 | } |
316 | |
317 | /** |
318 | * Returns the result of interpreting the object as an instance of '<em>Scalar Function</em>'. |
319 | * <!-- begin-user-doc --> |
320 | * This implementation returns null; |
321 | * returning a non-null result will terminate the switch. |
322 | * <!-- end-user-doc --> |
323 | * @param object the target of the switch. |
324 | * @return the result of interpreting the object as an instance of '<em>Scalar Function</em>'. |
325 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
326 | * @generated |
327 | */ |
328 | public T caseScalarFunction(ScalarFunction object) { |
329 | return null; |
330 | } |
331 | |
332 | /** |
333 | * Returns the result of interpreting the object as an instance of '<em>Cost Repository</em>'. |
334 | * <!-- begin-user-doc --> |
335 | * This implementation returns null; |
336 | * returning a non-null result will terminate the switch. |
337 | * <!-- end-user-doc --> |
338 | * @param object the target of the switch. |
339 | * @return the result of interpreting the object as an instance of '<em>Cost Repository</em>'. |
340 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
341 | * @generated |
342 | */ |
343 | public T caseCostRepository(CostRepository object) { |
344 | return null; |
345 | } |
346 | |
347 | /** |
348 | * Returns the result of interpreting the object as an instance of '<em>Component Cost Per Instance</em>'. |
349 | * <!-- begin-user-doc --> |
350 | * This implementation returns null; |
351 | * returning a non-null result will terminate the switch. |
352 | * <!-- end-user-doc --> |
353 | * @param object the target of the switch. |
354 | * @return the result of interpreting the object as an instance of '<em>Component Cost Per Instance</em>'. |
355 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
356 | * @generated |
357 | */ |
358 | public T caseComponentCostPerInstance(ComponentCostPerInstance object) { |
359 | return null; |
360 | } |
361 | |
362 | /** |
363 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
364 | * <!-- begin-user-doc --> |
365 | * This implementation returns null; |
366 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
367 | * <!-- end-user-doc --> |
368 | * @param object the target of the switch. |
369 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
370 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
371 | * @generated |
372 | */ |
373 | public T defaultCase(EObject object) { |
374 | return null; |
375 | } |
376 | |
377 | } //costSwitch |