1 /**
2 * <copyright>
3 * </copyright>
4 *
5 * $Id$
6 */
7 package BusinessDomainDsl.util;
8
9 import BusinessDomainDsl.*;
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 BusinessDomainDsl.BusinessDomainDslPackage
27 * @generated
28 */
29 public class BusinessDomainDslSwitch<T> {
30 /**
31 * The cached model package
32 * <!-- begin-user-doc -->
33 * <!-- end-user-doc -->
34 * @generated
35 */
36 protected static BusinessDomainDslPackage modelPackage;
37
38 /**
39 * Creates an instance of the switch.
40 * <!-- begin-user-doc -->
41 * <!-- end-user-doc -->
42 * @generated
43 */
44 public BusinessDomainDslSwitch() {
45 if (modelPackage == null) {
46 modelPackage = BusinessDomainDslPackage.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 BusinessDomainDslPackage.MODEL_ELEMENT: {
91 ModelElement modelElement = (ModelElement)theEObject;
92 T result = caseModelElement(modelElement);
93 if (result == null) result = defaultCase(theEObject);
94 return result;
95 }
96 case BusinessDomainDslPackage.BUSINESS_DOMAIN_MODEL: {
97 BusinessDomainModel businessDomainModel = (BusinessDomainModel)theEObject;
98 T result = caseBusinessDomainModel(businessDomainModel);
99 if (result == null) result = caseModelElement(businessDomainModel);
100 if (result == null) result = defaultCase(theEObject);
101 return result;
102 }
103 case BusinessDomainDslPackage.BUSINESS_CLASS: {
104 BusinessClass businessClass = (BusinessClass)theEObject;
105 T result = caseBusinessClass(businessClass);
106 if (result == null) result = caseAbstractBusinessClass(businessClass);
107 if (result == null) result = caseAbstractType(businessClass);
108 if (result == null) result = caseModelElement(businessClass);
109 if (result == null) result = defaultCase(theEObject);
110 return result;
111 }
112 case BusinessDomainDslPackage.PROPERTY: {
113 Property property = (Property)theEObject;
114 T result = caseProperty(property);
115 if (result == null) result = caseModelElement(property);
116 if (result == null) result = defaultCase(theEObject);
117 return result;
118 }
119 case BusinessDomainDslPackage.ENUMERATION: {
120 Enumeration enumeration = (Enumeration)theEObject;
121 T result = caseEnumeration(enumeration);
122 if (result == null) result = caseModelElement(enumeration);
123 if (result == null) result = defaultCase(theEObject);
124 return result;
125 }
126 case BusinessDomainDslPackage.ENUMERATION_LITERAL: {
127 EnumerationLiteral enumerationLiteral = (EnumerationLiteral)theEObject;
128 T result = caseEnumerationLiteral(enumerationLiteral);
129 if (result == null) result = caseModelElement(enumerationLiteral);
130 if (result == null) result = defaultCase(theEObject);
131 return result;
132 }
133 case BusinessDomainDslPackage.ABSTRACT_BUSINESS_RULE: {
134 AbstractBusinessRule abstractBusinessRule = (AbstractBusinessRule)theEObject;
135 T result = caseAbstractBusinessRule(abstractBusinessRule);
136 if (result == null) result = caseModelElement(abstractBusinessRule);
137 if (result == null) result = defaultCase(theEObject);
138 return result;
139 }
140 case BusinessDomainDslPackage.BOOL_PROPERTY: {
141 BoolProperty boolProperty = (BoolProperty)theEObject;
142 T result = caseBoolProperty(boolProperty);
143 if (result == null) result = caseProperty(boolProperty);
144 if (result == null) result = caseModelElement(boolProperty);
145 if (result == null) result = defaultCase(theEObject);
146 return result;
147 }
148 case BusinessDomainDslPackage.DATE_TIME_PROPERTY: {
149 DateTimeProperty dateTimeProperty = (DateTimeProperty)theEObject;
150 T result = caseDateTimeProperty(dateTimeProperty);
151 if (result == null) result = caseProperty(dateTimeProperty);
152 if (result == null) result = caseModelElement(dateTimeProperty);
153 if (result == null) result = defaultCase(theEObject);
154 return result;
155 }
156 case BusinessDomainDslPackage.ENUMERATION_PROPERTY: {
157 EnumerationProperty enumerationProperty = (EnumerationProperty)theEObject;
158 T result = caseEnumerationProperty(enumerationProperty);
159 if (result == null) result = caseProperty(enumerationProperty);
160 if (result == null) result = caseModelElement(enumerationProperty);
161 if (result == null) result = defaultCase(theEObject);
162 return result;
163 }
164 case BusinessDomainDslPackage.INTEGER_PROPERTY: {
165 IntegerProperty integerProperty = (IntegerProperty)theEObject;
166 T result = caseIntegerProperty(integerProperty);
167 if (result == null) result = caseProperty(integerProperty);
168 if (result == null) result = caseModelElement(integerProperty);
169 if (result == null) result = defaultCase(theEObject);
170 return result;
171 }
172 case BusinessDomainDslPackage.STRING_PROPERTY: {
173 StringProperty stringProperty = (StringProperty)theEObject;
174 T result = caseStringProperty(stringProperty);
175 if (result == null) result = caseProperty(stringProperty);
176 if (result == null) result = caseModelElement(stringProperty);
177 if (result == null) result = defaultCase(theEObject);
178 return result;
179 }
180 case BusinessDomainDslPackage.ABSTRACT_TYPE: {
181 AbstractType abstractType = (AbstractType)theEObject;
182 T result = caseAbstractType(abstractType);
183 if (result == null) result = caseModelElement(abstractType);
184 if (result == null) result = defaultCase(theEObject);
185 return result;
186 }
187 case BusinessDomainDslPackage.BLOB_BINARY_PROPERTY: {
188 BlobBinaryProperty blobBinaryProperty = (BlobBinaryProperty)theEObject;
189 T result = caseBlobBinaryProperty(blobBinaryProperty);
190 if (result == null) result = caseProperty(blobBinaryProperty);
191 if (result == null) result = caseModelElement(blobBinaryProperty);
192 if (result == null) result = defaultCase(theEObject);
193 return result;
194 }
195 case BusinessDomainDslPackage.BLOB_TEXT_PROPERTY: {
196 BlobTextProperty blobTextProperty = (BlobTextProperty)theEObject;
197 T result = caseBlobTextProperty(blobTextProperty);
198 if (result == null) result = caseProperty(blobTextProperty);
199 if (result == null) result = caseModelElement(blobTextProperty);
200 if (result == null) result = defaultCase(theEObject);
201 return result;
202 }
203 case BusinessDomainDslPackage.ASSOCIATION: {
204 Association association = (Association)theEObject;
205 T result = caseAssociation(association);
206 if (result == null) result = caseModelElement(association);
207 if (result == null) result = defaultCase(theEObject);
208 return result;
209 }
210 case BusinessDomainDslPackage.DECIMAL_PROPERTY: {
211 DecimalProperty decimalProperty = (DecimalProperty)theEObject;
212 T result = caseDecimalProperty(decimalProperty);
213 if (result == null) result = caseProperty(decimalProperty);
214 if (result == null) result = caseModelElement(decimalProperty);
215 if (result == null) result = defaultCase(theEObject);
216 return result;
217 }
218 case BusinessDomainDslPackage.ABSTRACT_BUSINESS_CLASS: {
219 AbstractBusinessClass abstractBusinessClass = (AbstractBusinessClass)theEObject;
220 T result = caseAbstractBusinessClass(abstractBusinessClass);
221 if (result == null) result = caseAbstractType(abstractBusinessClass);
222 if (result == null) result = caseModelElement(abstractBusinessClass);
223 if (result == null) result = defaultCase(theEObject);
224 return result;
225 }
226 case BusinessDomainDslPackage.BUSINESS_CLASS_REFERENCE: {
227 BusinessClassReference businessClassReference = (BusinessClassReference)theEObject;
228 T result = caseBusinessClassReference(businessClassReference);
229 if (result == null) result = caseAbstractBusinessClass(businessClassReference);
230 if (result == null) result = caseAbstractType(businessClassReference);
231 if (result == null) result = caseModelElement(businessClassReference);
232 if (result == null) result = defaultCase(theEObject);
233 return result;
234 }
235 case BusinessDomainDslPackage.UNIQUE_RULE: {
236 UniqueRule uniqueRule = (UniqueRule)theEObject;
237 T result = caseUniqueRule(uniqueRule);
238 if (result == null) result = caseAbstractBusinessRule(uniqueRule);
239 if (result == null) result = caseModelElement(uniqueRule);
240 if (result == null) result = defaultCase(theEObject);
241 return result;
242 }
243 case BusinessDomainDslPackage.BUSINESS_RULE: {
244 BusinessRule businessRule = (BusinessRule)theEObject;
245 T result = caseBusinessRule(businessRule);
246 if (result == null) result = caseAbstractBusinessRule(businessRule);
247 if (result == null) result = caseModelElement(businessRule);
248 if (result == null) result = defaultCase(theEObject);
249 return result;
250 }
251 default: return defaultCase(theEObject);
252 }
253 }
254
255 /**
256 * Returns the result of interpreting the object as an instance of '<em>Model Element</em>'.
257 * <!-- begin-user-doc -->
258 * This implementation returns null;
259 * returning a non-null result will terminate the switch.
260 * <!-- end-user-doc -->
261 * @param object the target of the switch.
262 * @return the result of interpreting the object as an instance of '<em>Model Element</em>'.
263 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
264 * @generated
265 */
266 public T caseModelElement(ModelElement object) {
267 return null;
268 }
269
270 /**
271 * Returns the result of interpreting the object as an instance of '<em>Business Domain Model</em>'.
272 * <!-- begin-user-doc -->
273 * This implementation returns null;
274 * returning a non-null result will terminate the switch.
275 * <!-- end-user-doc -->
276 * @param object the target of the switch.
277 * @return the result of interpreting the object as an instance of '<em>Business Domain Model</em>'.
278 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
279 * @generated
280 */
281 public T caseBusinessDomainModel(BusinessDomainModel object) {
282 return null;
283 }
284
285 /**
286 * Returns the result of interpreting the object as an instance of '<em>Business Class</em>'.
287 * <!-- begin-user-doc -->
288 * This implementation returns null;
289 * returning a non-null result will terminate the switch.
290 * <!-- end-user-doc -->
291 * @param object the target of the switch.
292 * @return the result of interpreting the object as an instance of '<em>Business Class</em>'.
293 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
294 * @generated
295 */
296 public T caseBusinessClass(BusinessClass object) {
297 return null;
298 }
299
300 /**
301 * Returns the result of interpreting the object as an instance of '<em>Property</em>'.
302 * <!-- begin-user-doc -->
303 * This implementation returns null;
304 * returning a non-null result will terminate the switch.
305 * <!-- end-user-doc -->
306 * @param object the target of the switch.
307 * @return the result of interpreting the object as an instance of '<em>Property</em>'.
308 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
309 * @generated
310 */
311 public T caseProperty(Property object) {
312 return null;
313 }
314
315 /**
316 * Returns the result of interpreting the object as an instance of '<em>Enumeration</em>'.
317 * <!-- begin-user-doc -->
318 * This implementation returns null;
319 * returning a non-null result will terminate the switch.
320 * <!-- end-user-doc -->
321 * @param object the target of the switch.
322 * @return the result of interpreting the object as an instance of '<em>Enumeration</em>'.
323 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
324 * @generated
325 */
326 public T caseEnumeration(Enumeration object) {
327 return null;
328 }
329
330 /**
331 * Returns the result of interpreting the object as an instance of '<em>Enumeration Literal</em>'.
332 * <!-- begin-user-doc -->
333 * This implementation returns null;
334 * returning a non-null result will terminate the switch.
335 * <!-- end-user-doc -->
336 * @param object the target of the switch.
337 * @return the result of interpreting the object as an instance of '<em>Enumeration Literal</em>'.
338 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
339 * @generated
340 */
341 public T caseEnumerationLiteral(EnumerationLiteral object) {
342 return null;
343 }
344
345 /**
346 * Returns the result of interpreting the object as an instance of '<em>Abstract Business Rule</em>'.
347 * <!-- begin-user-doc -->
348 * This implementation returns null;
349 * returning a non-null result will terminate the switch.
350 * <!-- end-user-doc -->
351 * @param object the target of the switch.
352 * @return the result of interpreting the object as an instance of '<em>Abstract Business Rule</em>'.
353 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
354 * @generated
355 */
356 public T caseAbstractBusinessRule(AbstractBusinessRule object) {
357 return null;
358 }
359
360 /**
361 * Returns the result of interpreting the object as an instance of '<em>Bool Property</em>'.
362 * <!-- begin-user-doc -->
363 * This implementation returns null;
364 * returning a non-null result will terminate the switch.
365 * <!-- end-user-doc -->
366 * @param object the target of the switch.
367 * @return the result of interpreting the object as an instance of '<em>Bool Property</em>'.
368 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
369 * @generated
370 */
371 public T caseBoolProperty(BoolProperty object) {
372 return null;
373 }
374
375 /**
376 * Returns the result of interpreting the object as an instance of '<em>Date Time Property</em>'.
377 * <!-- begin-user-doc -->
378 * This implementation returns null;
379 * returning a non-null result will terminate the switch.
380 * <!-- end-user-doc -->
381 * @param object the target of the switch.
382 * @return the result of interpreting the object as an instance of '<em>Date Time Property</em>'.
383 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
384 * @generated
385 */
386 public T caseDateTimeProperty(DateTimeProperty object) {
387 return null;
388 }
389
390 /**
391 * Returns the result of interpreting the object as an instance of '<em>Enumeration Property</em>'.
392 * <!-- begin-user-doc -->
393 * This implementation returns null;
394 * returning a non-null result will terminate the switch.
395 * <!-- end-user-doc -->
396 * @param object the target of the switch.
397 * @return the result of interpreting the object as an instance of '<em>Enumeration Property</em>'.
398 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
399 * @generated
400 */
401 public T caseEnumerationProperty(EnumerationProperty object) {
402 return null;
403 }
404
405 /**
406 * Returns the result of interpreting the object as an instance of '<em>Integer Property</em>'.
407 * <!-- begin-user-doc -->
408 * This implementation returns null;
409 * returning a non-null result will terminate the switch.
410 * <!-- end-user-doc -->
411 * @param object the target of the switch.
412 * @return the result of interpreting the object as an instance of '<em>Integer Property</em>'.
413 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
414 * @generated
415 */
416 public T caseIntegerProperty(IntegerProperty object) {
417 return null;
418 }
419
420 /**
421 * Returns the result of interpreting the object as an instance of '<em>String Property</em>'.
422 * <!-- begin-user-doc -->
423 * This implementation returns null;
424 * returning a non-null result will terminate the switch.
425 * <!-- end-user-doc -->
426 * @param object the target of the switch.
427 * @return the result of interpreting the object as an instance of '<em>String Property</em>'.
428 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
429 * @generated
430 */
431 public T caseStringProperty(StringProperty object) {
432 return null;
433 }
434
435 /**
436 * Returns the result of interpreting the object as an instance of '<em>Abstract Type</em>'.
437 * <!-- begin-user-doc -->
438 * This implementation returns null;
439 * returning a non-null result will terminate the switch.
440 * <!-- end-user-doc -->
441 * @param object the target of the switch.
442 * @return the result of interpreting the object as an instance of '<em>Abstract Type</em>'.
443 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
444 * @generated
445 */
446 public T caseAbstractType(AbstractType object) {
447 return null;
448 }
449
450 /**
451 * Returns the result of interpreting the object as an instance of '<em>Blob Binary Property</em>'.
452 * <!-- begin-user-doc -->
453 * This implementation returns null;
454 * returning a non-null result will terminate the switch.
455 * <!-- end-user-doc -->
456 * @param object the target of the switch.
457 * @return the result of interpreting the object as an instance of '<em>Blob Binary Property</em>'.
458 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
459 * @generated
460 */
461 public T caseBlobBinaryProperty(BlobBinaryProperty object) {
462 return null;
463 }
464
465 /**
466 * Returns the result of interpreting the object as an instance of '<em>Blob Text Property</em>'.
467 * <!-- begin-user-doc -->
468 * This implementation returns null;
469 * returning a non-null result will terminate the switch.
470 * <!-- end-user-doc -->
471 * @param object the target of the switch.
472 * @return the result of interpreting the object as an instance of '<em>Blob Text Property</em>'.
473 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
474 * @generated
475 */
476 public T caseBlobTextProperty(BlobTextProperty object) {
477 return null;
478 }
479
480 /**
481 * Returns the result of interpreting the object as an instance of '<em>Association</em>'.
482 * <!-- begin-user-doc -->
483 * This implementation returns null;
484 * returning a non-null result will terminate the switch.
485 * <!-- end-user-doc -->
486 * @param object the target of the switch.
487 * @return the result of interpreting the object as an instance of '<em>Association</em>'.
488 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
489 * @generated
490 */
491 public T caseAssociation(Association object) {
492 return null;
493 }
494
495 /**
496 * Returns the result of interpreting the object as an instance of '<em>Decimal Property</em>'.
497 * <!-- begin-user-doc -->
498 * This implementation returns null;
499 * returning a non-null result will terminate the switch.
500 * <!-- end-user-doc -->
501 * @param object the target of the switch.
502 * @return the result of interpreting the object as an instance of '<em>Decimal Property</em>'.
503 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
504 * @generated
505 */
506 public T caseDecimalProperty(DecimalProperty object) {
507 return null;
508 }
509
510 /**
511 * Returns the result of interpreting the object as an instance of '<em>Abstract Business Class</em>'.
512 * <!-- begin-user-doc -->
513 * This implementation returns null;
514 * returning a non-null result will terminate the switch.
515 * <!-- end-user-doc -->
516 * @param object the target of the switch.
517 * @return the result of interpreting the object as an instance of '<em>Abstract Business Class</em>'.
518 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
519 * @generated
520 */
521 public T caseAbstractBusinessClass(AbstractBusinessClass object) {
522 return null;
523 }
524
525 /**
526 * Returns the result of interpreting the object as an instance of '<em>Business Class Reference</em>'.
527 * <!-- begin-user-doc -->
528 * This implementation returns null;
529 * returning a non-null result will terminate the switch.
530 * <!-- end-user-doc -->
531 * @param object the target of the switch.
532 * @return the result of interpreting the object as an instance of '<em>Business Class Reference</em>'.
533 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
534 * @generated
535 */
536 public T caseBusinessClassReference(BusinessClassReference object) {
537 return null;
538 }
539
540 /**
541 * Returns the result of interpreting the object as an instance of '<em>Unique Rule</em>'.
542 * <!-- begin-user-doc -->
543 * This implementation returns null;
544 * returning a non-null result will terminate the switch.
545 * <!-- end-user-doc -->
546 * @param object the target of the switch.
547 * @return the result of interpreting the object as an instance of '<em>Unique Rule</em>'.
548 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
549 * @generated
550 */
551 public T caseUniqueRule(UniqueRule object) {
552 return null;
553 }
554
555 /**
556 * Returns the result of interpreting the object as an instance of '<em>Business Rule</em>'.
557 * <!-- begin-user-doc -->
558 * This implementation returns null;
559 * returning a non-null result will terminate the switch.
560 * <!-- end-user-doc -->
561 * @param object the target of the switch.
562 * @return the result of interpreting the object as an instance of '<em>Business Rule</em>'.
563 * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
564 * @generated
565 */
566 public T caseBusinessRule(BusinessRule object) {
567 return null;
568 }
569
570 /**
571 * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
572 * <!-- begin-user-doc -->
573 * This implementation returns null;
574 * returning a non-null result will terminate the switch, but this is the last case anyway.
575 * <!-- end-user-doc -->
576 * @param object the target of the switch.
577 * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
578 * @see #doSwitch(org.eclipse.emf.ecore.EObject)
579 * @generated
580 */
581 public T defaultCase(EObject object) {
582 return null;
583 }
584
585 } //BusinessDomainDslSwitch