KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > mapping > util > MappingSwitch


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: MappingSwitch.java,v 1.5 2005/06/08 06:21:43 nickb Exp $
16  */

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

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

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

55   public MappingSwitch()
56   {
57     if (modelPackage == null)
58     {
59       modelPackage = MappingPackage.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 MappingPackage.MAPPING_HELPER:
110       {
111         MappingHelper mappingHelper = (MappingHelper)theEObject;
112         Object JavaDoc result = caseMappingHelper(mappingHelper);
113         if (result == null) result = defaultCase(theEObject);
114         return result;
115       }
116       case MappingPackage.MAPPING:
117       {
118         Mapping mapping = (Mapping)theEObject;
119         Object JavaDoc result = caseMapping(mapping);
120         if (result == null) result = defaultCase(theEObject);
121         return result;
122       }
123       case MappingPackage.TYPE_CONVERTER:
124       {
125         TypeConverter typeConverter = (TypeConverter)theEObject;
126         Object JavaDoc result = caseTypeConverter(typeConverter);
127         if (result == null) result = caseMappingHelper(typeConverter);
128         if (result == null) result = defaultCase(theEObject);
129         return result;
130       }
131       case MappingPackage.FUNCTION_PAIR:
132       {
133         FunctionPair functionPair = (FunctionPair)theEObject;
134         Object JavaDoc result = caseFunctionPair(functionPair);
135         if (result == null) result = caseTypeConverter(functionPair);
136         if (result == null) result = caseMappingHelper(functionPair);
137         if (result == null) result = defaultCase(theEObject);
138         return result;
139       }
140       case MappingPackage.FUNCTION_NAME_PAIR:
141       {
142         FunctionNamePair functionNamePair = (FunctionNamePair)theEObject;
143         Object JavaDoc result = caseFunctionNamePair(functionNamePair);
144         if (result == null) result = caseTypeConverter(functionNamePair);
145         if (result == null) result = caseMappingHelper(functionNamePair);
146         if (result == null) result = defaultCase(theEObject);
147         return result;
148       }
149       case MappingPackage.MAPPING_STRATEGY:
150       {
151         MappingStrategy mappingStrategy = (MappingStrategy)theEObject;
152         Object JavaDoc result = caseMappingStrategy(mappingStrategy);
153         if (result == null) result = caseMappingHelper(mappingStrategy);
154         if (result == null) result = defaultCase(theEObject);
155         return result;
156       }
157       case MappingPackage.MAPPING_ROOT:
158       {
159         MappingRoot mappingRoot = (MappingRoot)theEObject;
160         Object JavaDoc result = caseMappingRoot(mappingRoot);
161         if (result == null) result = caseMapping(mappingRoot);
162         if (result == null) result = defaultCase(theEObject);
163         return result;
164       }
165       case MappingPackage.COMPLEX_TYPE_CONVERTER:
166       {
167         ComplexTypeConverter complexTypeConverter = (ComplexTypeConverter)theEObject;
168         Object JavaDoc result = caseComplexTypeConverter(complexTypeConverter);
169         if (result == null) result = caseTypeConverter(complexTypeConverter);
170         if (result == null) result = caseMappingHelper(complexTypeConverter);
171         if (result == null) result = defaultCase(theEObject);
172         return result;
173       }
174       default: return defaultCase(theEObject);
175     }
176   }
177
178   /**
179    * Returns the result of interpretting the object as an instance of '<em>Helper</em>'.
180    * <!-- begin-user-doc -->
181    * This implementation returns null;
182    * returning a non-null result will terminate the switch.
183    * <!-- end-user-doc -->
184    * @param object the target of the switch.
185    * @return the result of interpretting the object as an instance of '<em>Helper</em>'.
186    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
187    * @generated
188    */

189   public Object JavaDoc caseMappingHelper(MappingHelper object)
190   {
191     return null;
192   }
193
194   /**
195    * Returns the result of interpretting the object as an instance of '<em>Mapping</em>'.
196    * <!-- begin-user-doc -->
197    * This implementation returns null;
198    * returning a non-null result will terminate the switch.
199    * <!-- end-user-doc -->
200    * @param object the target of the switch.
201    * @return the result of interpretting the object as an instance of '<em>Mapping</em>'.
202    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
203    * @generated
204    */

205   public Object JavaDoc caseMapping(Mapping object)
206   {
207     return null;
208   }
209
210   /**
211    * Returns the result of interpretting the object as an instance of '<em>Type Converter</em>'.
212    * <!-- begin-user-doc -->
213    * This implementation returns null;
214    * returning a non-null result will terminate the switch.
215    * <!-- end-user-doc -->
216    * @param object the target of the switch.
217    * @return the result of interpretting the object as an instance of '<em>Type Converter</em>'.
218    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
219    * @generated
220    */

221   public Object JavaDoc caseTypeConverter(TypeConverter object)
222   {
223     return null;
224   }
225
226   /**
227    * Returns the result of interpretting the object as an instance of '<em>Function Pair</em>'.
228    * <!-- begin-user-doc -->
229    * This implementation returns null;
230    * returning a non-null result will terminate the switch.
231    * <!-- end-user-doc -->
232    * @param object the target of the switch.
233    * @return the result of interpretting the object as an instance of '<em>Function Pair</em>'.
234    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
235    * @generated
236    */

237   public Object JavaDoc caseFunctionPair(FunctionPair object)
238   {
239     return null;
240   }
241
242   /**
243    * Returns the result of interpretting the object as an instance of '<em>Function Name Pair</em>'.
244    * <!-- begin-user-doc -->
245    * This implementation returns null;
246    * returning a non-null result will terminate the switch.
247    * <!-- end-user-doc -->
248    * @param object the target of the switch.
249    * @return the result of interpretting the object as an instance of '<em>Function Name Pair</em>'.
250    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
251    * @generated
252    */

253   public Object JavaDoc caseFunctionNamePair(FunctionNamePair object)
254   {
255     return null;
256   }
257
258   /**
259    * Returns the result of interpretting the object as an instance of '<em>Strategy</em>'.
260    * <!-- begin-user-doc -->
261    * This implementation returns null;
262    * returning a non-null result will terminate the switch.
263    * <!-- end-user-doc -->
264    * @param object the target of the switch.
265    * @return the result of interpretting the object as an instance of '<em>Strategy</em>'.
266    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
267    * @generated
268    */

269   public Object JavaDoc caseMappingStrategy(MappingStrategy object)
270   {
271     return null;
272   }
273
274   /**
275    * Returns the result of interpretting the object as an instance of '<em>Root</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 interpretting the object as an instance of '<em>Root</em>'.
282    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
283    * @generated
284    */

285   public Object JavaDoc caseMappingRoot(MappingRoot object)
286   {
287     return null;
288   }
289
290   /**
291    * Returns the result of interpretting the object as an instance of '<em>Complex Type Converter</em>'.
292    * <!-- begin-user-doc -->
293    * This implementation returns null;
294    * returning a non-null result will terminate the switch.
295    * <!-- end-user-doc -->
296    * @param object the target of the switch.
297    * @return the result of interpretting the object as an instance of '<em>Complex Type Converter</em>'.
298    * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
299    * @generated
300    */

301   public Object JavaDoc caseComplexTypeConverter(ComplexTypeConverter object)
302   {
303     return null;
304   }
305
306   /**
307    * Returns the result of interpretting the object as an instance of '<em>EObject</em>'.
308    * <!-- begin-user-doc -->
309    * This implementation returns null;
310    * returning a non-null result will terminate the switch, but this is the last case anyway.
311    * <!-- end-user-doc -->
312    * @param object the target of the switch.
313    * @return the result of interpretting the object as an instance of '<em>EObject</em>'.
314    * @see #doSwitch(org.eclipse.emf.ecore.EObject)
315    * @generated
316    */

317   public Object JavaDoc defaultCase(EObject object)
318   {
319     return null;
320   }
321
322 } //MappingSwitch
323
Popular Tags