1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.system.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.ComposedProvidingRequiringEntity; |
16 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
17 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingEntity; |
18 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingRequiringEntity; |
19 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceRequiringEntity; |
20 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
21 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceRequiringEntity; |
22 | import de.uka.ipd.sdq.pcm.system.SystemPackage; |
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.system.SystemPackage |
35 | * @generated |
36 | */ |
37 | public class SystemSwitch<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 SystemPackage modelPackage; |
52 | |
53 | /** |
54 | * Creates an instance of the switch. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @generated |
58 | */ |
59 | public SystemSwitch() { |
60 | if (modelPackage == null) { |
61 | modelPackage = SystemPackage.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 SystemPackage.SYSTEM: { |
106 | de.uka.ipd.sdq.pcm.system.System system = (de.uka.ipd.sdq.pcm.system.System)theEObject; |
107 | T result = caseSystem(system); |
108 | if (result == null) result = caseComposedProvidingRequiringEntity(system); |
109 | if (result == null) result = caseIdentifier(system); |
110 | if (result == null) result = caseNamedElement(system); |
111 | if (result == null) result = caseComposedStructure(system); |
112 | if (result == null) result = caseInterfaceProvidingRequiringEntity(system); |
113 | if (result == null) result = caseInterfaceProvidingEntity(system); |
114 | if (result == null) result = caseInterfaceRequiringEntity(system); |
115 | if (result == null) result = caseResourceInterfaceRequiringEntity(system); |
116 | if (result == null) result = caseEntity(system); |
117 | if (result == null) result = defaultCase(theEObject); |
118 | return result; |
119 | } |
120 | default: return defaultCase(theEObject); |
121 | } |
122 | } |
123 | |
124 | /** |
125 | * Returns the result of interpreting the object as an instance of '<em>System</em>'. |
126 | * <!-- begin-user-doc --> |
127 | * This implementation returns null; |
128 | * returning a non-null result will terminate the switch. |
129 | * <!-- end-user-doc --> |
130 | * @param object the target of the switch. |
131 | * @return the result of interpreting the object as an instance of '<em>System</em>'. |
132 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
133 | * @generated |
134 | */ |
135 | public T caseSystem(de.uka.ipd.sdq.pcm.system.System object) { |
136 | return null; |
137 | } |
138 | |
139 | /** |
140 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
141 | * <!-- begin-user-doc --> |
142 | * This implementation returns null; |
143 | * returning a non-null result will terminate the switch. |
144 | * <!-- end-user-doc --> |
145 | * @param object the target of the switch. |
146 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
147 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
148 | * @generated |
149 | */ |
150 | public T caseIdentifier(Identifier object) { |
151 | return null; |
152 | } |
153 | |
154 | /** |
155 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
156 | * <!-- begin-user-doc --> |
157 | * This implementation returns null; |
158 | * returning a non-null result will terminate the switch. |
159 | * <!-- end-user-doc --> |
160 | * @param object the target of the switch. |
161 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
162 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
163 | * @generated |
164 | */ |
165 | public T caseNamedElement(NamedElement object) { |
166 | return null; |
167 | } |
168 | |
169 | /** |
170 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
171 | * <!-- begin-user-doc --> |
172 | * This implementation returns null; |
173 | * returning a non-null result will terminate the switch. |
174 | * <!-- end-user-doc --> |
175 | * @param object the target of the switch. |
176 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
177 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
178 | * @generated |
179 | */ |
180 | public T caseEntity(Entity object) { |
181 | return null; |
182 | } |
183 | |
184 | /** |
185 | * Returns the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
186 | * <!-- begin-user-doc --> |
187 | * This implementation returns null; |
188 | * returning a non-null result will terminate the switch. |
189 | * <!-- end-user-doc --> |
190 | * @param object the target of the switch. |
191 | * @return the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
192 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
193 | * @generated |
194 | */ |
195 | public T caseComposedStructure(ComposedStructure object) { |
196 | return null; |
197 | } |
198 | |
199 | /** |
200 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
201 | * <!-- begin-user-doc --> |
202 | * This implementation returns null; |
203 | * returning a non-null result will terminate the switch. |
204 | * <!-- end-user-doc --> |
205 | * @param object the target of the switch. |
206 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
207 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
208 | * @generated |
209 | */ |
210 | public T caseInterfaceProvidingEntity(InterfaceProvidingEntity object) { |
211 | return null; |
212 | } |
213 | |
214 | /** |
215 | * Returns the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
216 | * <!-- begin-user-doc --> |
217 | * This implementation returns null; |
218 | * returning a non-null result will terminate the switch. |
219 | * <!-- end-user-doc --> |
220 | * @param object the target of the switch. |
221 | * @return the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
222 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
223 | * @generated |
224 | */ |
225 | public T caseInterfaceRequiringEntity(InterfaceRequiringEntity object) { |
226 | return null; |
227 | } |
228 | |
229 | /** |
230 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
231 | * <!-- begin-user-doc --> |
232 | * This implementation returns null; |
233 | * returning a non-null result will terminate the switch. |
234 | * <!-- end-user-doc --> |
235 | * @param object the target of the switch. |
236 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
237 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
238 | * @generated |
239 | */ |
240 | public T caseResourceInterfaceRequiringEntity(ResourceInterfaceRequiringEntity object) { |
241 | return null; |
242 | } |
243 | |
244 | /** |
245 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
246 | * <!-- begin-user-doc --> |
247 | * This implementation returns null; |
248 | * returning a non-null result will terminate the switch. |
249 | * <!-- end-user-doc --> |
250 | * @param object the target of the switch. |
251 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
252 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
253 | * @generated |
254 | */ |
255 | public T caseInterfaceProvidingRequiringEntity(InterfaceProvidingRequiringEntity object) { |
256 | return null; |
257 | } |
258 | |
259 | /** |
260 | * Returns the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
261 | * <!-- begin-user-doc --> |
262 | * This implementation returns null; |
263 | * returning a non-null result will terminate the switch. |
264 | * <!-- end-user-doc --> |
265 | * @param object the target of the switch. |
266 | * @return the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
267 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
268 | * @generated |
269 | */ |
270 | public T caseComposedProvidingRequiringEntity(ComposedProvidingRequiringEntity object) { |
271 | return null; |
272 | } |
273 | |
274 | /** |
275 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
276 | * <!-- begin-user-doc --> |
277 | * This implementation returns null; |
278 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
279 | * <!-- end-user-doc --> |
280 | * @param object the target of the switch. |
281 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
282 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
283 | * @generated |
284 | */ |
285 | public T defaultCase(EObject object) { |
286 | return null; |
287 | } |
288 | |
289 | } //SystemSwitch |