1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.featuremodel.util; |
8 | |
9 | import de.uka.ipd.sdq.featuremodel.*; |
10 | import java.util.List; |
11 | |
12 | import org.eclipse.emf.ecore.EClass; |
13 | import org.eclipse.emf.ecore.EObject; |
14 | |
15 | import de.uka.ipd.sdq.featuremodel.Attribute; |
16 | import de.uka.ipd.sdq.featuremodel.ChildRelation; |
17 | import de.uka.ipd.sdq.featuremodel.Constraint; |
18 | import de.uka.ipd.sdq.featuremodel.ContinousIntervalRange; |
19 | import de.uka.ipd.sdq.featuremodel.DoubleAttribute; |
20 | import de.uka.ipd.sdq.featuremodel.Feature; |
21 | import de.uka.ipd.sdq.featuremodel.FeatureDiagram; |
22 | import de.uka.ipd.sdq.featuremodel.FeatureGroup; |
23 | import de.uka.ipd.sdq.featuremodel.IntegerAttribute; |
24 | import de.uka.ipd.sdq.featuremodel.IntegerIntervalRange; |
25 | import de.uka.ipd.sdq.featuremodel.IntervalRange; |
26 | import de.uka.ipd.sdq.featuremodel.NamedElement; |
27 | import de.uka.ipd.sdq.featuremodel.ProhibitsConstraint; |
28 | import de.uka.ipd.sdq.featuremodel.RequiredConstraint; |
29 | import de.uka.ipd.sdq.featuremodel.Simple; |
30 | import de.uka.ipd.sdq.featuremodel.featuremodelPackage; |
31 | import de.uka.ipd.sdq.identifier.Identifier; |
32 | |
33 | /** |
34 | * <!-- begin-user-doc --> |
35 | * The <b>Switch</b> for the model's inheritance hierarchy. |
36 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
37 | * to invoke the <code>caseXXX</code> method for each class of the model, |
38 | * starting with the actual class of the object |
39 | * and proceeding up the inheritance hierarchy |
40 | * until a non-null result is returned, |
41 | * which is the result of the switch. |
42 | * <!-- end-user-doc --> |
43 | * @see de.uka.ipd.sdq.featuremodel.featuremodelPackage |
44 | * @generated |
45 | */ |
46 | public class featuremodelSwitch<T> { |
47 | /** |
48 | * The cached model package |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @generated |
52 | */ |
53 | protected static featuremodelPackage modelPackage; |
54 | |
55 | /** |
56 | * Creates an instance of the switch. |
57 | * <!-- begin-user-doc --> |
58 | * <!-- end-user-doc --> |
59 | * @generated |
60 | */ |
61 | public featuremodelSwitch() { |
62 | if (modelPackage == null) { |
63 | modelPackage = featuremodelPackage.eINSTANCE; |
64 | } |
65 | } |
66 | |
67 | /** |
68 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
72 | * @generated |
73 | */ |
74 | public T doSwitch(EObject theEObject) { |
75 | return doSwitch(theEObject.eClass(), theEObject); |
76 | } |
77 | |
78 | /** |
79 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
83 | * @generated |
84 | */ |
85 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
86 | if (theEClass.eContainer() == modelPackage) { |
87 | return doSwitch(theEClass.getClassifierID(), theEObject); |
88 | } |
89 | else { |
90 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
91 | return |
92 | eSuperTypes.isEmpty() ? |
93 | defaultCase(theEObject) : |
94 | doSwitch(eSuperTypes.get(0), theEObject); |
95 | } |
96 | } |
97 | |
98 | /** |
99 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
103 | * @generated |
104 | */ |
105 | protected T doSwitch(int classifierID, EObject theEObject) { |
106 | switch (classifierID) { |
107 | case featuremodelPackage.FEATURE: { |
108 | Feature feature = (Feature)theEObject; |
109 | T result = caseFeature(feature); |
110 | if (result == null) result = caseNamedElement(feature); |
111 | if (result == null) result = caseIdentifier(feature); |
112 | if (result == null) result = defaultCase(theEObject); |
113 | return result; |
114 | } |
115 | case featuremodelPackage.NAMED_ELEMENT: { |
116 | NamedElement namedElement = (NamedElement)theEObject; |
117 | T result = caseNamedElement(namedElement); |
118 | if (result == null) result = caseIdentifier(namedElement); |
119 | if (result == null) result = defaultCase(theEObject); |
120 | return result; |
121 | } |
122 | case featuremodelPackage.ATTRIBUTE: { |
123 | Attribute attribute = (Attribute)theEObject; |
124 | T result = caseAttribute(attribute); |
125 | if (result == null) result = caseNamedElement(attribute); |
126 | if (result == null) result = caseIdentifier(attribute); |
127 | if (result == null) result = defaultCase(theEObject); |
128 | return result; |
129 | } |
130 | case featuremodelPackage.INTERVAL_RANGE: { |
131 | IntervalRange intervalRange = (IntervalRange)theEObject; |
132 | T result = caseIntervalRange(intervalRange); |
133 | if (result == null) result = defaultCase(theEObject); |
134 | return result; |
135 | } |
136 | case featuremodelPackage.CHILD_RELATION: { |
137 | ChildRelation childRelation = (ChildRelation)theEObject; |
138 | T result = caseChildRelation(childRelation); |
139 | if (result == null) result = defaultCase(theEObject); |
140 | return result; |
141 | } |
142 | case featuremodelPackage.SIMPLE: { |
143 | Simple simple = (Simple)theEObject; |
144 | T result = caseSimple(simple); |
145 | if (result == null) result = caseChildRelation(simple); |
146 | if (result == null) result = defaultCase(theEObject); |
147 | return result; |
148 | } |
149 | case featuremodelPackage.FEATURE_GROUP: { |
150 | FeatureGroup featureGroup = (FeatureGroup)theEObject; |
151 | T result = caseFeatureGroup(featureGroup); |
152 | if (result == null) result = caseChildRelation(featureGroup); |
153 | if (result == null) result = defaultCase(theEObject); |
154 | return result; |
155 | } |
156 | case featuremodelPackage.FEATURE_DIAGRAM: { |
157 | FeatureDiagram featureDiagram = (FeatureDiagram)theEObject; |
158 | T result = caseFeatureDiagram(featureDiagram); |
159 | if (result == null) result = caseNamedElement(featureDiagram); |
160 | if (result == null) result = caseIdentifier(featureDiagram); |
161 | if (result == null) result = defaultCase(theEObject); |
162 | return result; |
163 | } |
164 | case featuremodelPackage.CONSTRAINT: { |
165 | Constraint constraint = (Constraint)theEObject; |
166 | T result = caseConstraint(constraint); |
167 | if (result == null) result = caseNamedElement(constraint); |
168 | if (result == null) result = caseIdentifier(constraint); |
169 | if (result == null) result = defaultCase(theEObject); |
170 | return result; |
171 | } |
172 | case featuremodelPackage.REQUIRED_CONSTRAINT: { |
173 | RequiredConstraint requiredConstraint = (RequiredConstraint)theEObject; |
174 | T result = caseRequiredConstraint(requiredConstraint); |
175 | if (result == null) result = caseConstraint(requiredConstraint); |
176 | if (result == null) result = caseNamedElement(requiredConstraint); |
177 | if (result == null) result = caseIdentifier(requiredConstraint); |
178 | if (result == null) result = defaultCase(theEObject); |
179 | return result; |
180 | } |
181 | case featuremodelPackage.PROHIBITS_CONSTRAINT: { |
182 | ProhibitsConstraint prohibitsConstraint = (ProhibitsConstraint)theEObject; |
183 | T result = caseProhibitsConstraint(prohibitsConstraint); |
184 | if (result == null) result = caseConstraint(prohibitsConstraint); |
185 | if (result == null) result = caseNamedElement(prohibitsConstraint); |
186 | if (result == null) result = caseIdentifier(prohibitsConstraint); |
187 | if (result == null) result = defaultCase(theEObject); |
188 | return result; |
189 | } |
190 | case featuremodelPackage.INTEGER_INTERVAL_RANGE: { |
191 | IntegerIntervalRange integerIntervalRange = (IntegerIntervalRange)theEObject; |
192 | T result = caseIntegerIntervalRange(integerIntervalRange); |
193 | if (result == null) result = caseIntervalRange(integerIntervalRange); |
194 | if (result == null) result = defaultCase(theEObject); |
195 | return result; |
196 | } |
197 | case featuremodelPackage.CONTINOUS_INTERVAL_RANGE: { |
198 | ContinousIntervalRange continousIntervalRange = (ContinousIntervalRange)theEObject; |
199 | T result = caseContinousIntervalRange(continousIntervalRange); |
200 | if (result == null) result = caseIntervalRange(continousIntervalRange); |
201 | if (result == null) result = defaultCase(theEObject); |
202 | return result; |
203 | } |
204 | case featuremodelPackage.INTEGER_ATTRIBUTE: { |
205 | IntegerAttribute integerAttribute = (IntegerAttribute)theEObject; |
206 | T result = caseIntegerAttribute(integerAttribute); |
207 | if (result == null) result = caseAttribute(integerAttribute); |
208 | if (result == null) result = caseNamedElement(integerAttribute); |
209 | if (result == null) result = caseIdentifier(integerAttribute); |
210 | if (result == null) result = defaultCase(theEObject); |
211 | return result; |
212 | } |
213 | case featuremodelPackage.DOUBLE_ATTRIBUTE: { |
214 | DoubleAttribute doubleAttribute = (DoubleAttribute)theEObject; |
215 | T result = caseDoubleAttribute(doubleAttribute); |
216 | if (result == null) result = caseAttribute(doubleAttribute); |
217 | if (result == null) result = caseNamedElement(doubleAttribute); |
218 | if (result == null) result = caseIdentifier(doubleAttribute); |
219 | if (result == null) result = defaultCase(theEObject); |
220 | return result; |
221 | } |
222 | case featuremodelPackage.STRING_ATTRIBUTE: { |
223 | StringAttribute stringAttribute = (StringAttribute)theEObject; |
224 | T result = caseStringAttribute(stringAttribute); |
225 | if (result == null) result = caseAttribute(stringAttribute); |
226 | if (result == null) result = caseNamedElement(stringAttribute); |
227 | if (result == null) result = caseIdentifier(stringAttribute); |
228 | if (result == null) result = defaultCase(theEObject); |
229 | return result; |
230 | } |
231 | case featuremodelPackage.EXTERNAL_OBJECT_ATTRIBUTE: { |
232 | ExternalObjectAttribute externalObjectAttribute = (ExternalObjectAttribute)theEObject; |
233 | T result = caseExternalObjectAttribute(externalObjectAttribute); |
234 | if (result == null) result = caseAttribute(externalObjectAttribute); |
235 | if (result == null) result = caseNamedElement(externalObjectAttribute); |
236 | if (result == null) result = caseIdentifier(externalObjectAttribute); |
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>Feature</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>Feature</em>'. |
252 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
253 | * @generated |
254 | */ |
255 | public T caseFeature(Feature object) { |
256 | return null; |
257 | } |
258 | |
259 | /** |
260 | * Returns the result of interpreting the object as an instance of '<em>Named Element</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>Named Element</em>'. |
267 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
268 | * @generated |
269 | */ |
270 | public T caseNamedElement(NamedElement object) { |
271 | return null; |
272 | } |
273 | |
274 | /** |
275 | * Returns the result of interpreting the object as an instance of '<em>Attribute</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>Attribute</em>'. |
282 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
283 | * @generated |
284 | */ |
285 | public T caseAttribute(Attribute object) { |
286 | return null; |
287 | } |
288 | |
289 | /** |
290 | * Returns the result of interpreting the object as an instance of '<em>Child Relation</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>Child Relation</em>'. |
297 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
298 | * @generated |
299 | */ |
300 | public T caseChildRelation(ChildRelation object) { |
301 | return null; |
302 | } |
303 | |
304 | /** |
305 | * Returns the result of interpreting the object as an instance of '<em>Integer Attribute</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>Integer Attribute</em>'. |
312 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
313 | * @generated |
314 | */ |
315 | public T caseIntegerAttribute(IntegerAttribute object) { |
316 | return null; |
317 | } |
318 | |
319 | /** |
320 | * Returns the result of interpreting the object as an instance of '<em>Double Attribute</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>Double Attribute</em>'. |
327 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
328 | * @generated |
329 | */ |
330 | public T caseDoubleAttribute(DoubleAttribute object) { |
331 | return null; |
332 | } |
333 | |
334 | /** |
335 | * Returns the result of interpreting the object as an instance of '<em>String Attribute</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>String Attribute</em>'. |
342 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
343 | * @generated |
344 | */ |
345 | public T caseStringAttribute(StringAttribute object) { |
346 | return null; |
347 | } |
348 | |
349 | /** |
350 | * Returns the result of interpreting the object as an instance of '<em>External Object Attribute</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>External Object Attribute</em>'. |
357 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
358 | * @generated |
359 | */ |
360 | public T caseExternalObjectAttribute(ExternalObjectAttribute object) { |
361 | return null; |
362 | } |
363 | |
364 | /** |
365 | * Returns the result of interpreting the object as an instance of '<em>Interval Range</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>Interval Range</em>'. |
372 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
373 | * @generated |
374 | */ |
375 | public T caseIntervalRange(IntervalRange object) { |
376 | return null; |
377 | } |
378 | |
379 | /** |
380 | * Returns the result of interpreting the object as an instance of '<em>Integer Interval Range</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>Integer Interval Range</em>'. |
387 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
388 | * @generated |
389 | */ |
390 | public T caseIntegerIntervalRange(IntegerIntervalRange object) { |
391 | return null; |
392 | } |
393 | |
394 | /** |
395 | * Returns the result of interpreting the object as an instance of '<em>Continous Interval Range</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>Continous Interval Range</em>'. |
402 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
403 | * @generated |
404 | */ |
405 | public T caseContinousIntervalRange(ContinousIntervalRange object) { |
406 | return null; |
407 | } |
408 | |
409 | /** |
410 | * Returns the result of interpreting the object as an instance of '<em>Feature Group</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>Feature Group</em>'. |
417 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
418 | * @generated |
419 | */ |
420 | public T caseFeatureGroup(FeatureGroup object) { |
421 | return null; |
422 | } |
423 | |
424 | /** |
425 | * Returns the result of interpreting the object as an instance of '<em>Feature Diagram</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>Feature Diagram</em>'. |
432 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
433 | * @generated |
434 | */ |
435 | public T caseFeatureDiagram(FeatureDiagram object) { |
436 | return null; |
437 | } |
438 | |
439 | /** |
440 | * Returns the result of interpreting the object as an instance of '<em>Constraint</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>Constraint</em>'. |
447 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
448 | * @generated |
449 | */ |
450 | public T caseConstraint(Constraint object) { |
451 | return null; |
452 | } |
453 | |
454 | /** |
455 | * Returns the result of interpreting the object as an instance of '<em>Required Constraint</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>Required Constraint</em>'. |
462 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
463 | * @generated |
464 | */ |
465 | public T caseRequiredConstraint(RequiredConstraint object) { |
466 | return null; |
467 | } |
468 | |
469 | /** |
470 | * Returns the result of interpreting the object as an instance of '<em>Prohibits Constraint</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>Prohibits Constraint</em>'. |
477 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
478 | * @generated |
479 | */ |
480 | public T caseProhibitsConstraint(ProhibitsConstraint object) { |
481 | return null; |
482 | } |
483 | |
484 | /** |
485 | * Returns the result of interpreting the object as an instance of '<em>Simple</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>Simple</em>'. |
492 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
493 | * @generated |
494 | */ |
495 | public T caseSimple(Simple object) { |
496 | return null; |
497 | } |
498 | |
499 | /** |
500 | * Returns the result of interpreting the object as an instance of '<em>Identifier</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>Identifier</em>'. |
507 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
508 | * @generated |
509 | */ |
510 | public T caseIdentifier(Identifier 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 | } //featuremodelSwitch |