1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.resourcetype.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.entity.Entity; |
15 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
16 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceProvidingEntity; |
17 | import de.uka.ipd.sdq.pcm.resourcetype.*; |
18 | import de.uka.ipd.sdq.pcm.resourcetype.CommunicationLinkResourceType; |
19 | import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType; |
20 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceInterface; |
21 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceRepository; |
22 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceSignature; |
23 | import de.uka.ipd.sdq.pcm.resourcetype.ResourceType; |
24 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage; |
25 | import de.uka.ipd.sdq.units.UnitCarryingElement; |
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 de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage |
38 | * @generated |
39 | */ |
40 | public class ResourcetypeSwitch<T> { |
41 | /** |
42 | * <!-- begin-user-doc --> |
43 | * <!-- end-user-doc --> |
44 | * @generated |
45 | */ |
46 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
47 | |
48 | /** |
49 | * The cached model package |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | protected static ResourcetypePackage modelPackage; |
55 | |
56 | /** |
57 | * Creates an instance of the switch. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @generated |
61 | */ |
62 | public ResourcetypeSwitch() { |
63 | if (modelPackage == null) { |
64 | modelPackage = ResourcetypePackage.eINSTANCE; |
65 | } |
66 | } |
67 | |
68 | /** |
69 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
70 | * <!-- begin-user-doc --> |
71 | * <!-- end-user-doc --> |
72 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
73 | * @generated |
74 | */ |
75 | public T doSwitch(EObject theEObject) { |
76 | return doSwitch(theEObject.eClass(), theEObject); |
77 | } |
78 | |
79 | /** |
80 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
84 | * @generated |
85 | */ |
86 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
87 | if (theEClass.eContainer() == modelPackage) { |
88 | return doSwitch(theEClass.getClassifierID(), theEObject); |
89 | } |
90 | else { |
91 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
92 | return |
93 | eSuperTypes.isEmpty() ? |
94 | defaultCase(theEObject) : |
95 | doSwitch(eSuperTypes.get(0), theEObject); |
96 | } |
97 | } |
98 | |
99 | /** |
100 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
101 | * <!-- begin-user-doc --> |
102 | * <!-- end-user-doc --> |
103 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
104 | * @generated |
105 | */ |
106 | protected T doSwitch(int classifierID, EObject theEObject) { |
107 | switch (classifierID) { |
108 | case ResourcetypePackage.RESOURCE_SIGNATURE: { |
109 | ResourceSignature resourceSignature = (ResourceSignature)theEObject; |
110 | T result = caseResourceSignature(resourceSignature); |
111 | if (result == null) result = caseEntity(resourceSignature); |
112 | if (result == null) result = caseIdentifier(resourceSignature); |
113 | if (result == null) result = caseNamedElement(resourceSignature); |
114 | if (result == null) result = defaultCase(theEObject); |
115 | return result; |
116 | } |
117 | case ResourcetypePackage.PROCESSING_RESOURCE_TYPE: { |
118 | ProcessingResourceType processingResourceType = (ProcessingResourceType)theEObject; |
119 | T result = caseProcessingResourceType(processingResourceType); |
120 | if (result == null) result = caseResourceType(processingResourceType); |
121 | if (result == null) result = caseUnitCarryingElement(processingResourceType); |
122 | if (result == null) result = caseResourceInterfaceProvidingEntity(processingResourceType); |
123 | if (result == null) result = caseEntity(processingResourceType); |
124 | if (result == null) result = caseIdentifier(processingResourceType); |
125 | if (result == null) result = caseNamedElement(processingResourceType); |
126 | if (result == null) result = defaultCase(theEObject); |
127 | return result; |
128 | } |
129 | case ResourcetypePackage.RESOURCE_TYPE: { |
130 | ResourceType resourceType = (ResourceType)theEObject; |
131 | T result = caseResourceType(resourceType); |
132 | if (result == null) result = caseUnitCarryingElement(resourceType); |
133 | if (result == null) result = caseResourceInterfaceProvidingEntity(resourceType); |
134 | if (result == null) result = caseEntity(resourceType); |
135 | if (result == null) result = caseIdentifier(resourceType); |
136 | if (result == null) result = caseNamedElement(resourceType); |
137 | if (result == null) result = defaultCase(theEObject); |
138 | return result; |
139 | } |
140 | case ResourcetypePackage.RESOURCE_REPOSITORY: { |
141 | ResourceRepository resourceRepository = (ResourceRepository)theEObject; |
142 | T result = caseResourceRepository(resourceRepository); |
143 | if (result == null) result = defaultCase(theEObject); |
144 | return result; |
145 | } |
146 | case ResourcetypePackage.COMMUNICATION_LINK_RESOURCE_TYPE: { |
147 | CommunicationLinkResourceType communicationLinkResourceType = (CommunicationLinkResourceType)theEObject; |
148 | T result = caseCommunicationLinkResourceType(communicationLinkResourceType); |
149 | if (result == null) result = caseProcessingResourceType(communicationLinkResourceType); |
150 | if (result == null) result = caseResourceType(communicationLinkResourceType); |
151 | if (result == null) result = caseUnitCarryingElement(communicationLinkResourceType); |
152 | if (result == null) result = caseResourceInterfaceProvidingEntity(communicationLinkResourceType); |
153 | if (result == null) result = caseEntity(communicationLinkResourceType); |
154 | if (result == null) result = caseIdentifier(communicationLinkResourceType); |
155 | if (result == null) result = caseNamedElement(communicationLinkResourceType); |
156 | if (result == null) result = defaultCase(theEObject); |
157 | return result; |
158 | } |
159 | case ResourcetypePackage.RESOURCE_INTERFACE: { |
160 | ResourceInterface resourceInterface = (ResourceInterface)theEObject; |
161 | T result = caseResourceInterface(resourceInterface); |
162 | if (result == null) result = caseEntity(resourceInterface); |
163 | if (result == null) result = caseIdentifier(resourceInterface); |
164 | if (result == null) result = caseNamedElement(resourceInterface); |
165 | if (result == null) result = defaultCase(theEObject); |
166 | return result; |
167 | } |
168 | default: return defaultCase(theEObject); |
169 | } |
170 | } |
171 | |
172 | /** |
173 | * Returns the result of interpreting the object as an instance of '<em>Resource Signature</em>'. |
174 | * <!-- begin-user-doc --> |
175 | * This implementation returns null; |
176 | * returning a non-null result will terminate the switch. |
177 | * <!-- end-user-doc --> |
178 | * @param object the target of the switch. |
179 | * @return the result of interpreting the object as an instance of '<em>Resource Signature</em>'. |
180 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
181 | * @generated |
182 | */ |
183 | public T caseResourceSignature(ResourceSignature object) { |
184 | return null; |
185 | } |
186 | |
187 | /** |
188 | * Returns the result of interpreting the object as an instance of '<em>Resource Type</em>'. |
189 | * <!-- begin-user-doc --> |
190 | * This implementation returns null; |
191 | * returning a non-null result will terminate the switch. |
192 | * <!-- end-user-doc --> |
193 | * @param object the target of the switch. |
194 | * @return the result of interpreting the object as an instance of '<em>Resource Type</em>'. |
195 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
196 | * @generated |
197 | */ |
198 | public T caseResourceType(ResourceType object) { |
199 | return null; |
200 | } |
201 | |
202 | /** |
203 | * Returns the result of interpreting the object as an instance of '<em>Resource Repository</em>'. |
204 | * <!-- begin-user-doc --> |
205 | * This implementation returns null; |
206 | * returning a non-null result will terminate the switch. |
207 | * <!-- end-user-doc --> |
208 | * @param object the target of the switch. |
209 | * @return the result of interpreting the object as an instance of '<em>Resource Repository</em>'. |
210 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
211 | * @generated |
212 | */ |
213 | public T caseResourceRepository(ResourceRepository object) { |
214 | return null; |
215 | } |
216 | |
217 | /** |
218 | * Returns the result of interpreting the object as an instance of '<em>Communication Link Resource Type</em>'. |
219 | * <!-- begin-user-doc --> |
220 | * This implementation returns null; |
221 | * returning a non-null result will terminate the switch. |
222 | * <!-- end-user-doc --> |
223 | * @param object the target of the switch. |
224 | * @return the result of interpreting the object as an instance of '<em>Communication Link Resource Type</em>'. |
225 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
226 | * @generated |
227 | */ |
228 | public T caseCommunicationLinkResourceType(CommunicationLinkResourceType object) { |
229 | return null; |
230 | } |
231 | |
232 | /** |
233 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface</em>'. |
234 | * <!-- begin-user-doc --> |
235 | * This implementation returns null; |
236 | * returning a non-null result will terminate the switch. |
237 | * <!-- end-user-doc --> |
238 | * @param object the target of the switch. |
239 | * @return the result of interpreting the object as an instance of '<em>Resource Interface</em>'. |
240 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
241 | * @generated |
242 | */ |
243 | public T caseResourceInterface(ResourceInterface object) { |
244 | return null; |
245 | } |
246 | |
247 | /** |
248 | * Returns the result of interpreting the object as an instance of '<em>Processing Resource Type</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 interpreting the object as an instance of '<em>Processing Resource Type</em>'. |
255 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
256 | * @generated |
257 | */ |
258 | public T caseProcessingResourceType(ProcessingResourceType object) { |
259 | return null; |
260 | } |
261 | |
262 | /** |
263 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
264 | * <!-- begin-user-doc --> |
265 | * This implementation returns null; |
266 | * returning a non-null result will terminate the switch. |
267 | * <!-- end-user-doc --> |
268 | * @param object the target of the switch. |
269 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
270 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
271 | * @generated |
272 | */ |
273 | public T caseIdentifier(Identifier object) { |
274 | return null; |
275 | } |
276 | |
277 | /** |
278 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
279 | * <!-- begin-user-doc --> |
280 | * This implementation returns null; |
281 | * returning a non-null result will terminate the switch. |
282 | * <!-- end-user-doc --> |
283 | * @param object the target of the switch. |
284 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
285 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
286 | * @generated |
287 | */ |
288 | public T caseNamedElement(NamedElement object) { |
289 | return null; |
290 | } |
291 | |
292 | /** |
293 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
294 | * <!-- begin-user-doc --> |
295 | * This implementation returns null; |
296 | * returning a non-null result will terminate the switch. |
297 | * <!-- end-user-doc --> |
298 | * @param object the target of the switch. |
299 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
300 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
301 | * @generated |
302 | */ |
303 | public T caseEntity(Entity object) { |
304 | return null; |
305 | } |
306 | |
307 | /** |
308 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Providing Entity</em>'. |
309 | * <!-- begin-user-doc --> |
310 | * This implementation returns null; |
311 | * returning a non-null result will terminate the switch. |
312 | * <!-- end-user-doc --> |
313 | * @param object the target of the switch. |
314 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Providing Entity</em>'. |
315 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
316 | * @generated |
317 | */ |
318 | public T caseResourceInterfaceProvidingEntity(ResourceInterfaceProvidingEntity object) { |
319 | return null; |
320 | } |
321 | |
322 | /** |
323 | * Returns the result of interpreting the object as an instance of '<em>Unit Carrying Element</em>'. |
324 | * <!-- begin-user-doc --> |
325 | * This implementation returns null; |
326 | * returning a non-null result will terminate the switch. |
327 | * <!-- end-user-doc --> |
328 | * @param object the target of the switch. |
329 | * @return the result of interpreting the object as an instance of '<em>Unit Carrying Element</em>'. |
330 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
331 | * @generated |
332 | */ |
333 | public T caseUnitCarryingElement(UnitCarryingElement object) { |
334 | return null; |
335 | } |
336 | |
337 | /** |
338 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
339 | * <!-- begin-user-doc --> |
340 | * This implementation returns null; |
341 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
342 | * <!-- end-user-doc --> |
343 | * @param object the target of the switch. |
344 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
345 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
346 | * @generated |
347 | */ |
348 | public T defaultCase(EObject object) { |
349 | return null; |
350 | } |
351 | |
352 | } //ResourcetypeSwitch |