1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.resourceenvironment.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.resourceenvironment.*; |
17 | import de.uka.ipd.sdq.pcm.resourceenvironment.CommunicationLinkResourceSpecification; |
18 | import de.uka.ipd.sdq.pcm.resourceenvironment.LinkingResource; |
19 | import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification; |
20 | import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceContainer; |
21 | import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceEnvironment; |
22 | import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentPackage; |
23 | |
24 | /** |
25 | * <!-- begin-user-doc --> |
26 | * The <b>Switch</b> for the model's inheritance hierarchy. |
27 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
28 | * to invoke the <code>caseXXX</code> method for each class of the model, |
29 | * starting with the actual class of the object |
30 | * and proceeding up the inheritance hierarchy |
31 | * until a non-null result is returned, |
32 | * which is the result of the switch. |
33 | * <!-- end-user-doc --> |
34 | * @see de.uka.ipd.sdq.pcm.resourceenvironment.ResourceenvironmentPackage |
35 | * @generated |
36 | */ |
37 | public class ResourceenvironmentSwitch<T> { |
38 | /** |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @generated |
42 | */ |
43 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
44 | |
45 | /** |
46 | * The cached model package |
47 | * <!-- begin-user-doc --> |
48 | * <!-- end-user-doc --> |
49 | * @generated |
50 | */ |
51 | protected static ResourceenvironmentPackage modelPackage; |
52 | |
53 | /** |
54 | * Creates an instance of the switch. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | public ResourceenvironmentSwitch() { |
60 | if (modelPackage == null) { |
61 | modelPackage = ResourceenvironmentPackage.eINSTANCE; |
62 | } |
63 | } |
64 | |
65 | /** |
66 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
70 | * @generated |
71 | */ |
72 | public T doSwitch(EObject theEObject) { |
73 | return doSwitch(theEObject.eClass(), theEObject); |
74 | } |
75 | |
76 | /** |
77 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
81 | * @generated |
82 | */ |
83 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
84 | if (theEClass.eContainer() == modelPackage) { |
85 | return doSwitch(theEClass.getClassifierID(), theEObject); |
86 | } |
87 | else { |
88 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
89 | return |
90 | eSuperTypes.isEmpty() ? |
91 | defaultCase(theEObject) : |
92 | doSwitch(eSuperTypes.get(0), theEObject); |
93 | } |
94 | } |
95 | |
96 | /** |
97 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
101 | * @generated |
102 | */ |
103 | protected T doSwitch(int classifierID, EObject theEObject) { |
104 | switch (classifierID) { |
105 | case ResourceenvironmentPackage.RESOURCE_ENVIRONMENT: { |
106 | ResourceEnvironment resourceEnvironment = (ResourceEnvironment)theEObject; |
107 | T result = caseResourceEnvironment(resourceEnvironment); |
108 | if (result == null) result = caseNamedElement(resourceEnvironment); |
109 | if (result == null) result = defaultCase(theEObject); |
110 | return result; |
111 | } |
112 | case ResourceenvironmentPackage.LINKING_RESOURCE: { |
113 | LinkingResource linkingResource = (LinkingResource)theEObject; |
114 | T result = caseLinkingResource(linkingResource); |
115 | if (result == null) result = caseEntity(linkingResource); |
116 | if (result == null) result = caseIdentifier(linkingResource); |
117 | if (result == null) result = caseNamedElement(linkingResource); |
118 | if (result == null) result = defaultCase(theEObject); |
119 | return result; |
120 | } |
121 | case ResourceenvironmentPackage.RESOURCE_CONTAINER: { |
122 | ResourceContainer resourceContainer = (ResourceContainer)theEObject; |
123 | T result = caseResourceContainer(resourceContainer); |
124 | if (result == null) result = caseEntity(resourceContainer); |
125 | if (result == null) result = caseIdentifier(resourceContainer); |
126 | if (result == null) result = caseNamedElement(resourceContainer); |
127 | if (result == null) result = defaultCase(theEObject); |
128 | return result; |
129 | } |
130 | case ResourceenvironmentPackage.PROCESSING_RESOURCE_SPECIFICATION: { |
131 | ProcessingResourceSpecification processingResourceSpecification = (ProcessingResourceSpecification)theEObject; |
132 | T result = caseProcessingResourceSpecification(processingResourceSpecification); |
133 | if (result == null) result = defaultCase(theEObject); |
134 | return result; |
135 | } |
136 | case ResourceenvironmentPackage.COMMUNICATION_LINK_RESOURCE_SPECIFICATION: { |
137 | CommunicationLinkResourceSpecification communicationLinkResourceSpecification = (CommunicationLinkResourceSpecification)theEObject; |
138 | T result = caseCommunicationLinkResourceSpecification(communicationLinkResourceSpecification); |
139 | if (result == null) result = caseIdentifier(communicationLinkResourceSpecification); |
140 | if (result == null) result = defaultCase(theEObject); |
141 | return result; |
142 | } |
143 | default: return defaultCase(theEObject); |
144 | } |
145 | } |
146 | |
147 | /** |
148 | * Returns the result of interpreting the object as an instance of '<em>Resource Environment</em>'. |
149 | * <!-- begin-user-doc --> |
150 | * This implementation returns null; |
151 | * returning a non-null result will terminate the switch. |
152 | * <!-- end-user-doc --> |
153 | * @param object the target of the switch. |
154 | * @return the result of interpreting the object as an instance of '<em>Resource Environment</em>'. |
155 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
156 | * @generated |
157 | */ |
158 | public T caseResourceEnvironment(ResourceEnvironment object) { |
159 | return null; |
160 | } |
161 | |
162 | /** |
163 | * Returns the result of interpreting the object as an instance of '<em>Linking Resource</em>'. |
164 | * <!-- begin-user-doc --> |
165 | * This implementation returns null; |
166 | * returning a non-null result will terminate the switch. |
167 | * <!-- end-user-doc --> |
168 | * @param object the target of the switch. |
169 | * @return the result of interpreting the object as an instance of '<em>Linking Resource</em>'. |
170 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
171 | * @generated |
172 | */ |
173 | public T caseLinkingResource(LinkingResource object) { |
174 | return null; |
175 | } |
176 | |
177 | /** |
178 | * Returns the result of interpreting the object as an instance of '<em>Resource Container</em>'. |
179 | * <!-- begin-user-doc --> |
180 | * This implementation returns null; |
181 | * returning a non-null result will terminate the switch. |
182 | * <!-- end-user-doc --> |
183 | * @param object the target of the switch. |
184 | * @return the result of interpreting the object as an instance of '<em>Resource Container</em>'. |
185 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
186 | * @generated |
187 | */ |
188 | public T caseResourceContainer(ResourceContainer object) { |
189 | return null; |
190 | } |
191 | |
192 | /** |
193 | * Returns the result of interpreting the object as an instance of '<em>Processing Resource Specification</em>'. |
194 | * <!-- begin-user-doc --> |
195 | * This implementation returns null; |
196 | * returning a non-null result will terminate the switch. |
197 | * <!-- end-user-doc --> |
198 | * @param object the target of the switch. |
199 | * @return the result of interpreting the object as an instance of '<em>Processing Resource Specification</em>'. |
200 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
201 | * @generated |
202 | */ |
203 | public T caseProcessingResourceSpecification(ProcessingResourceSpecification object) { |
204 | return null; |
205 | } |
206 | |
207 | /** |
208 | * Returns the result of interpreting the object as an instance of '<em>Communication Link Resource Specification</em>'. |
209 | * <!-- begin-user-doc --> |
210 | * This implementation returns null; |
211 | * returning a non-null result will terminate the switch. |
212 | * <!-- end-user-doc --> |
213 | * @param object the target of the switch. |
214 | * @return the result of interpreting the object as an instance of '<em>Communication Link Resource Specification</em>'. |
215 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
216 | * @generated |
217 | */ |
218 | public T caseCommunicationLinkResourceSpecification(CommunicationLinkResourceSpecification object) { |
219 | return null; |
220 | } |
221 | |
222 | /** |
223 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
224 | * <!-- begin-user-doc --> |
225 | * This implementation returns null; |
226 | * returning a non-null result will terminate the switch. |
227 | * <!-- end-user-doc --> |
228 | * @param object the target of the switch. |
229 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
230 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
231 | * @generated |
232 | */ |
233 | public T caseNamedElement(NamedElement object) { |
234 | return null; |
235 | } |
236 | |
237 | /** |
238 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
239 | * <!-- begin-user-doc --> |
240 | * This implementation returns null; |
241 | * returning a non-null result will terminate the switch. |
242 | * <!-- end-user-doc --> |
243 | * @param object the target of the switch. |
244 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
245 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
246 | * @generated |
247 | */ |
248 | public T caseIdentifier(Identifier object) { |
249 | return null; |
250 | } |
251 | |
252 | /** |
253 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
254 | * <!-- begin-user-doc --> |
255 | * This implementation returns null; |
256 | * returning a non-null result will terminate the switch. |
257 | * <!-- end-user-doc --> |
258 | * @param object the target of the switch. |
259 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
260 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
261 | * @generated |
262 | */ |
263 | public T caseEntity(Entity object) { |
264 | return null; |
265 | } |
266 | |
267 | /** |
268 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
269 | * <!-- begin-user-doc --> |
270 | * This implementation returns null; |
271 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
272 | * <!-- end-user-doc --> |
273 | * @param object the target of the switch. |
274 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
275 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
276 | * @generated |
277 | */ |
278 | public T defaultCase(EObject object) { |
279 | return null; |
280 | } |
281 | |
282 | } //ResourceenvironmentSwitch |