001 /**
002 * <copyright>
003 * </copyright>
004 *
005 * $Id$
006 */
007 package com.hammurapi.eventbus.snapshot.util;
008
009 import com.hammurapi.eventbus.snapshot.*;
010
011 import java.util.List;
012
013 import org.eclipse.emf.ecore.EClass;
014 import org.eclipse.emf.ecore.EObject;
015
016 /**
017 * <!-- begin-user-doc -->
018 * The <b>Switch</b> for the model's inheritance hierarchy.
019 * It supports the call {@link #doSwitch(EObject) doSwitch(object)}
020 * to invoke the <code>caseXXX</code> method for each class of the model,
021 * starting with the actual class of the object
022 * and proceeding up the inheritance hierarchy
023 * until a non-null result is returned,
024 * which is the result of the switch.
025 * <!-- end-user-doc -->
026 * @see com.hammurapi.eventbus.snapshot.SnapshotPackage
027 * @generated
028 */
029 public class SnapshotSwitch<T> {
030 /**
031 * The cached model package
032 * <!-- begin-user-doc -->
033 * <!-- end-user-doc -->
034 * @generated
035 */
036 protected static SnapshotPackage modelPackage;
037
038 /**
039 * Creates an instance of the switch.
040 * <!-- begin-user-doc -->
041 * <!-- end-user-doc -->
042 * @generated
043 */
044 public SnapshotSwitch() {
045 if (modelPackage == null) {
046 modelPackage = SnapshotPackage.eINSTANCE;
047 }
048 }
049
050 /**
051 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
052 * <!-- begin-user-doc -->
053 * <!-- end-user-doc -->
054 * @return the first non-null result returned by a <code>caseXXX</code> call.
055 * @generated
056 */
057 public T doSwitch(EObject theEObject) {
058 return doSwitch(theEObject.eClass(), theEObject);
059 }
060
061 /**
062 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
063 * <!-- begin-user-doc -->
064 * <!-- end-user-doc -->
065 * @return the first non-null result returned by a <code>caseXXX</code> call.
066 * @generated
067 */
068 protected T doSwitch(EClass theEClass, EObject theEObject) {
069 if (theEClass.eContainer() == modelPackage) {
070 return doSwitch(theEClass.getClassifierID(), theEObject);
071 }
072 else {
073 List<EClass> eSuperTypes = theEClass.getESuperTypes();
074 return
075 eSuperTypes.isEmpty() ?
076 defaultCase(theEObject) :
077 doSwitch(eSuperTypes.get(0), theEObject);
078 }
079 }
080
081 /**
082 * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
083 * <!-- begin-user-doc -->
084 * <!-- end-user-doc -->
085 * @return the first non-null result returned by a <code>caseXXX</code> call.
086 * @generated
087 */
088 protected T doSwitch(int classifierID, EObject theEObject) {
089 switch (classifierID) {
090 case SnapshotPackage.SNAPSHOT: {
091 Snapshot snapshot = (Snapshot)theEObject;
092 T result = caseSnapshot(snapshot);
093 if (result == null) result = defaultCase(theEObject);
094 return result;
095 }
096 case SnapshotPackage.SNAPSHOT_ELEMENT: {
097 SnapshotElement snapshotElement = (SnapshotElement)theEObject;
098 T result = caseSnapshotElement(snapshotElement);
099 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