1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package com.hammurapi.eventbus.snapshot.util; |
8 | |
9 | import com.hammurapi.eventbus.snapshot.*; |
10 | |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.ecore.EClass; |
14 | import org.eclipse.emf.ecore.EObject; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * The <b>Switch</b> for the model's inheritance hierarchy. |
19 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
20 | * to invoke the <code>caseXXX</code> method for each class of the model, |
21 | * starting with the actual class of the object |
22 | * and proceeding up the inheritance hierarchy |
23 | * until a non-null result is returned, |
24 | * which is the result of the switch. |
25 | * <!-- end-user-doc --> |
26 | * @see com.hammurapi.eventbus.snapshot.SnapshotPackage |
27 | * @generated |
28 | */ |
29 | public class SnapshotSwitch<T> { |
30 | /** |
31 | * The cached model package |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | protected static SnapshotPackage modelPackage; |
37 | |
38 | /** |
39 | * Creates an instance of the switch. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public SnapshotSwitch() { |
45 | if (modelPackage == null) { |
46 | modelPackage = SnapshotPackage.eINSTANCE; |
47 | } |
48 | } |
49 | |
50 | /** |
51 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
55 | * @generated |
56 | */ |
57 | public T doSwitch(EObject theEObject) { |
58 | return doSwitch(theEObject.eClass(), theEObject); |
59 | } |
60 | |
61 | /** |
62 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
66 | * @generated |
67 | */ |
68 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
69 | if (theEClass.eContainer() == modelPackage) { |
70 | return doSwitch(theEClass.getClassifierID(), theEObject); |
71 | } |
72 | else { |
73 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
74 | return |
75 | eSuperTypes.isEmpty() ? |
76 | defaultCase(theEObject) : |
77 | doSwitch(eSuperTypes.get(0), theEObject); |
78 | } |
79 | } |
80 | |
81 | /** |
82 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
86 | * @generated |
87 | */ |
88 | protected T doSwitch(int classifierID, EObject theEObject) { |
89 | switch (classifierID) { |
90 | case SnapshotPackage.SNAPSHOT: { |
91 | Snapshot snapshot = (Snapshot)theEObject; |
92 | T result = caseSnapshot(snapshot); |
93 | if (result == null) result = defaultCase(theEObject); |
94 | return result; |
95 | } |
96 | case SnapshotPackage.SNAPSHOT_ELEMENT: { |
97 | SnapshotElement snapshotElement = (SnapshotElement)theEObject; |
98 | T result = caseSnapshotElement(snapshotElement); |
99 | if (result == null) result = defaultCase(theEObject); |
100 | return result; |
101 | } |
102 | case SnapshotPackage.HANDLER: { |
103 | Handler handler = (Handler)theEObject; |
104 | T result = caseHandler(handler); |
105 | if (result == null) result = casePredicateNodeOutput(handler); |
106 | if (result == null) result = caseSnapshotElement(handler); |
107 | if (result == null) result = defaultCase(theEObject); |
108 | return result; |
109 | } |
110 | case SnapshotPackage.DERIVATION: { |
111 | Derivation derivation = (Derivation)theEObject; |
112 | T result = caseDerivation(derivation); |
113 | if (result == null) result = defaultCase(theEObject); |
114 | return result; |
115 | } |
116 | case SnapshotPackage.EVENT: { |
117 | Event event = (Event)theEObject; |
118 | T result = caseEvent(event); |
119 | if (result == null) result = caseSnapshotElement(event); |
120 | if (result == null) result = defaultCase(theEObject); |
121 | return result; |
122 | } |
123 | case SnapshotPackage.PREDICATE_NODE: { |
124 | PredicateNode predicateNode = (PredicateNode)theEObject; |
125 | T result = casePredicateNode(predicateNode); |
126 | if (result == null) result = caseSnapshotElement(predicateNode); |
127 | if (result == null) result = defaultCase(theEObject); |
128 | return result; |
129 | } |
130 | case SnapshotPackage.PREDICATE_NODE_OUTPUT: { |
131 | PredicateNodeOutput predicateNodeOutput = (PredicateNodeOutput)theEObject; |
132 | T result = casePredicateNodeOutput(predicateNodeOutput); |
133 | if (result == null) result = caseSnapshotElement(predicateNodeOutput); |
134 | if (result == null) result = defaultCase(theEObject); |
135 | return result; |
136 | } |
137 | case SnapshotPackage.JOIN_INPUT: { |
138 | JoinInput joinInput = (JoinInput)theEObject; |
139 | T result = caseJoinInput(joinInput); |
140 | if (result == null) result = casePredicateNodeOutput(joinInput); |
141 | if (result == null) result = caseSnapshotElement(joinInput); |
142 | if (result == null) result = defaultCase(theEObject); |
143 | return result; |
144 | } |
145 | case SnapshotPackage.JOIN_NODE: { |
146 | JoinNode joinNode = (JoinNode)theEObject; |
147 | T result = caseJoinNode(joinNode); |
148 | if (result == null) result = caseSnapshotElement(joinNode); |
149 | if (result == null) result = defaultCase(theEObject); |
150 | return result; |
151 | } |
152 | case SnapshotPackage.JOIN_INPUT_COLLECTOR: { |
153 | JoinInputCollector joinInputCollector = (JoinInputCollector)theEObject; |
154 | T result = caseJoinInputCollector(joinInputCollector); |
155 | if (result == null) result = defaultCase(theEObject); |
156 | return result; |
157 | } |
158 | case SnapshotPackage.JOIN_ENTRY: { |
159 | JoinEntry joinEntry = (JoinEntry)theEObject; |
160 | T result = caseJoinEntry(joinEntry); |
161 | if (result == null) result = defaultCase(theEObject); |
162 | return result; |
163 | } |
164 | case SnapshotPackage.EXTRACTOR: { |
165 | Extractor extractor = (Extractor)theEObject; |
166 | T result = caseExtractor(extractor); |
167 | if (result == null) result = caseSnapshotElement(extractor); |
168 | if (result == null) result = defaultCase(theEObject); |
169 | return result; |
170 | } |
171 | case SnapshotPackage.PREDICATE: { |
172 | Predicate predicate = (Predicate)theEObject; |
173 | T result = casePredicate(predicate); |
174 | if (result == null) result = caseExtractor(predicate); |
175 | if (result == null) result = caseSnapshotElement(predicate); |
176 | if (result == null) result = defaultCase(theEObject); |
177 | return result; |
178 | } |
179 | case SnapshotPackage.COMPOSITE_EVENT: { |
180 | CompositeEvent compositeEvent = (CompositeEvent)theEObject; |
181 | T result = caseCompositeEvent(compositeEvent); |
182 | if (result == null) result = caseEvent(compositeEvent); |
183 | if (result == null) result = caseSnapshotElement(compositeEvent); |
184 | if (result == null) result = defaultCase(theEObject); |
185 | return result; |
186 | } |
187 | default: return defaultCase(theEObject); |
188 | } |
189 | } |
190 | |
191 | /** |
192 | * Returns the result of interpreting the object as an instance of '<em>Snapshot</em>'. |
193 | * <!-- begin-user-doc --> |
194 | * This implementation returns null; |
195 | * returning a non-null result will terminate the switch. |
196 | * <!-- end-user-doc --> |
197 | * @param object the target of the switch. |
198 | * @return the result of interpreting the object as an instance of '<em>Snapshot</em>'. |
199 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
200 | * @generated |
201 | */ |
202 | public T caseSnapshot(Snapshot object) { |
203 | return null; |
204 | } |
205 | |
206 | /** |
207 | * Returns the result of interpreting the object as an instance of '<em>Element</em>'. |
208 | * <!-- begin-user-doc --> |
209 | * This implementation returns null; |
210 | * returning a non-null result will terminate the switch. |
211 | * <!-- end-user-doc --> |
212 | * @param object the target of the switch. |
213 | * @return the result of interpreting the object as an instance of '<em>Element</em>'. |
214 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
215 | * @generated |
216 | */ |
217 | public T caseSnapshotElement(SnapshotElement object) { |
218 | return null; |
219 | } |
220 | |
221 | /** |
222 | * Returns the result of interpreting the object as an instance of '<em>Handler</em>'. |
223 | * <!-- begin-user-doc --> |
224 | * This implementation returns null; |
225 | * returning a non-null result will terminate the switch. |
226 | * <!-- end-user-doc --> |
227 | * @param object the target of the switch. |
228 | * @return the result of interpreting the object as an instance of '<em>Handler</em>'. |
229 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
230 | * @generated |
231 | */ |
232 | public T caseHandler(Handler object) { |
233 | return null; |
234 | } |
235 | |
236 | /** |
237 | * Returns the result of interpreting the object as an instance of '<em>Derivation</em>'. |
238 | * <!-- begin-user-doc --> |
239 | * This implementation returns null; |
240 | * returning a non-null result will terminate the switch. |
241 | * <!-- end-user-doc --> |
242 | * @param object the target of the switch. |
243 | * @return the result of interpreting the object as an instance of '<em>Derivation</em>'. |
244 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
245 | * @generated |
246 | */ |
247 | public T caseDerivation(Derivation object) { |
248 | return null; |
249 | } |
250 | |
251 | /** |
252 | * Returns the result of interpreting the object as an instance of '<em>Event</em>'. |
253 | * <!-- begin-user-doc --> |
254 | * This implementation returns null; |
255 | * returning a non-null result will terminate the switch. |
256 | * <!-- end-user-doc --> |
257 | * @param object the target of the switch. |
258 | * @return the result of interpreting the object as an instance of '<em>Event</em>'. |
259 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
260 | * @generated |
261 | */ |
262 | public T caseEvent(Event object) { |
263 | return null; |
264 | } |
265 | |
266 | /** |
267 | * Returns the result of interpreting the object as an instance of '<em>Predicate Node</em>'. |
268 | * <!-- begin-user-doc --> |
269 | * This implementation returns null; |
270 | * returning a non-null result will terminate the switch. |
271 | * <!-- end-user-doc --> |
272 | * @param object the target of the switch. |
273 | * @return the result of interpreting the object as an instance of '<em>Predicate Node</em>'. |
274 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
275 | * @generated |
276 | */ |
277 | public T casePredicateNode(PredicateNode object) { |
278 | return null; |
279 | } |
280 | |
281 | /** |
282 | * Returns the result of interpreting the object as an instance of '<em>Predicate Node Output</em>'. |
283 | * <!-- begin-user-doc --> |
284 | * This implementation returns null; |
285 | * returning a non-null result will terminate the switch. |
286 | * <!-- end-user-doc --> |
287 | * @param object the target of the switch. |
288 | * @return the result of interpreting the object as an instance of '<em>Predicate Node Output</em>'. |
289 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
290 | * @generated |
291 | */ |
292 | public T casePredicateNodeOutput(PredicateNodeOutput object) { |
293 | return null; |
294 | } |
295 | |
296 | /** |
297 | * Returns the result of interpreting the object as an instance of '<em>Join Input</em>'. |
298 | * <!-- begin-user-doc --> |
299 | * This implementation returns null; |
300 | * returning a non-null result will terminate the switch. |
301 | * <!-- end-user-doc --> |
302 | * @param object the target of the switch. |
303 | * @return the result of interpreting the object as an instance of '<em>Join Input</em>'. |
304 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
305 | * @generated |
306 | */ |
307 | public T caseJoinInput(JoinInput object) { |
308 | return null; |
309 | } |
310 | |
311 | /** |
312 | * Returns the result of interpreting the object as an instance of '<em>Join Node</em>'. |
313 | * <!-- begin-user-doc --> |
314 | * This implementation returns null; |
315 | * returning a non-null result will terminate the switch. |
316 | * <!-- end-user-doc --> |
317 | * @param object the target of the switch. |
318 | * @return the result of interpreting the object as an instance of '<em>Join Node</em>'. |
319 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
320 | * @generated |
321 | */ |
322 | public T caseJoinNode(JoinNode object) { |
323 | return null; |
324 | } |
325 | |
326 | /** |
327 | * Returns the result of interpreting the object as an instance of '<em>Join Input Collector</em>'. |
328 | * <!-- begin-user-doc --> |
329 | * This implementation returns null; |
330 | * returning a non-null result will terminate the switch. |
331 | * <!-- end-user-doc --> |
332 | * @param object the target of the switch. |
333 | * @return the result of interpreting the object as an instance of '<em>Join Input Collector</em>'. |
334 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
335 | * @generated |
336 | */ |
337 | public T caseJoinInputCollector(JoinInputCollector object) { |
338 | return null; |
339 | } |
340 | |
341 | /** |
342 | * Returns the result of interpreting the object as an instance of '<em>Join Entry</em>'. |
343 | * <!-- begin-user-doc --> |
344 | * This implementation returns null; |
345 | * returning a non-null result will terminate the switch. |
346 | * <!-- end-user-doc --> |
347 | * @param object the target of the switch. |
348 | * @return the result of interpreting the object as an instance of '<em>Join Entry</em>'. |
349 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
350 | * @generated |
351 | */ |
352 | public T caseJoinEntry(JoinEntry object) { |
353 | return null; |
354 | } |
355 | |
356 | /** |
357 | * Returns the result of interpreting the object as an instance of '<em>Extractor</em>'. |
358 | * <!-- begin-user-doc --> |
359 | * This implementation returns null; |
360 | * returning a non-null result will terminate the switch. |
361 | * <!-- end-user-doc --> |
362 | * @param object the target of the switch. |
363 | * @return the result of interpreting the object as an instance of '<em>Extractor</em>'. |
364 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
365 | * @generated |
366 | */ |
367 | public T caseExtractor(Extractor object) { |
368 | return null; |
369 | } |
370 | |
371 | /** |
372 | * Returns the result of interpreting the object as an instance of '<em>Predicate</em>'. |
373 | * <!-- begin-user-doc --> |
374 | * This implementation returns null; |
375 | * returning a non-null result will terminate the switch. |
376 | * <!-- end-user-doc --> |
377 | * @param object the target of the switch. |
378 | * @return the result of interpreting the object as an instance of '<em>Predicate</em>'. |
379 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
380 | * @generated |
381 | */ |
382 | public T casePredicate(Predicate object) { |
383 | return null; |
384 | } |
385 | |
386 | /** |
387 | * Returns the result of interpreting the object as an instance of '<em>Composite Event</em>'. |
388 | * <!-- begin-user-doc --> |
389 | * This implementation returns null; |
390 | * returning a non-null result will terminate the switch. |
391 | * <!-- end-user-doc --> |
392 | * @param object the target of the switch. |
393 | * @return the result of interpreting the object as an instance of '<em>Composite Event</em>'. |
394 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
395 | * @generated |
396 | */ |
397 | public T caseCompositeEvent(CompositeEvent object) { |
398 | return null; |
399 | } |
400 | |
401 | /** |
402 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
403 | * <!-- begin-user-doc --> |
404 | * This implementation returns null; |
405 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
406 | * <!-- end-user-doc --> |
407 | * @param object the target of the switch. |
408 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
409 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
410 | * @generated |
411 | */ |
412 | public T defaultCase(EObject object) { |
413 | return null; |
414 | } |
415 | |
416 | } //SnapshotSwitch |