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