KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > ecore > genmodel > util > GenModelSwitch


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the Eclipse Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: GenModelSwitch.java,v 1.9 2005/06/08 06:18:44 nickb Exp $
16  */

17 package org.eclipse.emf.codegen.ecore.genmodel.util;
18
19
20 import java.util.List JavaDoc;
21
22 import org.eclipse.emf.codegen.ecore.genmodel.*;
23 import org.eclipse.emf.ecore.EClass;
24 import org.eclipse.emf.ecore.EObject;
25
26
27 /**
28  * <!-- begin-user-doc -->
29  * The <b>Switch</b> for the model's inheritance hierarchy.
30  * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
31  * to invoke the <code>caseXXX</code> method for each class of the model,
32  * starting with the actual class of the object
33  * and proceeding up the inheritance hierarchy
34  * until a non-null result is returned,
35  * which is the result of the switch.
36  * <!-- end-user-doc -->
37  * @see org.eclipse.emf.codegen.ecore.genmodel.GenModelPackage
38  * @generated
39  */

40 public class GenModelSwitch {
41   /**
42    * The cached model package
43    * <!-- begin-user-doc -->
44    * <!-- end-user-doc -->
45    * @generated
46    */

47   protected static GenModelPackage modelPackage;
48
49   /**
50    * Creates an instance of the switch.
51    * <!-- begin-user-doc -->
52    * <!-- end-user-doc -->
53    * @generated
54    */

55   public GenModelSwitch()
56   {
57     if (modelPackage == null)
58     {
59       modelPackage = GenModelPackage.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 Object JavaDoc doSwitch(EObject theEObject)
71   {
72     return doSwitch(theEObject.eClass(), theEObject);
73   }
74
75   /**
76    * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
77    * <!-- begin-user-doc -->
78    * <!-- end-user-doc -->
79    * @return the first non-null result returned by a <code>caseXXX</code> call.
80    * @generated
81    */

82   protected Object JavaDoc doSwitch(EClass theEClass, EObject theEObject)
83   {
84     if (theEClass.eContainer() == modelPackage)
85     {
86       return doSwitch(theEClass.getClassifierID(), theEObject);
87     }
88     else
89     {
90       List JavaDoc eSuperTypes = theEClass.getESuperTypes();
91       return
92         eSuperTypes.isEmpty() ?
93           defaultCase(theEObject) :
94           doSwitch((EClass)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 Object JavaDoc doSwitch(int classifierID, EObject theEObject)
106   {
107     switch (classifierID)
108     {
109       case GenModelPackage.GEN_MODEL:
110       {
111         GenModel genModel = (GenModel)theEObject;
112         Object JavaDoc result = caseGenModel(genModel);
113         if (result == null) result = caseGenBase(genModel);
114         if (result == null) result = defaultCase(theEObject);
115         return result;
116       }
117       case GenModelPackage.GEN_PACKAGE:
118       {
119         GenPackage genPackage = (GenPackage)theEObject;
120         Object JavaDoc result = caseGenPackage(genPackage);
121         if (result == null) result = caseGenBase(genPackage);
122         if (result == null) result = defaultCase(theEObject);
123         return result;
124       }
125       case GenModelPackage.GEN_CLASS:
126       {
127         GenClass genClass = (GenClass)theEObject;
128         Object JavaDoc result = caseGenClass(genClass);
129         if (result == null) result = caseGenClassifier(genClass);
130         if (result == null) result = caseGenBase(genClass);
131         if (result == null) result = defaultCase(theEObject);
132         return result;
133       }
134       case GenModelPackage.GEN_FEATURE:
135       {
136         GenFeature genFeature = (GenFeature)theEObject;
137         Object JavaDoc result = caseGenFeature(genFeature);
138         if (result == null) result = caseGenTypedElement(genFeature);
139         if (result == null) result = caseGenBase(genFeature);
140         if (result == null) result = defaultCase(theEObject);
141         return result;
142       }
143       case GenModelPackage.GEN_BASE:
144       {
145         GenBase genBase = (GenBase)theEObject;
146         Object JavaDoc result = caseGenBase(genBase);
147         if (result == null) result = defaultCase(theEObject);
148         return result;
149       }
150       case GenModelPackage.GEN_ENUM:
151       {
152         GenEnum genEnum = (GenEnum)theEObject;
153         Object JavaDoc result = caseGenEnum(genEnum);
154         if (result == null) result = caseGenDataType(genEnum);
155         if (result == null) result = caseGenClassifier(genEnum);
156         if (result == null) result = caseGenBase(genEnum);
157         if (result == null) result = defaultCase(theEObject);
158         return result;
159       }
160       case GenModelPackage.GEN_ENUM_LITERAL:
161       {
162         GenEnumLiteral genEnumLiteral = (GenEnumLiteral)theEObject;
163         Object JavaDoc result = caseGenEnumLiteral(genEnumLiteral);
164         if (result == null) result = caseGenBase(genEnumLiteral);
165         if (result == null) result = defaultCase(theEObject);
166         return result;
167       }
168       case GenModelPackage.GEN_CLASSIFIER:
169       {
170         GenClassifier genClassifier = (GenClassifier)theEObject;
171         Object JavaDoc result = caseGenClassifier(genClassifier);
172         if (result == null) result = caseGenBase(genClassifier);
173         if (result == null) result = defaultCase(theEObject);
174         return result;
175       }
176       case GenModelPackage.GEN_DATA_TYPE:
177       {
178         GenDataType genDataType = (GenDataType)theEObject;
179         Object JavaDoc result = caseGenDataType(genDataType);
180         if (result == null) result = caseGenClassifier(genDataType);
181         if (result == null) result = caseGenBase(genDataType);
182         if (result == null) result = defaultCase(theEObject);
183         return result;
184       }
185       case GenModelPackage.GEN_OPERATION:
186       {
187         GenOperation genOperation = (GenOperation)theEObject;
188         Object JavaDoc result = caseGenOperation(genOperation);
189         if (result == null) result = caseGenTypedElement(genOperation);
190         if (result == null) result = caseGenBase(genOperation);
191         if (result == null) result = defaultCase(theEObject);
192         return result;
193       }
194       case GenModelPackage.GEN_PARAMETER:
195       {
196         GenParameter genParameter = (GenParameter)theEObject;
197         Object JavaDoc result = caseGenParameter(genParameter);
198         if (result == null) result = caseGenTypedElement(genParameter);
199         if (result == null) result = caseGenBase(genParameter);
200         if (result == null) result = defaultCase(theEObject);
201         return result;
202       }
203       case GenModelPackage.GEN_TYPED_ELEMENT:
204       {
205         GenTypedElement genTypedElement = (GenTypedElement)theEObject;
206         Object JavaDoc result = caseGenTypedElement(genTypedElement);
207         if (result == null) result = caseGenBase(genTypedElement);
208         if (result == null) result = defaultCase(theEObject);
209         return result;
210       }
211       default: return defaultCase(theEObject);
212     }
213   }
214
215   /**
216    * Returns the result of interpretting the object as an instance of '<em>Gen Model</em>'.
217    * <!-- begin-user-doc -->
218    * This implementation returns null;
219    * returning a non-null result will terminate the switch.
220    * <!-- end-user-doc -->
221    * @param object the target of the switch.
222    * @return the result of interpretting the object as an instance of '<em>Gen Model</em>'.
223    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
224    * @generated
225    */

226   public Object JavaDoc caseGenModel(GenModel object)
227   {
228     return null;
229   }
230
231   /**
232    * Returns the result of interpretting the object as an instance of '<em>Gen Package</em>'.
233    * <!-- begin-user-doc -->
234    * This implementation returns null;
235    * returning a non-null result will terminate the switch.
236    * <!-- end-user-doc -->
237    * @param object the target of the switch.
238    * @return the result of interpretting the object as an instance of '<em>Gen Package</em>'.
239    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
240    * @generated
241    */

242   public Object JavaDoc caseGenPackage(GenPackage object)
243   {
244     return null;
245   }
246
247   /**
248    * Returns the result of interpretting the object as an instance of '<em>Gen Class</em>'.
249    * <!-- begin-user-doc -->
250    * This implementation returns null;
251    * returning a non-null result will terminate the switch.
252    * <!-- end-user-doc -->
253    * @param object the target of the switch.
254    * @return the result of interpretting the object as an instance of '<em>Gen Class</em>'.
255    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
256    * @generated
257    */

258   public Object JavaDoc caseGenClass(GenClass object)
259   {
260     return null;
261   }
262
263   /**
264    * Returns the result of interpretting the object as an instance of '<em>Gen Feature</em>'.
265    * <!-- begin-user-doc -->
266    * This implementation returns null;
267    * returning a non-null result will terminate the switch.
268    * <!-- end-user-doc -->
269    * @param object the target of the switch.
270    * @return the result of interpretting the object as an instance of '<em>Gen Feature</em>'.
271    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
272    * @generated
273    */

274   public Object JavaDoc caseGenFeature(GenFeature object)
275   {
276     return null;
277   }
278
279   /**
280    * Returns the result of interpretting the object as an instance of '<em>Gen Base</em>'.
281    * <!-- begin-user-doc -->
282    * This implementation returns null;
283    * returning a non-null result will terminate the switch.
284    * <!-- end-user-doc -->
285    * @param object the target of the switch.
286    * @return the result of interpretting the object as an instance of '<em>Gen Base</em>'.
287    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
288    * @generated
289    */

290   public Object JavaDoc caseGenBase(GenBase object)
291   {
292     return null;
293   }
294
295   /**
296    * Returns the result of interpretting the object as an instance of '<em>Gen Enum</em>'.
297    * <!-- begin-user-doc -->
298    * This implementation returns null;
299    * returning a non-null result will terminate the switch.
300    * <!-- end-user-doc -->
301    * @param object the target of the switch.
302    * @return the result of interpretting the object as an instance of '<em>Gen Enum</em>'.
303    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
304    * @generated
305    */

306   public Object JavaDoc caseGenEnum(GenEnum object)
307   {
308     return null;
309   }
310
311   /**
312    * Returns the result of interpretting the object as an instance of '<em>Gen Enum Literal</em>'.
313    * <!-- begin-user-doc -->
314    * This implementation returns null;
315    * returning a non-null result will terminate the switch.
316    * <!-- end-user-doc -->
317    * @param object the target of the switch.
318    * @return the result of interpretting the object as an instance of '<em>Gen Enum Literal</em>'.
319    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
320    * @generated
321    */

322   public Object JavaDoc caseGenEnumLiteral(GenEnumLiteral object)
323   {
324     return null;
325   }
326
327   /**
328    * Returns the result of interpretting the object as an instance of '<em>Gen Classifier</em>'.
329    * <!-- begin-user-doc -->
330    * This implementation returns null;
331    * returning a non-null result will terminate the switch.
332    * <!-- end-user-doc -->
333    * @param object the target of the switch.
334    * @return the result of interpretting the object as an instance of '<em>Gen Classifier</em>'.
335    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
336    * @generated
337    */

338   public Object JavaDoc caseGenClassifier(GenClassifier object)
339   {
340     return null;
341   }
342
343   /**
344    * Returns the result of interpretting the object as an instance of '<em>Gen Data Type</em>'.
345    * <!-- begin-user-doc -->
346    * This implementation returns null;
347    * returning a non-null result will terminate the switch.
348    * <!-- end-user-doc -->
349    * @param object the target of the switch.
350    * @return the result of interpretting the object as an instance of '<em>Gen Data Type</em>'.
351    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
352    * @generated
353    */

354   public Object JavaDoc caseGenDataType(GenDataType object)
355   {
356     return null;
357   }
358
359   /**
360    * Returns the result of interpretting the object as an instance of '<em>Gen Operation</em>'.
361    * <!-- begin-user-doc -->
362    * This implementation returns null;
363    * returning a non-null result will terminate the switch.
364    * <!-- end-user-doc -->
365    * @param object the target of the switch.
366    * @return the result of interpretting the object as an instance of '<em>Gen Operation</em>'.
367    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
368    * @generated
369    */

370   public Object JavaDoc caseGenOperation(GenOperation object)
371   {
372     return null;
373   }
374
375   /**
376    * Returns the result of interpretting the object as an instance of '<em>Gen Parameter</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 interpretting the object as an instance of '<em>Gen Parameter</em>'.
383    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
384    * @generated
385    */

386   public Object JavaDoc caseGenParameter(GenParameter object)
387   {
388     return null;
389   }
390
391   /**
392    * Returns the result of interpretting the object as an instance of '<em>Gen Typed Element</em>'.
393    * <!-- begin-user-doc -->
394    * This implementation returns null;
395    * returning a non-null result will terminate the switch.
396    * <!-- end-user-doc -->
397    * @param object the target of the switch.
398    * @return the result of interpretting the object as an instance of '<em>Gen Typed Element</em>'.
399    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
400    * @generated
401    */

402   public Object JavaDoc caseGenTypedElement(GenTypedElement object)
403   {
404     return null;
405   }
406
407   /**
408    * Returns the result of interpretting the object as an instance of '<em>EObject</em>'.
409    * <!-- begin-user-doc -->
410    * This implementation returns null;
411    * returning a non-null result will terminate the switch, but this is the last case anyway.
412    * <!-- end-user-doc -->
413    * @param object the target of the switch.
414    * @return the result of interpretting the object as an instance of '<em>EObject</em>'.
415    * @see #doSwitch(org.eclipse.emf.ecore.EObject)
416    * @generated
417    */

418   public Object JavaDoc defaultCase(EObject object)
419   {
420     return null;
421   }
422
423 } //GenModelSwitch
424
Popular Tags