EGF Engine
Release 0.1.0

org.eclipse.egf.pattern.util
Class PatternSwitch<T>

java.lang.Object
  extended by org.eclipse.egf.pattern.util.PatternSwitch<T>

public class PatternSwitch<T>
extends Object

The Switch for the model's inheritance hierarchy. It supports the call doSwitch(object) to invoke the caseXXX method for each class of the model, starting with the actual class of the object and proceeding up the inheritance hierarchy until a non-null result is returned, which is the result of the switch.

See Also:
PatternPackage

Field Summary
protected static PatternPackage modelPackage
          The cached model package
 
Constructor Summary
PatternSwitch()
          Creates an instance of the switch
 
Method Summary
 T caseEClass(EClass object)
          Returns the result of interpreting the object as an instance of 'EClass'
 T caseEClassifier(EClassifier object)
          Returns the result of interpreting the object as an instance of 'EClassifier'
 T caseEModelElement(EModelElement object)
          Returns the result of interpreting the object as an instance of 'EModel Element'
 T caseENamedElement(ENamedElement object)
          Returns the result of interpreting the object as an instance of 'ENamed Element'
 T caseGenerator(Generator object)
          Returns the result of interpreting the object as an instance of 'Generator'
 T casePattern(Pattern object)
          Returns the result of interpreting the object as an instance of 'Pattern'
 T defaultCase(EObject object)
          Returns the result of interpreting the object as an instance of 'EObject'
protected  T doSwitch(EClass theEClass, EObject theEObject)
          Calls caseXXX for each class of the model until one returns a non null result; it yields that result
 T doSwitch(EObject theEObject)
          Calls caseXXX for each class of the model until one returns a non null result; it yields that result
protected  T doSwitch(int classifierID, EObject theEObject)
          Calls caseXXX for each class of the model until one returns a non null result; it yields that result
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

modelPackage

protected static PatternPackage modelPackage
The cached model package

Constructor Detail

PatternSwitch

public PatternSwitch()
Creates an instance of the switch.

Method Detail

doSwitch

public T doSwitch(EObject theEObject)
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Returns:
the first non-null result returned by a caseXXX call.

doSwitch

protected T doSwitch(EClass theEClass,
                     EObject theEObject)
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Returns:
the first non-null result returned by a caseXXX call.

doSwitch

protected T doSwitch(int classifierID,
                     EObject theEObject)
Calls caseXXX for each class of the model until one returns a non null result; it yields that result.

Returns:
the first non-null result returned by a caseXXX call.

caseGenerator

public T caseGenerator(Generator object)
Returns the result of interpreting the object as an instance of 'Generator'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'Generator'.
See Also:
doSwitch(EObject)

casePattern

public T casePattern(Pattern object)
Returns the result of interpreting the object as an instance of 'Pattern'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'Pattern'.
See Also:
doSwitch(EObject)

caseEModelElement

public T caseEModelElement(EModelElement object)
Returns the result of interpreting the object as an instance of 'EModel Element'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EModel Element'.
See Also:
doSwitch(EObject)

caseENamedElement

public T caseENamedElement(ENamedElement object)
Returns the result of interpreting the object as an instance of 'ENamed Element'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'ENamed Element'.
See Also:
doSwitch(EObject)

caseEClassifier

public T caseEClassifier(EClassifier object)
Returns the result of interpreting the object as an instance of 'EClassifier'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EClassifier'.
See Also:
doSwitch(EObject)

caseEClass

public T caseEClass(EClass object)
Returns the result of interpreting the object as an instance of 'EClass'. This implementation returns null; returning a non-null result will terminate the switch.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EClass'.
See Also:
doSwitch(EObject)

defaultCase

public T defaultCase(EObject object)
Returns the result of interpreting the object as an instance of 'EObject'. This implementation returns null; returning a non-null result will terminate the switch, but this is the last case anyway.

Parameters:
object - the target of the switch.
Returns:
the result of interpreting the object as an instance of 'EObject'.
See Also:
#doSwitch(org.eclipse.emf.ecore.EObject)

EGF Engine
Release 0.1.0

Copyright (c) Thales Corporate Services S.A.S, 2009.

This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.