1 | /** |
2 | * Copyright SDQ, IPD, U Karlsruhe, 2007 |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.completions.util; |
7 | |
8 | import de.uka.ipd.sdq.completions.*; |
9 | import java.util.List; |
10 | |
11 | import org.eclipse.emf.ecore.EClass; |
12 | import org.eclipse.emf.ecore.EObject; |
13 | |
14 | import de.uka.ipd.sdq.completions.Completion; |
15 | import de.uka.ipd.sdq.completions.CompletionRepository; |
16 | import de.uka.ipd.sdq.completions.CompletionsPackage; |
17 | import de.uka.ipd.sdq.completions.DelegatingExternalCallAction; |
18 | import de.uka.ipd.sdq.identifier.Identifier; |
19 | import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure; |
20 | import de.uka.ipd.sdq.pcm.core.entity.ComposedProvidingRequiringEntity; |
21 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
22 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingEntity; |
23 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingRequiringEntity; |
24 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceRequiringEntity; |
25 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
26 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceRequiringEntity; |
27 | import de.uka.ipd.sdq.pcm.repository.ImplementationComponentType; |
28 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
29 | import de.uka.ipd.sdq.pcm.seff.AbstractAction; |
30 | import de.uka.ipd.sdq.pcm.seff.CallAction; |
31 | import de.uka.ipd.sdq.pcm.seff.CallReturnAction; |
32 | import de.uka.ipd.sdq.pcm.seff.ExternalCallAction; |
33 | import de.uka.ipd.sdq.pcm.seff.seff_reliability.FailureHandlingEntity; |
34 | |
35 | /** |
36 | * <!-- begin-user-doc --> |
37 | * The <b>Switch</b> for the model's inheritance hierarchy. |
38 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
39 | * to invoke the <code>caseXXX</code> method for each class of the model, |
40 | * starting with the actual class of the object |
41 | * and proceeding up the inheritance hierarchy |
42 | * until a non-null result is returned, |
43 | * which is the result of the switch. |
44 | * <!-- end-user-doc --> |
45 | * @see de.uka.ipd.sdq.completions.CompletionsPackage |
46 | * @generated |
47 | */ |
48 | public class CompletionsSwitch<T> { |
49 | /** |
50 | * The cached model package |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @generated |
54 | */ |
55 | protected static CompletionsPackage modelPackage; |
56 | |
57 | /** |
58 | * Creates an instance of the switch. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @generated |
62 | */ |
63 | public CompletionsSwitch() { |
64 | if (modelPackage == null) { |
65 | modelPackage = CompletionsPackage.eINSTANCE; |
66 | } |
67 | } |
68 | |
69 | /** |
70 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
74 | * @generated |
75 | */ |
76 | public T doSwitch(EObject theEObject) { |
77 | return doSwitch(theEObject.eClass(), theEObject); |
78 | } |
79 | |
80 | /** |
81 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
82 | * <!-- begin-user-doc --> |
83 | * <!-- end-user-doc --> |
84 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
85 | * @generated |
86 | */ |
87 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
88 | if (theEClass.eContainer() == modelPackage) { |
89 | return doSwitch(theEClass.getClassifierID(), theEObject); |
90 | } |
91 | else { |
92 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
93 | return |
94 | eSuperTypes.isEmpty() ? |
95 | defaultCase(theEObject) : |
96 | doSwitch(eSuperTypes.get(0), theEObject); |
97 | } |
98 | } |
99 | |
100 | /** |
101 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
102 | * <!-- begin-user-doc --> |
103 | * <!-- end-user-doc --> |
104 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
105 | * @generated |
106 | */ |
107 | protected T doSwitch(int classifierID, EObject theEObject) { |
108 | switch (classifierID) { |
109 | case CompletionsPackage.COMPLETION: { |
110 | Completion completion = (Completion)theEObject; |
111 | T result = caseCompletion(completion); |
112 | if (result == null) result = caseComposedProvidingRequiringEntity(completion); |
113 | if (result == null) result = caseImplementationComponentType(completion); |
114 | if (result == null) result = caseComposedStructure(completion); |
115 | if (result == null) result = caseRepositoryComponent(completion); |
116 | if (result == null) result = caseInterfaceProvidingRequiringEntity(completion); |
117 | if (result == null) result = caseInterfaceProvidingEntity(completion); |
118 | if (result == null) result = caseInterfaceRequiringEntity(completion); |
119 | if (result == null) result = caseIdentifier(completion); |
120 | if (result == null) result = caseNamedElement(completion); |
121 | if (result == null) result = caseResourceInterfaceRequiringEntity(completion); |
122 | if (result == null) result = caseEntity(completion); |
123 | if (result == null) result = defaultCase(theEObject); |
124 | return result; |
125 | } |
126 | case CompletionsPackage.COMPLETION_REPOSITORY: { |
127 | CompletionRepository completionRepository = (CompletionRepository)theEObject; |
128 | T result = caseCompletionRepository(completionRepository); |
129 | if (result == null) result = defaultCase(theEObject); |
130 | return result; |
131 | } |
132 | case CompletionsPackage.DELEGATING_EXTERNAL_CALL_ACTION: { |
133 | DelegatingExternalCallAction delegatingExternalCallAction = (DelegatingExternalCallAction)theEObject; |
134 | T result = caseDelegatingExternalCallAction(delegatingExternalCallAction); |
135 | if (result == null) result = caseExternalCallAction(delegatingExternalCallAction); |
136 | if (result == null) result = caseAbstractAction(delegatingExternalCallAction); |
137 | if (result == null) result = caseCallReturnAction(delegatingExternalCallAction); |
138 | if (result == null) result = caseFailureHandlingEntity(delegatingExternalCallAction); |
139 | if (result == null) result = caseEntity(delegatingExternalCallAction); |
140 | if (result == null) result = caseCallAction(delegatingExternalCallAction); |
141 | if (result == null) result = caseIdentifier(delegatingExternalCallAction); |
142 | if (result == null) result = caseNamedElement(delegatingExternalCallAction); |
143 | if (result == null) result = defaultCase(theEObject); |
144 | return result; |
145 | } |
146 | default: return defaultCase(theEObject); |
147 | } |
148 | } |
149 | |
150 | /** |
151 | * Returns the result of interpreting the object as an instance of '<em>Completion</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 | * @param object the target of the switch. |
157 | * @return the result of interpreting the object as an instance of '<em>Completion</em>'. |
158 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
159 | * @generated |
160 | */ |
161 | public T caseCompletion(Completion object) { |
162 | return null; |
163 | } |
164 | |
165 | /** |
166 | * Returns the result of interpreting the object as an instance of '<em>Completion Repository</em>'. |
167 | * <!-- begin-user-doc --> |
168 | * This implementation returns null; |
169 | * returning a non-null result will terminate the switch. |
170 | * <!-- end-user-doc --> |
171 | * @param object the target of the switch. |
172 | * @return the result of interpreting the object as an instance of '<em>Completion Repository</em>'. |
173 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
174 | * @generated |
175 | */ |
176 | public T caseCompletionRepository(CompletionRepository object) { |
177 | return null; |
178 | } |
179 | |
180 | /** |
181 | * Returns the result of interpreting the object as an instance of '<em>Delegating External Call Action</em>'. |
182 | * <!-- begin-user-doc --> |
183 | * This implementation returns null; |
184 | * returning a non-null result will terminate the switch. |
185 | * <!-- end-user-doc --> |
186 | * @param object the target of the switch. |
187 | * @return the result of interpreting the object as an instance of '<em>Delegating External Call Action</em>'. |
188 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
189 | * @generated |
190 | */ |
191 | public T caseDelegatingExternalCallAction(DelegatingExternalCallAction object) { |
192 | return null; |
193 | } |
194 | |
195 | /** |
196 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
197 | * <!-- begin-user-doc --> |
198 | * This implementation returns null; |
199 | * returning a non-null result will terminate the switch. |
200 | * <!-- end-user-doc --> |
201 | * @param object the target of the switch. |
202 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
203 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
204 | * @generated |
205 | */ |
206 | public T caseIdentifier(Identifier object) { |
207 | return null; |
208 | } |
209 | |
210 | /** |
211 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
212 | * <!-- begin-user-doc --> |
213 | * This implementation returns null; |
214 | * returning a non-null result will terminate the switch. |
215 | * <!-- end-user-doc --> |
216 | * @param object the target of the switch. |
217 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
218 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
219 | * @generated |
220 | */ |
221 | public T caseNamedElement(NamedElement object) { |
222 | return null; |
223 | } |
224 | |
225 | /** |
226 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
227 | * <!-- begin-user-doc --> |
228 | * This implementation returns null; |
229 | * returning a non-null result will terminate the switch. |
230 | * <!-- end-user-doc --> |
231 | * @param object the target of the switch. |
232 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
233 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
234 | * @generated |
235 | */ |
236 | public T caseEntity(Entity object) { |
237 | return null; |
238 | } |
239 | |
240 | /** |
241 | * Returns the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
242 | * <!-- begin-user-doc --> |
243 | * This implementation returns null; |
244 | * returning a non-null result will terminate the switch. |
245 | * <!-- end-user-doc --> |
246 | * @param object the target of the switch. |
247 | * @return the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
248 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
249 | * @generated |
250 | */ |
251 | public T caseComposedStructure(ComposedStructure object) { |
252 | return null; |
253 | } |
254 | |
255 | /** |
256 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
257 | * <!-- begin-user-doc --> |
258 | * This implementation returns null; |
259 | * returning a non-null result will terminate the switch. |
260 | * <!-- end-user-doc --> |
261 | * @param object the target of the switch. |
262 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
263 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
264 | * @generated |
265 | */ |
266 | public T caseInterfaceProvidingEntity(InterfaceProvidingEntity object) { |
267 | return null; |
268 | } |
269 | |
270 | /** |
271 | * Returns the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
272 | * <!-- begin-user-doc --> |
273 | * This implementation returns null; |
274 | * returning a non-null result will terminate the switch. |
275 | * <!-- end-user-doc --> |
276 | * @param object the target of the switch. |
277 | * @return the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
278 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
279 | * @generated |
280 | */ |
281 | public T caseInterfaceRequiringEntity(InterfaceRequiringEntity object) { |
282 | return null; |
283 | } |
284 | |
285 | /** |
286 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
287 | * <!-- begin-user-doc --> |
288 | * This implementation returns null; |
289 | * returning a non-null result will terminate the switch. |
290 | * <!-- end-user-doc --> |
291 | * @param object the target of the switch. |
292 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
293 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
294 | * @generated |
295 | */ |
296 | public T caseResourceInterfaceRequiringEntity(ResourceInterfaceRequiringEntity object) { |
297 | return null; |
298 | } |
299 | |
300 | /** |
301 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
302 | * <!-- begin-user-doc --> |
303 | * This implementation returns null; |
304 | * returning a non-null result will terminate the switch. |
305 | * <!-- end-user-doc --> |
306 | * @param object the target of the switch. |
307 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
308 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
309 | * @generated |
310 | */ |
311 | public T caseInterfaceProvidingRequiringEntity(InterfaceProvidingRequiringEntity object) { |
312 | return null; |
313 | } |
314 | |
315 | /** |
316 | * Returns the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
317 | * <!-- begin-user-doc --> |
318 | * This implementation returns null; |
319 | * returning a non-null result will terminate the switch. |
320 | * <!-- end-user-doc --> |
321 | * @param object the target of the switch. |
322 | * @return the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
323 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
324 | * @generated |
325 | */ |
326 | public T caseComposedProvidingRequiringEntity(ComposedProvidingRequiringEntity object) { |
327 | return null; |
328 | } |
329 | |
330 | /** |
331 | * Returns the result of interpreting the object as an instance of '<em>Component</em>'. |
332 | * <!-- begin-user-doc --> |
333 | * This implementation returns null; |
334 | * returning a non-null result will terminate the switch. |
335 | * <!-- end-user-doc --> |
336 | * @param object the target of the switch. |
337 | * @return the result of interpreting the object as an instance of '<em>Component</em>'. |
338 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
339 | * @generated |
340 | */ |
341 | public T caseRepositoryComponent(RepositoryComponent object) { |
342 | return null; |
343 | } |
344 | |
345 | /** |
346 | * Returns the result of interpreting the object as an instance of '<em>Implementation Component Type</em>'. |
347 | * <!-- begin-user-doc --> |
348 | * This implementation returns null; |
349 | * returning a non-null result will terminate the switch. |
350 | * <!-- end-user-doc --> |
351 | * @param object the target of the switch. |
352 | * @return the result of interpreting the object as an instance of '<em>Implementation Component Type</em>'. |
353 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
354 | * @generated |
355 | */ |
356 | public T caseImplementationComponentType(ImplementationComponentType object) { |
357 | return null; |
358 | } |
359 | |
360 | /** |
361 | * Returns the result of interpreting the object as an instance of '<em>Abstract Action</em>'. |
362 | * <!-- begin-user-doc --> |
363 | * This implementation returns null; |
364 | * returning a non-null result will terminate the switch. |
365 | * <!-- end-user-doc --> |
366 | * @param object the target of the switch. |
367 | * @return the result of interpreting the object as an instance of '<em>Abstract Action</em>'. |
368 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
369 | * @generated |
370 | */ |
371 | public T caseAbstractAction(AbstractAction object) { |
372 | return null; |
373 | } |
374 | |
375 | /** |
376 | * Returns the result of interpreting the object as an instance of '<em>Call Action</em>'. |
377 | * <!-- begin-user-doc --> |
378 | * This implementation returns null; |
379 | * returning a non-null result will terminate the switch. |
380 | * <!-- end-user-doc --> |
381 | * @param object the target of the switch. |
382 | * @return the result of interpreting the object as an instance of '<em>Call Action</em>'. |
383 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
384 | * @generated |
385 | */ |
386 | public T caseCallAction(CallAction object) { |
387 | return null; |
388 | } |
389 | |
390 | /** |
391 | * Returns the result of interpreting the object as an instance of '<em>Call Return Action</em>'. |
392 | * <!-- begin-user-doc --> |
393 | * This implementation returns null; |
394 | * returning a non-null result will terminate the switch. |
395 | * <!-- end-user-doc --> |
396 | * @param object the target of the switch. |
397 | * @return the result of interpreting the object as an instance of '<em>Call Return Action</em>'. |
398 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
399 | * @generated |
400 | */ |
401 | public T caseCallReturnAction(CallReturnAction object) { |
402 | return null; |
403 | } |
404 | |
405 | /** |
406 | * Returns the result of interpreting the object as an instance of '<em>Failure Handling Entity</em>'. |
407 | * <!-- begin-user-doc --> |
408 | * This implementation returns null; |
409 | * returning a non-null result will terminate the switch. |
410 | * <!-- end-user-doc --> |
411 | * @param object the target of the switch. |
412 | * @return the result of interpreting the object as an instance of '<em>Failure Handling Entity</em>'. |
413 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
414 | * @generated |
415 | */ |
416 | public T caseFailureHandlingEntity(FailureHandlingEntity object) { |
417 | return null; |
418 | } |
419 | |
420 | /** |
421 | * Returns the result of interpreting the object as an instance of '<em>External Call Action</em>'. |
422 | * <!-- begin-user-doc --> |
423 | * This implementation returns null; |
424 | * returning a non-null result will terminate the switch. |
425 | * <!-- end-user-doc --> |
426 | * @param object the target of the switch. |
427 | * @return the result of interpreting the object as an instance of '<em>External Call Action</em>'. |
428 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
429 | * @generated |
430 | */ |
431 | public T caseExternalCallAction(ExternalCallAction object) { |
432 | return null; |
433 | } |
434 | |
435 | /** |
436 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
437 | * <!-- begin-user-doc --> |
438 | * This implementation returns null; |
439 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
440 | * <!-- end-user-doc --> |
441 | * @param object the target of the switch. |
442 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
443 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
444 | * @generated |
445 | */ |
446 | public T defaultCase(EObject object) { |
447 | return null; |
448 | } |
449 | |
450 | } //CompletionsSwitch |