1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.usagemodel.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.identifier.Identifier; |
14 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
15 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
16 | import de.uka.ipd.sdq.pcm.usagemodel.*; |
17 | import de.uka.ipd.sdq.pcm.usagemodel.AbstractUserAction; |
18 | import de.uka.ipd.sdq.pcm.usagemodel.Branch; |
19 | import de.uka.ipd.sdq.pcm.usagemodel.BranchTransition; |
20 | import de.uka.ipd.sdq.pcm.usagemodel.ClosedWorkload; |
21 | import de.uka.ipd.sdq.pcm.usagemodel.Delay; |
22 | import de.uka.ipd.sdq.pcm.usagemodel.EntryLevelSystemCall; |
23 | import de.uka.ipd.sdq.pcm.usagemodel.Loop; |
24 | import de.uka.ipd.sdq.pcm.usagemodel.OpenWorkload; |
25 | import de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour; |
26 | import de.uka.ipd.sdq.pcm.usagemodel.Start; |
27 | import de.uka.ipd.sdq.pcm.usagemodel.Stop; |
28 | import de.uka.ipd.sdq.pcm.usagemodel.UsageModel; |
29 | import de.uka.ipd.sdq.pcm.usagemodel.UsageScenario; |
30 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
31 | import de.uka.ipd.sdq.pcm.usagemodel.UserData; |
32 | import de.uka.ipd.sdq.pcm.usagemodel.Workload; |
33 | |
34 | /** |
35 | * <!-- begin-user-doc --> |
36 | * The <b>Switch</b> for the model's inheritance hierarchy. |
37 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
38 | * to invoke the <code>caseXXX</code> method for each class of the model, |
39 | * starting with the actual class of the object |
40 | * and proceeding up the inheritance hierarchy |
41 | * until a non-null result is returned, |
42 | * which is the result of the switch. |
43 | * <!-- end-user-doc --> |
44 | * @see de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage |
45 | * @generated |
46 | */ |
47 | public class UsagemodelSwitch<T> { |
48 | /** |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
54 | |
55 | /** |
56 | * The cached model package |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | protected static UsagemodelPackage modelPackage; |
62 | |
63 | /** |
64 | * Creates an instance of the switch. |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @generated |
68 | */ |
69 | public UsagemodelSwitch() { |
70 | if (modelPackage == null) { |
71 | modelPackage = UsagemodelPackage.eINSTANCE; |
72 | } |
73 | } |
74 | |
75 | /** |
76 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
77 | * <!-- begin-user-doc --> |
78 | * <!-- end-user-doc --> |
79 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
80 | * @generated |
81 | */ |
82 | public T doSwitch(EObject theEObject) { |
83 | return doSwitch(theEObject.eClass(), theEObject); |
84 | } |
85 | |
86 | /** |
87 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
88 | * <!-- begin-user-doc --> |
89 | * <!-- end-user-doc --> |
90 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
91 | * @generated |
92 | */ |
93 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
94 | if (theEClass.eContainer() == modelPackage) { |
95 | return doSwitch(theEClass.getClassifierID(), theEObject); |
96 | } |
97 | else { |
98 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
99 | return |
100 | eSuperTypes.isEmpty() ? |
101 | defaultCase(theEObject) : |
102 | doSwitch(eSuperTypes.get(0), theEObject); |
103 | } |
104 | } |
105 | |
106 | /** |
107 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
108 | * <!-- begin-user-doc --> |
109 | * <!-- end-user-doc --> |
110 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
111 | * @generated |
112 | */ |
113 | protected T doSwitch(int classifierID, EObject theEObject) { |
114 | switch (classifierID) { |
115 | case UsagemodelPackage.WORKLOAD: { |
116 | Workload workload = (Workload)theEObject; |
117 | T result = caseWorkload(workload); |
118 | if (result == null) result = defaultCase(theEObject); |
119 | return result; |
120 | } |
121 | case UsagemodelPackage.USAGE_SCENARIO: { |
122 | UsageScenario usageScenario = (UsageScenario)theEObject; |
123 | T result = caseUsageScenario(usageScenario); |
124 | if (result == null) result = caseEntity(usageScenario); |
125 | if (result == null) result = caseIdentifier(usageScenario); |
126 | if (result == null) result = caseNamedElement(usageScenario); |
127 | if (result == null) result = defaultCase(theEObject); |
128 | return result; |
129 | } |
130 | case UsagemodelPackage.USER_DATA: { |
131 | UserData userData = (UserData)theEObject; |
132 | T result = caseUserData(userData); |
133 | if (result == null) result = defaultCase(theEObject); |
134 | return result; |
135 | } |
136 | case UsagemodelPackage.USAGE_MODEL: { |
137 | UsageModel usageModel = (UsageModel)theEObject; |
138 | T result = caseUsageModel(usageModel); |
139 | if (result == null) result = defaultCase(theEObject); |
140 | return result; |
141 | } |
142 | case UsagemodelPackage.ENTRY_LEVEL_SYSTEM_CALL: { |
143 | EntryLevelSystemCall entryLevelSystemCall = (EntryLevelSystemCall)theEObject; |
144 | T result = caseEntryLevelSystemCall(entryLevelSystemCall); |
145 | if (result == null) result = caseAbstractUserAction(entryLevelSystemCall); |
146 | if (result == null) result = caseEntity(entryLevelSystemCall); |
147 | if (result == null) result = caseIdentifier(entryLevelSystemCall); |
148 | if (result == null) result = caseNamedElement(entryLevelSystemCall); |
149 | if (result == null) result = defaultCase(theEObject); |
150 | return result; |
151 | } |
152 | case UsagemodelPackage.ABSTRACT_USER_ACTION: { |
153 | AbstractUserAction abstractUserAction = (AbstractUserAction)theEObject; |
154 | T result = caseAbstractUserAction(abstractUserAction); |
155 | if (result == null) result = caseEntity(abstractUserAction); |
156 | if (result == null) result = caseIdentifier(abstractUserAction); |
157 | if (result == null) result = caseNamedElement(abstractUserAction); |
158 | if (result == null) result = defaultCase(theEObject); |
159 | return result; |
160 | } |
161 | case UsagemodelPackage.SCENARIO_BEHAVIOUR: { |
162 | ScenarioBehaviour scenarioBehaviour = (ScenarioBehaviour)theEObject; |
163 | T result = caseScenarioBehaviour(scenarioBehaviour); |
164 | if (result == null) result = caseEntity(scenarioBehaviour); |
165 | if (result == null) result = caseIdentifier(scenarioBehaviour); |
166 | if (result == null) result = caseNamedElement(scenarioBehaviour); |
167 | if (result == null) result = defaultCase(theEObject); |
168 | return result; |
169 | } |
170 | case UsagemodelPackage.BRANCH_TRANSITION: { |
171 | BranchTransition branchTransition = (BranchTransition)theEObject; |
172 | T result = caseBranchTransition(branchTransition); |
173 | if (result == null) result = defaultCase(theEObject); |
174 | return result; |
175 | } |
176 | case UsagemodelPackage.BRANCH: { |
177 | Branch branch = (Branch)theEObject; |
178 | T result = caseBranch(branch); |
179 | if (result == null) result = caseAbstractUserAction(branch); |
180 | if (result == null) result = caseEntity(branch); |
181 | if (result == null) result = caseIdentifier(branch); |
182 | if (result == null) result = caseNamedElement(branch); |
183 | if (result == null) result = defaultCase(theEObject); |
184 | return result; |
185 | } |
186 | case UsagemodelPackage.LOOP: { |
187 | Loop loop = (Loop)theEObject; |
188 | T result = caseLoop(loop); |
189 | if (result == null) result = caseAbstractUserAction(loop); |
190 | if (result == null) result = caseEntity(loop); |
191 | if (result == null) result = caseIdentifier(loop); |
192 | if (result == null) result = caseNamedElement(loop); |
193 | if (result == null) result = defaultCase(theEObject); |
194 | return result; |
195 | } |
196 | case UsagemodelPackage.STOP: { |
197 | Stop stop = (Stop)theEObject; |
198 | T result = caseStop(stop); |
199 | if (result == null) result = caseAbstractUserAction(stop); |
200 | if (result == null) result = caseEntity(stop); |
201 | if (result == null) result = caseIdentifier(stop); |
202 | if (result == null) result = caseNamedElement(stop); |
203 | if (result == null) result = defaultCase(theEObject); |
204 | return result; |
205 | } |
206 | case UsagemodelPackage.START: { |
207 | Start start = (Start)theEObject; |
208 | T result = caseStart(start); |
209 | if (result == null) result = caseAbstractUserAction(start); |
210 | if (result == null) result = caseEntity(start); |
211 | if (result == null) result = caseIdentifier(start); |
212 | if (result == null) result = caseNamedElement(start); |
213 | if (result == null) result = defaultCase(theEObject); |
214 | return result; |
215 | } |
216 | case UsagemodelPackage.OPEN_WORKLOAD: { |
217 | OpenWorkload openWorkload = (OpenWorkload)theEObject; |
218 | T result = caseOpenWorkload(openWorkload); |
219 | if (result == null) result = caseWorkload(openWorkload); |
220 | if (result == null) result = defaultCase(theEObject); |
221 | return result; |
222 | } |
223 | case UsagemodelPackage.DELAY: { |
224 | Delay delay = (Delay)theEObject; |
225 | T result = caseDelay(delay); |
226 | if (result == null) result = caseAbstractUserAction(delay); |
227 | if (result == null) result = caseEntity(delay); |
228 | if (result == null) result = caseIdentifier(delay); |
229 | if (result == null) result = caseNamedElement(delay); |
230 | if (result == null) result = defaultCase(theEObject); |
231 | return result; |
232 | } |
233 | case UsagemodelPackage.CLOSED_WORKLOAD: { |
234 | ClosedWorkload closedWorkload = (ClosedWorkload)theEObject; |
235 | T result = caseClosedWorkload(closedWorkload); |
236 | if (result == null) result = caseWorkload(closedWorkload); |
237 | if (result == null) result = defaultCase(theEObject); |
238 | return result; |
239 | } |
240 | default: return defaultCase(theEObject); |
241 | } |
242 | } |
243 | |
244 | /** |
245 | * Returns the result of interpreting the object as an instance of '<em>Workload</em>'. |
246 | * <!-- begin-user-doc --> |
247 | * This implementation returns null; |
248 | * returning a non-null result will terminate the switch. |
249 | * <!-- end-user-doc --> |
250 | * @param object the target of the switch. |
251 | * @return the result of interpreting the object as an instance of '<em>Workload</em>'. |
252 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
253 | * @generated |
254 | */ |
255 | public T caseWorkload(Workload object) { |
256 | return null; |
257 | } |
258 | |
259 | /** |
260 | * Returns the result of interpreting the object as an instance of '<em>Usage Scenario</em>'. |
261 | * <!-- begin-user-doc --> |
262 | * This implementation returns null; |
263 | * returning a non-null result will terminate the switch. |
264 | * <!-- end-user-doc --> |
265 | * @param object the target of the switch. |
266 | * @return the result of interpreting the object as an instance of '<em>Usage Scenario</em>'. |
267 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
268 | * @generated |
269 | */ |
270 | public T caseUsageScenario(UsageScenario object) { |
271 | return null; |
272 | } |
273 | |
274 | /** |
275 | * Returns the result of interpreting the object as an instance of '<em>Scenario Behaviour</em>'. |
276 | * <!-- begin-user-doc --> |
277 | * This implementation returns null; |
278 | * returning a non-null result will terminate the switch. |
279 | * <!-- end-user-doc --> |
280 | * @param object the target of the switch. |
281 | * @return the result of interpreting the object as an instance of '<em>Scenario Behaviour</em>'. |
282 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
283 | * @generated |
284 | */ |
285 | public T caseScenarioBehaviour(ScenarioBehaviour object) { |
286 | return null; |
287 | } |
288 | |
289 | /** |
290 | * Returns the result of interpreting the object as an instance of '<em>Abstract User Action</em>'. |
291 | * <!-- begin-user-doc --> |
292 | * This implementation returns null; |
293 | * returning a non-null result will terminate the switch. |
294 | * <!-- end-user-doc --> |
295 | * @param object the target of the switch. |
296 | * @return the result of interpreting the object as an instance of '<em>Abstract User Action</em>'. |
297 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
298 | * @generated |
299 | */ |
300 | public T caseAbstractUserAction(AbstractUserAction object) { |
301 | return null; |
302 | } |
303 | |
304 | /** |
305 | * Returns the result of interpreting the object as an instance of '<em>Branch Transition</em>'. |
306 | * <!-- begin-user-doc --> |
307 | * This implementation returns null; |
308 | * returning a non-null result will terminate the switch. |
309 | * <!-- end-user-doc --> |
310 | * @param object the target of the switch. |
311 | * @return the result of interpreting the object as an instance of '<em>Branch Transition</em>'. |
312 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
313 | * @generated |
314 | */ |
315 | public T caseBranchTransition(BranchTransition object) { |
316 | return null; |
317 | } |
318 | |
319 | /** |
320 | * Returns the result of interpreting the object as an instance of '<em>Branch</em>'. |
321 | * <!-- begin-user-doc --> |
322 | * This implementation returns null; |
323 | * returning a non-null result will terminate the switch. |
324 | * <!-- end-user-doc --> |
325 | * @param object the target of the switch. |
326 | * @return the result of interpreting the object as an instance of '<em>Branch</em>'. |
327 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
328 | * @generated |
329 | */ |
330 | public T caseBranch(Branch object) { |
331 | return null; |
332 | } |
333 | |
334 | /** |
335 | * Returns the result of interpreting the object as an instance of '<em>Loop</em>'. |
336 | * <!-- begin-user-doc --> |
337 | * This implementation returns null; |
338 | * returning a non-null result will terminate the switch. |
339 | * <!-- end-user-doc --> |
340 | * @param object the target of the switch. |
341 | * @return the result of interpreting the object as an instance of '<em>Loop</em>'. |
342 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
343 | * @generated |
344 | */ |
345 | public T caseLoop(Loop object) { |
346 | return null; |
347 | } |
348 | |
349 | /** |
350 | * Returns the result of interpreting the object as an instance of '<em>Usage Model</em>'. |
351 | * <!-- begin-user-doc --> |
352 | * This implementation returns null; |
353 | * returning a non-null result will terminate the switch. |
354 | * <!-- end-user-doc --> |
355 | * @param object the target of the switch. |
356 | * @return the result of interpreting the object as an instance of '<em>Usage Model</em>'. |
357 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
358 | * @generated |
359 | */ |
360 | public T caseUsageModel(UsageModel object) { |
361 | return null; |
362 | } |
363 | |
364 | /** |
365 | * Returns the result of interpreting the object as an instance of '<em>Stop</em>'. |
366 | * <!-- begin-user-doc --> |
367 | * This implementation returns null; |
368 | * returning a non-null result will terminate the switch. |
369 | * <!-- end-user-doc --> |
370 | * @param object the target of the switch. |
371 | * @return the result of interpreting the object as an instance of '<em>Stop</em>'. |
372 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
373 | * @generated |
374 | */ |
375 | public T caseStop(Stop object) { |
376 | return null; |
377 | } |
378 | |
379 | /** |
380 | * Returns the result of interpreting the object as an instance of '<em>Start</em>'. |
381 | * <!-- begin-user-doc --> |
382 | * This implementation returns null; |
383 | * returning a non-null result will terminate the switch. |
384 | * <!-- end-user-doc --> |
385 | * @param object the target of the switch. |
386 | * @return the result of interpreting the object as an instance of '<em>Start</em>'. |
387 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
388 | * @generated |
389 | */ |
390 | public T caseStart(Start object) { |
391 | return null; |
392 | } |
393 | |
394 | /** |
395 | * Returns the result of interpreting the object as an instance of '<em>Open Workload</em>'. |
396 | * <!-- begin-user-doc --> |
397 | * This implementation returns null; |
398 | * returning a non-null result will terminate the switch. |
399 | * <!-- end-user-doc --> |
400 | * @param object the target of the switch. |
401 | * @return the result of interpreting the object as an instance of '<em>Open Workload</em>'. |
402 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
403 | * @generated |
404 | */ |
405 | public T caseOpenWorkload(OpenWorkload object) { |
406 | return null; |
407 | } |
408 | |
409 | /** |
410 | * Returns the result of interpreting the object as an instance of '<em>Entry Level System Call</em>'. |
411 | * <!-- begin-user-doc --> |
412 | * This implementation returns null; |
413 | * returning a non-null result will terminate the switch. |
414 | * <!-- end-user-doc --> |
415 | * @param object the target of the switch. |
416 | * @return the result of interpreting the object as an instance of '<em>Entry Level System Call</em>'. |
417 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
418 | * @generated |
419 | */ |
420 | public T caseEntryLevelSystemCall(EntryLevelSystemCall object) { |
421 | return null; |
422 | } |
423 | |
424 | /** |
425 | * Returns the result of interpreting the object as an instance of '<em>Closed Workload</em>'. |
426 | * <!-- begin-user-doc --> |
427 | * This implementation returns null; |
428 | * returning a non-null result will terminate the switch. |
429 | * <!-- end-user-doc --> |
430 | * @param object the target of the switch. |
431 | * @return the result of interpreting the object as an instance of '<em>Closed Workload</em>'. |
432 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
433 | * @generated |
434 | */ |
435 | public T caseClosedWorkload(ClosedWorkload object) { |
436 | return null; |
437 | } |
438 | |
439 | /** |
440 | * Returns the result of interpreting the object as an instance of '<em>Delay</em>'. |
441 | * <!-- begin-user-doc --> |
442 | * This implementation returns null; |
443 | * returning a non-null result will terminate the switch. |
444 | * <!-- end-user-doc --> |
445 | * @param object the target of the switch. |
446 | * @return the result of interpreting the object as an instance of '<em>Delay</em>'. |
447 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
448 | * @generated |
449 | */ |
450 | public T caseDelay(Delay object) { |
451 | return null; |
452 | } |
453 | |
454 | /** |
455 | * Returns the result of interpreting the object as an instance of '<em>User Data</em>'. |
456 | * <!-- begin-user-doc --> |
457 | * This implementation returns null; |
458 | * returning a non-null result will terminate the switch. |
459 | * <!-- end-user-doc --> |
460 | * @param object the target of the switch. |
461 | * @return the result of interpreting the object as an instance of '<em>User Data</em>'. |
462 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
463 | * @generated |
464 | */ |
465 | public T caseUserData(UserData object) { |
466 | return null; |
467 | } |
468 | |
469 | /** |
470 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
471 | * <!-- begin-user-doc --> |
472 | * This implementation returns null; |
473 | * returning a non-null result will terminate the switch. |
474 | * <!-- end-user-doc --> |
475 | * @param object the target of the switch. |
476 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
477 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
478 | * @generated |
479 | */ |
480 | public T caseIdentifier(Identifier object) { |
481 | return null; |
482 | } |
483 | |
484 | /** |
485 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
486 | * <!-- begin-user-doc --> |
487 | * This implementation returns null; |
488 | * returning a non-null result will terminate the switch. |
489 | * <!-- end-user-doc --> |
490 | * @param object the target of the switch. |
491 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
492 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
493 | * @generated |
494 | */ |
495 | public T caseNamedElement(NamedElement object) { |
496 | return null; |
497 | } |
498 | |
499 | /** |
500 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
501 | * <!-- begin-user-doc --> |
502 | * This implementation returns null; |
503 | * returning a non-null result will terminate the switch. |
504 | * <!-- end-user-doc --> |
505 | * @param object the target of the switch. |
506 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
507 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
508 | * @generated |
509 | */ |
510 | public T caseEntity(Entity object) { |
511 | return null; |
512 | } |
513 | |
514 | /** |
515 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
516 | * <!-- begin-user-doc --> |
517 | * This implementation returns null; |
518 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
519 | * <!-- end-user-doc --> |
520 | * @param object the target of the switch. |
521 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
522 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
523 | * @generated |
524 | */ |
525 | public T defaultCase(EObject object) { |
526 | return null; |
527 | } |
528 | |
529 | } //UsagemodelSwitch |