1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.core.entity.util; |
7 | |
8 | import java.util.List; |
9 | |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.EObject; |
12 | |
13 | import de.uka.ipd.sdq.identifier.Identifier; |
14 | import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure; |
15 | import de.uka.ipd.sdq.pcm.core.entity.*; |
16 | import de.uka.ipd.sdq.pcm.core.entity.ComposedProvidingRequiringEntity; |
17 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
18 | import de.uka.ipd.sdq.pcm.core.entity.EntityPackage; |
19 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingEntity; |
20 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingRequiringEntity; |
21 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceRequiringEntity; |
22 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
23 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceProvidingEntity; |
24 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceProvidingRequiringEntity; |
25 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceRequiringEntity; |
26 | import de.uka.ipd.sdq.pcm.core.entity.ResourceProvidedRole; |
27 | import de.uka.ipd.sdq.pcm.core.entity.ResourceRequiredRole; |
28 | import de.uka.ipd.sdq.pcm.repository.Role; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * The <b>Switch</b> for the model's inheritance hierarchy. |
33 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
34 | * to invoke the <code>caseXXX</code> method for each class of the model, |
35 | * starting with the actual class of the object |
36 | * and proceeding up the inheritance hierarchy |
37 | * until a non-null result is returned, |
38 | * which is the result of the switch. |
39 | * <!-- end-user-doc --> |
40 | * @see de.uka.ipd.sdq.pcm.core.entity.EntityPackage |
41 | * @generated |
42 | */ |
43 | public class EntitySwitch<T> { |
44 | /** |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
50 | |
51 | /** |
52 | * The cached model package |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @generated |
56 | */ |
57 | protected static EntityPackage modelPackage; |
58 | |
59 | /** |
60 | * Creates an instance of the switch. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @generated |
64 | */ |
65 | public EntitySwitch() { |
66 | if (modelPackage == null) { |
67 | modelPackage = EntityPackage.eINSTANCE; |
68 | } |
69 | } |
70 | |
71 | /** |
72 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
73 | * <!-- begin-user-doc --> |
74 | * <!-- end-user-doc --> |
75 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
76 | * @generated |
77 | */ |
78 | public T doSwitch(EObject theEObject) { |
79 | return doSwitch(theEObject.eClass(), theEObject); |
80 | } |
81 | |
82 | /** |
83 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
87 | * @generated |
88 | */ |
89 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
90 | if (theEClass.eContainer() == modelPackage) { |
91 | return doSwitch(theEClass.getClassifierID(), theEObject); |
92 | } |
93 | else { |
94 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
95 | return |
96 | eSuperTypes.isEmpty() ? |
97 | defaultCase(theEObject) : |
98 | doSwitch(eSuperTypes.get(0), theEObject); |
99 | } |
100 | } |
101 | |
102 | /** |
103 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
107 | * @generated |
108 | */ |
109 | protected T doSwitch(int classifierID, EObject theEObject) { |
110 | switch (classifierID) { |
111 | case EntityPackage.RESOURCE_PROVIDED_ROLE: { |
112 | ResourceProvidedRole resourceProvidedRole = (ResourceProvidedRole)theEObject; |
113 | T result = caseResourceProvidedRole(resourceProvidedRole); |
114 | if (result == null) result = caseRole(resourceProvidedRole); |
115 | if (result == null) result = caseEntity(resourceProvidedRole); |
116 | if (result == null) result = caseIdentifier(resourceProvidedRole); |
117 | if (result == null) result = caseNamedElement(resourceProvidedRole); |
118 | if (result == null) result = defaultCase(theEObject); |
119 | return result; |
120 | } |
121 | case EntityPackage.INTERFACE_PROVIDING_REQUIRING_ENTITY: { |
122 | InterfaceProvidingRequiringEntity interfaceProvidingRequiringEntity = (InterfaceProvidingRequiringEntity)theEObject; |
123 | T result = caseInterfaceProvidingRequiringEntity(interfaceProvidingRequiringEntity); |
124 | if (result == null) result = caseInterfaceProvidingEntity(interfaceProvidingRequiringEntity); |
125 | if (result == null) result = caseInterfaceRequiringEntity(interfaceProvidingRequiringEntity); |
126 | if (result == null) result = caseResourceInterfaceRequiringEntity(interfaceProvidingRequiringEntity); |
127 | if (result == null) result = caseEntity(interfaceProvidingRequiringEntity); |
128 | if (result == null) result = caseIdentifier(interfaceProvidingRequiringEntity); |
129 | if (result == null) result = caseNamedElement(interfaceProvidingRequiringEntity); |
130 | if (result == null) result = defaultCase(theEObject); |
131 | return result; |
132 | } |
133 | case EntityPackage.INTERFACE_PROVIDING_ENTITY: { |
134 | InterfaceProvidingEntity interfaceProvidingEntity = (InterfaceProvidingEntity)theEObject; |
135 | T result = caseInterfaceProvidingEntity(interfaceProvidingEntity); |
136 | if (result == null) result = caseEntity(interfaceProvidingEntity); |
137 | if (result == null) result = caseIdentifier(interfaceProvidingEntity); |
138 | if (result == null) result = caseNamedElement(interfaceProvidingEntity); |
139 | if (result == null) result = defaultCase(theEObject); |
140 | return result; |
141 | } |
142 | case EntityPackage.INTERFACE_REQUIRING_ENTITY: { |
143 | InterfaceRequiringEntity interfaceRequiringEntity = (InterfaceRequiringEntity)theEObject; |
144 | T result = caseInterfaceRequiringEntity(interfaceRequiringEntity); |
145 | if (result == null) result = caseResourceInterfaceRequiringEntity(interfaceRequiringEntity); |
146 | if (result == null) result = caseEntity(interfaceRequiringEntity); |
147 | if (result == null) result = caseIdentifier(interfaceRequiringEntity); |
148 | if (result == null) result = caseNamedElement(interfaceRequiringEntity); |
149 | if (result == null) result = defaultCase(theEObject); |
150 | return result; |
151 | } |
152 | case EntityPackage.RESOURCE_INTERFACE_REQUIRING_ENTITY: { |
153 | ResourceInterfaceRequiringEntity resourceInterfaceRequiringEntity = (ResourceInterfaceRequiringEntity)theEObject; |
154 | T result = caseResourceInterfaceRequiringEntity(resourceInterfaceRequiringEntity); |
155 | if (result == null) result = caseEntity(resourceInterfaceRequiringEntity); |
156 | if (result == null) result = caseIdentifier(resourceInterfaceRequiringEntity); |
157 | if (result == null) result = caseNamedElement(resourceInterfaceRequiringEntity); |
158 | if (result == null) result = defaultCase(theEObject); |
159 | return result; |
160 | } |
161 | case EntityPackage.RESOURCE_REQUIRED_ROLE: { |
162 | ResourceRequiredRole resourceRequiredRole = (ResourceRequiredRole)theEObject; |
163 | T result = caseResourceRequiredRole(resourceRequiredRole); |
164 | if (result == null) result = caseRole(resourceRequiredRole); |
165 | if (result == null) result = caseEntity(resourceRequiredRole); |
166 | if (result == null) result = caseIdentifier(resourceRequiredRole); |
167 | if (result == null) result = caseNamedElement(resourceRequiredRole); |
168 | if (result == null) result = defaultCase(theEObject); |
169 | return result; |
170 | } |
171 | case EntityPackage.RESOURCE_INTERFACE_PROVIDING_ENTITY: { |
172 | ResourceInterfaceProvidingEntity resourceInterfaceProvidingEntity = (ResourceInterfaceProvidingEntity)theEObject; |
173 | T result = caseResourceInterfaceProvidingEntity(resourceInterfaceProvidingEntity); |
174 | if (result == null) result = caseEntity(resourceInterfaceProvidingEntity); |
175 | if (result == null) result = caseIdentifier(resourceInterfaceProvidingEntity); |
176 | if (result == null) result = caseNamedElement(resourceInterfaceProvidingEntity); |
177 | if (result == null) result = defaultCase(theEObject); |
178 | return result; |
179 | } |
180 | case EntityPackage.COMPOSED_PROVIDING_REQUIRING_ENTITY: { |
181 | ComposedProvidingRequiringEntity composedProvidingRequiringEntity = (ComposedProvidingRequiringEntity)theEObject; |
182 | T result = caseComposedProvidingRequiringEntity(composedProvidingRequiringEntity); |
183 | if (result == null) result = caseComposedStructure(composedProvidingRequiringEntity); |
184 | if (result == null) result = caseInterfaceProvidingRequiringEntity(composedProvidingRequiringEntity); |
185 | if (result == null) result = caseInterfaceProvidingEntity(composedProvidingRequiringEntity); |
186 | if (result == null) result = caseInterfaceRequiringEntity(composedProvidingRequiringEntity); |
187 | if (result == null) result = caseIdentifier(composedProvidingRequiringEntity); |
188 | if (result == null) result = caseNamedElement(composedProvidingRequiringEntity); |
189 | if (result == null) result = caseResourceInterfaceRequiringEntity(composedProvidingRequiringEntity); |
190 | if (result == null) result = caseEntity(composedProvidingRequiringEntity); |
191 | if (result == null) result = defaultCase(theEObject); |
192 | return result; |
193 | } |
194 | case EntityPackage.NAMED_ELEMENT: { |
195 | NamedElement namedElement = (NamedElement)theEObject; |
196 | T result = caseNamedElement(namedElement); |
197 | if (result == null) result = defaultCase(theEObject); |
198 | return result; |
199 | } |
200 | case EntityPackage.RESOURCE_INTERFACE_PROVIDING_REQUIRING_ENTITY: { |
201 | ResourceInterfaceProvidingRequiringEntity resourceInterfaceProvidingRequiringEntity = (ResourceInterfaceProvidingRequiringEntity)theEObject; |
202 | T result = caseResourceInterfaceProvidingRequiringEntity(resourceInterfaceProvidingRequiringEntity); |
203 | if (result == null) result = caseResourceInterfaceRequiringEntity(resourceInterfaceProvidingRequiringEntity); |
204 | if (result == null) result = caseResourceInterfaceProvidingEntity(resourceInterfaceProvidingRequiringEntity); |
205 | if (result == null) result = caseEntity(resourceInterfaceProvidingRequiringEntity); |
206 | if (result == null) result = caseIdentifier(resourceInterfaceProvidingRequiringEntity); |
207 | if (result == null) result = caseNamedElement(resourceInterfaceProvidingRequiringEntity); |
208 | if (result == null) result = defaultCase(theEObject); |
209 | return result; |
210 | } |
211 | case EntityPackage.ENTITY: { |
212 | Entity entity = (Entity)theEObject; |
213 | T result = caseEntity(entity); |
214 | if (result == null) result = caseIdentifier(entity); |
215 | if (result == null) result = caseNamedElement(entity); |
216 | if (result == null) result = defaultCase(theEObject); |
217 | return result; |
218 | } |
219 | default: return defaultCase(theEObject); |
220 | } |
221 | } |
222 | |
223 | /** |
224 | * Returns the result of interpreting the object as an instance of '<em>Resource Provided Role</em>'. |
225 | * <!-- begin-user-doc --> |
226 | * This implementation returns null; |
227 | * returning a non-null result will terminate the switch. |
228 | * <!-- end-user-doc --> |
229 | * @param object the target of the switch. |
230 | * @return the result of interpreting the object as an instance of '<em>Resource Provided Role</em>'. |
231 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
232 | * @generated |
233 | */ |
234 | public T caseResourceProvidedRole(ResourceProvidedRole object) { |
235 | return null; |
236 | } |
237 | |
238 | /** |
239 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
240 | * <!-- begin-user-doc --> |
241 | * This implementation returns null; |
242 | * returning a non-null result will terminate the switch. |
243 | * <!-- end-user-doc --> |
244 | * @param object the target of the switch. |
245 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
246 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
247 | * @generated |
248 | */ |
249 | public T caseNamedElement(NamedElement object) { |
250 | return null; |
251 | } |
252 | |
253 | /** |
254 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Providing Requiring Entity</em>'. |
255 | * <!-- begin-user-doc --> |
256 | * This implementation returns null; |
257 | * returning a non-null result will terminate the switch. |
258 | * <!-- end-user-doc --> |
259 | * @param object the target of the switch. |
260 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Providing Requiring Entity</em>'. |
261 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
262 | * @generated |
263 | */ |
264 | public T caseResourceInterfaceProvidingRequiringEntity(ResourceInterfaceProvidingRequiringEntity object) { |
265 | return null; |
266 | } |
267 | |
268 | /** |
269 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
270 | * <!-- begin-user-doc --> |
271 | * This implementation returns null; |
272 | * returning a non-null result will terminate the switch. |
273 | * <!-- end-user-doc --> |
274 | * @param object the target of the switch. |
275 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
276 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
277 | * @generated |
278 | */ |
279 | public T caseInterfaceProvidingEntity(InterfaceProvidingEntity object) { |
280 | return null; |
281 | } |
282 | |
283 | /** |
284 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
285 | * <!-- begin-user-doc --> |
286 | * This implementation returns null; |
287 | * returning a non-null result will terminate the switch. |
288 | * <!-- end-user-doc --> |
289 | * @param object the target of the switch. |
290 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
291 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
292 | * @generated |
293 | */ |
294 | public T caseInterfaceProvidingRequiringEntity(InterfaceProvidingRequiringEntity object) { |
295 | return null; |
296 | } |
297 | |
298 | /** |
299 | * Returns the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
300 | * <!-- begin-user-doc --> |
301 | * This implementation returns null; |
302 | * returning a non-null result will terminate the switch. |
303 | * <!-- end-user-doc --> |
304 | * @param object the target of the switch. |
305 | * @return the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
306 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
307 | * @generated |
308 | */ |
309 | public T caseInterfaceRequiringEntity(InterfaceRequiringEntity object) { |
310 | return null; |
311 | } |
312 | |
313 | /** |
314 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
315 | * <!-- begin-user-doc --> |
316 | * This implementation returns null; |
317 | * returning a non-null result will terminate the switch. |
318 | * <!-- end-user-doc --> |
319 | * @param object the target of the switch. |
320 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
321 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
322 | * @generated |
323 | */ |
324 | public T caseResourceInterfaceRequiringEntity(ResourceInterfaceRequiringEntity object) { |
325 | return null; |
326 | } |
327 | |
328 | /** |
329 | * Returns the result of interpreting the object as an instance of '<em>Resource Required Role</em>'. |
330 | * <!-- begin-user-doc --> |
331 | * This implementation returns null; |
332 | * returning a non-null result will terminate the switch. |
333 | * <!-- end-user-doc --> |
334 | * @param object the target of the switch. |
335 | * @return the result of interpreting the object as an instance of '<em>Resource Required Role</em>'. |
336 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
337 | * @generated |
338 | */ |
339 | public T caseResourceRequiredRole(ResourceRequiredRole object) { |
340 | return null; |
341 | } |
342 | |
343 | /** |
344 | * Returns the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</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 interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
351 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
352 | * @generated |
353 | */ |
354 | public T caseComposedProvidingRequiringEntity(ComposedProvidingRequiringEntity object) { |
355 | return null; |
356 | } |
357 | |
358 | /** |
359 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Providing Entity</em>'. |
360 | * <!-- begin-user-doc --> |
361 | * This implementation returns null; |
362 | * returning a non-null result will terminate the switch. |
363 | * <!-- end-user-doc --> |
364 | * @param object the target of the switch. |
365 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Providing Entity</em>'. |
366 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
367 | * @generated |
368 | */ |
369 | public T caseResourceInterfaceProvidingEntity(ResourceInterfaceProvidingEntity object) { |
370 | return null; |
371 | } |
372 | |
373 | /** |
374 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
375 | * <!-- begin-user-doc --> |
376 | * This implementation returns null; |
377 | * returning a non-null result will terminate the switch. |
378 | * <!-- end-user-doc --> |
379 | * @param object the target of the switch. |
380 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
381 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
382 | * @generated |
383 | */ |
384 | public T caseEntity(Entity object) { |
385 | return null; |
386 | } |
387 | |
388 | /** |
389 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
390 | * <!-- begin-user-doc --> |
391 | * This implementation returns null; |
392 | * returning a non-null result will terminate the switch. |
393 | * <!-- end-user-doc --> |
394 | * @param object the target of the switch. |
395 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
396 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
397 | * @generated |
398 | */ |
399 | public T caseIdentifier(Identifier object) { |
400 | return null; |
401 | } |
402 | |
403 | /** |
404 | * Returns the result of interpreting the object as an instance of '<em>Role</em>'. |
405 | * <!-- begin-user-doc --> |
406 | * This implementation returns null; |
407 | * returning a non-null result will terminate the switch. |
408 | * <!-- end-user-doc --> |
409 | * @param object the target of the switch. |
410 | * @return the result of interpreting the object as an instance of '<em>Role</em>'. |
411 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
412 | * @generated |
413 | */ |
414 | public T caseRole(Role object) { |
415 | return null; |
416 | } |
417 | |
418 | /** |
419 | * Returns the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
420 | * <!-- begin-user-doc --> |
421 | * This implementation returns null; |
422 | * returning a non-null result will terminate the switch. |
423 | * <!-- end-user-doc --> |
424 | * @param object the target of the switch. |
425 | * @return the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
426 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
427 | * @generated |
428 | */ |
429 | public T caseComposedStructure(ComposedStructure object) { |
430 | return null; |
431 | } |
432 | |
433 | /** |
434 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
435 | * <!-- begin-user-doc --> |
436 | * This implementation returns null; |
437 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
438 | * <!-- end-user-doc --> |
439 | * @param object the target of the switch. |
440 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
441 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
442 | * @generated |
443 | */ |
444 | public T defaultCase(EObject object) { |
445 | return null; |
446 | } |
447 | |
448 | } //EntitySwitch |