1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package edu.kit.ipd.sdq.completionfeaturemodel.util; |
8 | |
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.featuremodel.ChildRelation; |
15 | import de.uka.ipd.sdq.featuremodel.Feature; |
16 | import de.uka.ipd.sdq.featuremodel.FeatureDiagram; |
17 | import de.uka.ipd.sdq.featuremodel.FeatureGroup; |
18 | import de.uka.ipd.sdq.featuremodel.NamedElement; |
19 | import de.uka.ipd.sdq.featuremodel.Simple; |
20 | import de.uka.ipd.sdq.identifier.Identifier; |
21 | import edu.kit.ipd.sdq.completionfeaturemodel.*; |
22 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeature; |
23 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureDiagram; |
24 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionFeatureGroup; |
25 | import edu.kit.ipd.sdq.completionfeaturemodel.CompletionSimple; |
26 | import edu.kit.ipd.sdq.completionfeaturemodel.DisambiguationRule; |
27 | import edu.kit.ipd.sdq.completionfeaturemodel.completionfeaturemodelPackage; |
28 | |
29 | /** |
30 | * <!-- begin-user-doc --> |
31 | * The <b>Switch</b> for the model's inheritance hierarchy. |
32 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
33 | * to invoke the <code>caseXXX</code> method for each class of the model, |
34 | * starting with the actual class of the object |
35 | * and proceeding up the inheritance hierarchy |
36 | * until a non-null result is returned, |
37 | * which is the result of the switch. |
38 | * <!-- end-user-doc --> |
39 | * @see edu.kit.ipd.sdq.completionfeaturemodel.completionfeaturemodelPackage |
40 | * @generated |
41 | */ |
42 | public class completionfeaturemodelSwitch<T> { |
43 | /** |
44 | * The cached model package |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | protected static completionfeaturemodelPackage modelPackage; |
50 | |
51 | /** |
52 | * Creates an instance of the switch. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | public completionfeaturemodelSwitch() { |
58 | if (modelPackage == null) { |
59 | modelPackage = completionfeaturemodelPackage.eINSTANCE; |
60 | } |
61 | } |
62 | |
63 | /** |
64 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
68 | * @generated |
69 | */ |
70 | public T doSwitch(EObject theEObject) { |
71 | return doSwitch(theEObject.eClass(), theEObject); |
72 | } |
73 | |
74 | /** |
75 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
79 | * @generated |
80 | */ |
81 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
82 | if (theEClass.eContainer() == modelPackage) { |
83 | return doSwitch(theEClass.getClassifierID(), theEObject); |
84 | } |
85 | else { |
86 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
87 | return |
88 | eSuperTypes.isEmpty() ? |
89 | defaultCase(theEObject) : |
90 | doSwitch(eSuperTypes.get(0), theEObject); |
91 | } |
92 | } |
93 | |
94 | /** |
95 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
99 | * @generated |
100 | */ |
101 | protected T doSwitch(int classifierID, EObject theEObject) { |
102 | switch (classifierID) { |
103 | case completionfeaturemodelPackage.COMPLETION_FEATURE: { |
104 | CompletionFeature completionFeature = (CompletionFeature)theEObject; |
105 | T result = caseCompletionFeature(completionFeature); |
106 | if (result == null) result = caseFeature(completionFeature); |
107 | if (result == null) result = caseNamedElement(completionFeature); |
108 | if (result == null) result = caseIdentifier(completionFeature); |
109 | if (result == null) result = defaultCase(theEObject); |
110 | return result; |
111 | } |
112 | case completionfeaturemodelPackage.DISAMBIGUATION_RULE: { |
113 | DisambiguationRule disambiguationRule = (DisambiguationRule)theEObject; |
114 | T result = caseDisambiguationRule(disambiguationRule); |
115 | if (result == null) result = defaultCase(theEObject); |
116 | return result; |
117 | } |
118 | case completionfeaturemodelPackage.COMPLETION_FEATURE_DIAGRAM: { |
119 | CompletionFeatureDiagram completionFeatureDiagram = (CompletionFeatureDiagram)theEObject; |
120 | T result = caseCompletionFeatureDiagram(completionFeatureDiagram); |
121 | if (result == null) result = caseFeatureDiagram(completionFeatureDiagram); |
122 | if (result == null) result = caseNamedElement(completionFeatureDiagram); |
123 | if (result == null) result = caseIdentifier(completionFeatureDiagram); |
124 | if (result == null) result = defaultCase(theEObject); |
125 | return result; |
126 | } |
127 | case completionfeaturemodelPackage.COMPLETION_SIMPLE: { |
128 | CompletionSimple completionSimple = (CompletionSimple)theEObject; |
129 | T result = caseCompletionSimple(completionSimple); |
130 | if (result == null) result = caseSimple(completionSimple); |
131 | if (result == null) result = caseChildRelation(completionSimple); |
132 | if (result == null) result = defaultCase(theEObject); |
133 | return result; |
134 | } |
135 | case completionfeaturemodelPackage.COMPLETION_FEATURE_GROUP: { |
136 | CompletionFeatureGroup completionFeatureGroup = (CompletionFeatureGroup)theEObject; |
137 | T result = caseCompletionFeatureGroup(completionFeatureGroup); |
138 | if (result == null) result = caseFeatureGroup(completionFeatureGroup); |
139 | if (result == null) result = caseChildRelation(completionFeatureGroup); |
140 | if (result == null) result = defaultCase(theEObject); |
141 | return result; |
142 | } |
143 | default: return defaultCase(theEObject); |
144 | } |
145 | } |
146 | |
147 | /** |
148 | * Returns the result of interpreting the object as an instance of '<em>Completion Feature</em>'. |
149 | * <!-- begin-user-doc --> |
150 | * This implementation returns null; |
151 | * returning a non-null result will terminate the switch. |
152 | * <!-- end-user-doc --> |
153 | * @param object the target of the switch. |
154 | * @return the result of interpreting the object as an instance of '<em>Completion Feature</em>'. |
155 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
156 | * @generated |
157 | */ |
158 | public T caseCompletionFeature(CompletionFeature object) { |
159 | return null; |
160 | } |
161 | |
162 | /** |
163 | * Returns the result of interpreting the object as an instance of '<em>Disambiguation Rule</em>'. |
164 | * <!-- begin-user-doc --> |
165 | * This implementation returns null; |
166 | * returning a non-null result will terminate the switch. |
167 | * <!-- end-user-doc --> |
168 | * @param object the target of the switch. |
169 | * @return the result of interpreting the object as an instance of '<em>Disambiguation Rule</em>'. |
170 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
171 | * @generated |
172 | */ |
173 | public T caseDisambiguationRule(DisambiguationRule object) { |
174 | return null; |
175 | } |
176 | |
177 | /** |
178 | * Returns the result of interpreting the object as an instance of '<em>Completion Feature Diagram</em>'. |
179 | * <!-- begin-user-doc --> |
180 | * This implementation returns null; |
181 | * returning a non-null result will terminate the switch. |
182 | * <!-- end-user-doc --> |
183 | * @param object the target of the switch. |
184 | * @return the result of interpreting the object as an instance of '<em>Completion Feature Diagram</em>'. |
185 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
186 | * @generated |
187 | */ |
188 | public T caseCompletionFeatureDiagram(CompletionFeatureDiagram object) { |
189 | return null; |
190 | } |
191 | |
192 | /** |
193 | * Returns the result of interpreting the object as an instance of '<em>Completion Simple</em>'. |
194 | * <!-- begin-user-doc --> |
195 | * This implementation returns null; |
196 | * returning a non-null result will terminate the switch. |
197 | * <!-- end-user-doc --> |
198 | * @param object the target of the switch. |
199 | * @return the result of interpreting the object as an instance of '<em>Completion Simple</em>'. |
200 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
201 | * @generated |
202 | */ |
203 | public T caseCompletionSimple(CompletionSimple object) { |
204 | return null; |
205 | } |
206 | |
207 | /** |
208 | * Returns the result of interpreting the object as an instance of '<em>Completion Feature Group</em>'. |
209 | * <!-- begin-user-doc --> |
210 | * This implementation returns null; |
211 | * returning a non-null result will terminate the switch. |
212 | * <!-- end-user-doc --> |
213 | * @param object the target of the switch. |
214 | * @return the result of interpreting the object as an instance of '<em>Completion Feature Group</em>'. |
215 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
216 | * @generated |
217 | */ |
218 | public T caseCompletionFeatureGroup(CompletionFeatureGroup object) { |
219 | return null; |
220 | } |
221 | |
222 | /** |
223 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
224 | * <!-- begin-user-doc --> |
225 | * This implementation returns null; |
226 | * returning a non-null result will terminate the switch. |
227 | * <!-- end-user-doc --> |
228 | * @param object the target of the switch. |
229 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
230 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
231 | * @generated |
232 | */ |
233 | public T caseIdentifier(Identifier object) { |
234 | return null; |
235 | } |
236 | |
237 | /** |
238 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
239 | * <!-- begin-user-doc --> |
240 | * This implementation returns null; |
241 | * returning a non-null result will terminate the switch. |
242 | * <!-- end-user-doc --> |
243 | * @param object the target of the switch. |
244 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
245 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
246 | * @generated |
247 | */ |
248 | public T caseNamedElement(NamedElement object) { |
249 | return null; |
250 | } |
251 | |
252 | /** |
253 | * Returns the result of interpreting the object as an instance of '<em>Feature</em>'. |
254 | * <!-- begin-user-doc --> |
255 | * This implementation returns null; |
256 | * returning a non-null result will terminate the switch. |
257 | * <!-- end-user-doc --> |
258 | * @param object the target of the switch. |
259 | * @return the result of interpreting the object as an instance of '<em>Feature</em>'. |
260 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
261 | * @generated |
262 | */ |
263 | public T caseFeature(Feature object) { |
264 | return null; |
265 | } |
266 | |
267 | /** |
268 | * Returns the result of interpreting the object as an instance of '<em>Feature Diagram</em>'. |
269 | * <!-- begin-user-doc --> |
270 | * This implementation returns null; |
271 | * returning a non-null result will terminate the switch. |
272 | * <!-- end-user-doc --> |
273 | * @param object the target of the switch. |
274 | * @return the result of interpreting the object as an instance of '<em>Feature Diagram</em>'. |
275 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
276 | * @generated |
277 | */ |
278 | public T caseFeatureDiagram(FeatureDiagram object) { |
279 | return null; |
280 | } |
281 | |
282 | /** |
283 | * Returns the result of interpreting the object as an instance of '<em>Child Relation</em>'. |
284 | * <!-- begin-user-doc --> |
285 | * This implementation returns null; |
286 | * returning a non-null result will terminate the switch. |
287 | * <!-- end-user-doc --> |
288 | * @param object the target of the switch. |
289 | * @return the result of interpreting the object as an instance of '<em>Child Relation</em>'. |
290 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
291 | * @generated |
292 | */ |
293 | public T caseChildRelation(ChildRelation object) { |
294 | return null; |
295 | } |
296 | |
297 | /** |
298 | * Returns the result of interpreting the object as an instance of '<em>Simple</em>'. |
299 | * <!-- begin-user-doc --> |
300 | * This implementation returns null; |
301 | * returning a non-null result will terminate the switch. |
302 | * <!-- end-user-doc --> |
303 | * @param object the target of the switch. |
304 | * @return the result of interpreting the object as an instance of '<em>Simple</em>'. |
305 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
306 | * @generated |
307 | */ |
308 | public T caseSimple(Simple object) { |
309 | return null; |
310 | } |
311 | |
312 | /** |
313 | * Returns the result of interpreting the object as an instance of '<em>Feature Group</em>'. |
314 | * <!-- begin-user-doc --> |
315 | * This implementation returns null; |
316 | * returning a non-null result will terminate the switch. |
317 | * <!-- end-user-doc --> |
318 | * @param object the target of the switch. |
319 | * @return the result of interpreting the object as an instance of '<em>Feature Group</em>'. |
320 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
321 | * @generated |
322 | */ |
323 | public T caseFeatureGroup(FeatureGroup object) { |
324 | return null; |
325 | } |
326 | |
327 | /** |
328 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
329 | * <!-- begin-user-doc --> |
330 | * This implementation returns null; |
331 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
332 | * <!-- end-user-doc --> |
333 | * @param object the target of the switch. |
334 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
335 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
336 | * @generated |
337 | */ |
338 | public T defaultCase(EObject object) { |
339 | return null; |
340 | } |
341 | |
342 | } //completionfeaturemodelSwitch |