/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.reuseware.air.language.abstractsyntax.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.reuseware.air.language.abstractsyntax.*;
/**
* <!-- begin-user-doc -->
* The <b>Switch</b> for the model's inheritance hierarchy.
* It supports the call {@link #doSwitch(EObject) doSwitch(object)}
* to invoke the <code>caseXXX</code> 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.
* <!-- end-user-doc -->
* @see org.reuseware.air.language.abstractsyntax.AbstractsyntaxPackage
* @generated
*/
public class AbstractsyntaxSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static AbstractsyntaxPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public AbstractsyntaxSwitch() {
if (modelPackage == null) {
modelPackage = AbstractsyntaxPackage.eINSTANCE;
}
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
public T doSwitch(EObject theEObject) {
return doSwitch(theEObject.eClass(), theEObject);
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
protected T doSwitch(EClass theEClass, EObject theEObject) {
if (theEClass.eContainer() == modelPackage) {
return doSwitch(theEClass.getClassifierID(), theEObject);
}
else {
List<EClass> eSuperTypes = theEClass.getESuperTypes();
return
eSuperTypes.isEmpty() ?
defaultCase(theEObject) :
doSwitch(eSuperTypes.get(0), theEObject);
}
}
/**
* Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the first non-null result returned by a <code>caseXXX</code> call.
* @generated
*/
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case AbstractsyntaxPackage.ABSTRACT_SYNTAX: {
AbstractSyntax abstractSyntax = (AbstractSyntax)theEObject;
T result = caseAbstractSyntax(abstractSyntax);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.IMPORT: {
Import import_ = (Import)theEObject;
T result = caseImport(import_);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.AS_UNIT: {
ASUnit asUnit = (ASUnit)theEObject;
T result = caseASUnit(asUnit);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.AS_PROGRAM: {
ASProgram asProgram = (ASProgram)theEObject;
T result = caseASProgram(asProgram);
if (result == null) result = caseASUnit(asProgram);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.AS_STATEMENT: {
ASStatement asStatement = (ASStatement)theEObject;
T result = caseASStatement(asStatement);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.DEFINITION: {
Definition definition = (Definition)theEObject;
T result = caseDefinition(definition);
if (result == null) result = caseASStatement(definition);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.CONCRETE_NODE_DEFINITION: {
ConcreteNodeDefinition concreteNodeDefinition = (ConcreteNodeDefinition)theEObject;
T result = caseConcreteNodeDefinition(concreteNodeDefinition);
if (result == null) result = caseDefinition(concreteNodeDefinition);
if (result == null) result = caseASStatement(concreteNodeDefinition);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.INTERFACE_NODE_DEFINITION: {
InterfaceNodeDefinition interfaceNodeDefinition = (InterfaceNodeDefinition)theEObject;
T result = caseInterfaceNodeDefinition(interfaceNodeDefinition);
if (result == null) result = caseDefinition(interfaceNodeDefinition);
if (result == null) result = caseASStatement(interfaceNodeDefinition);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.CARDINALITY: {
Cardinality cardinality = (Cardinality)theEObject;
T result = caseCardinality(cardinality);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.PLUS: {
PLUS plus = (PLUS)theEObject;
T result = casePLUS(plus);
if (result == null) result = caseCardinality(plus);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.STAR: {
STAR star = (STAR)theEObject;
T result = caseSTAR(star);
if (result == null) result = caseCardinality(star);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.QUESTIONMARK: {
QUESTIONMARK questionmark = (QUESTIONMARK)theEObject;
T result = caseQUESTIONMARK(questionmark);
if (result == null) result = caseCardinality(questionmark);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.NODE_FEATURE: {
NodeFeature nodeFeature = (NodeFeature)theEObject;
T result = caseNodeFeature(nodeFeature);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.ATTRIBUTE: {
Attribute attribute = (Attribute)theEObject;
T result = caseAttribute(attribute);
if (result == null) result = caseNodeFeature(attribute);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.CONTAINMENT: {
Containment containment = (Containment)theEObject;
T result = caseContainment(containment);
if (result == null) result = caseNodeFeature(containment);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.INTERNAL_REFERENCE: {
InternalReference internalReference = (InternalReference)theEObject;
T result = caseInternalReference(internalReference);
if (result == null) result = caseNodeFeature(internalReference);
if (result == null) result = defaultCase(theEObject);
return result;
}
case AbstractsyntaxPackage.EXTERNAL_REFERENCE: {
ExternalReference externalReference = (ExternalReference)theEObject;
T result = caseExternalReference(externalReference);
if (result == null) result = caseNodeFeature(externalReference);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Abstract Syntax</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Abstract Syntax</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAbstractSyntax(AbstractSyntax object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Import</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Import</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseImport(Import object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>AS Unit</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>AS Unit</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseASUnit(ASUnit object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>AS Program</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>AS Program</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseASProgram(ASProgram object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>AS Statement</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>AS Statement</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseASStatement(ASStatement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Definition</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Definition</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDefinition(Definition object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Concrete Node Definition</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Concrete Node Definition</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseConcreteNodeDefinition(ConcreteNodeDefinition object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Interface Node Definition</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Interface Node Definition</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseInterfaceNodeDefinition(InterfaceNodeDefinition object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Cardinality</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Cardinality</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCardinality(Cardinality object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>PLUS</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>PLUS</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePLUS(PLUS object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>STAR</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>STAR</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseSTAR(STAR object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>QUESTIONMARK</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>QUESTIONMARK</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseQUESTIONMARK(QUESTIONMARK object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Node Feature</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Node Feature</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNodeFeature(NodeFeature object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Attribute</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Attribute</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAttribute(Attribute object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Containment</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Containment</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseContainment(Containment object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Internal Reference</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Internal Reference</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseInternalReference(InternalReference object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>External Reference</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>External Reference</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseExternalReference(ExternalReference object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch, but this is the last case anyway.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>EObject</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject)
* @generated
*/
public T defaultCase(EObject object) {
return null;
}
} //AbstractsyntaxSwitch