1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.resultdecorator.util; |
8 | |
9 | import de.uka.ipd.sdq.pcm.resultdecorator.*; |
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.resultdecorator.ResultdecoratorPackage |
27 | * @generated |
28 | */ |
29 | public class ResultdecoratorSwitch<T> { |
30 | /** |
31 | * The cached model package |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | protected static ResultdecoratorPackage modelPackage; |
37 | |
38 | /** |
39 | * Creates an instance of the switch. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public ResultdecoratorSwitch() { |
45 | if (modelPackage == null) { |
46 | modelPackage = ResultdecoratorPackage.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 ResultdecoratorPackage.RESULT_DECORATOR_REPOSITORY: { |
91 | ResultDecoratorRepository resultDecoratorRepository = (ResultDecoratorRepository)theEObject; |
92 | T result = caseResultDecoratorRepository(resultDecoratorRepository); |
93 | if (result == null) result = defaultCase(theEObject); |
94 | return result; |
95 | } |
96 | default: return defaultCase(theEObject); |
97 | } |
98 | } |
99 | |
100 | /** |
101 | * Returns the result of interpreting the object as an instance of '<em>Result Decorator Repository</em>'. |
102 | * <!-- begin-user-doc --> |
103 | * This implementation returns null; |
104 | * returning a non-null result will terminate the switch. |
105 | * <!-- end-user-doc --> |
106 | * @param object the target of the switch. |
107 | * @return the result of interpreting the object as an instance of '<em>Result Decorator Repository</em>'. |
108 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
109 | * @generated |
110 | */ |
111 | public T caseResultDecoratorRepository(ResultDecoratorRepository object) { |
112 | return null; |
113 | } |
114 | |
115 | /** |
116 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
117 | * <!-- begin-user-doc --> |
118 | * This implementation returns null; |
119 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
120 | * <!-- end-user-doc --> |
121 | * @param object the target of the switch. |
122 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
123 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
124 | * @generated |
125 | */ |
126 | public T defaultCase(EObject object) { |
127 | return null; |
128 | } |
129 | |
130 | } //ResultdecoratorSwitch |