/** * <copyright> * </copyright> * */ package org.eclipse.xtext.example.arithmetics.arithmetics.util; import java.util.List; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.example.arithmetics.arithmetics.*; /** * <!-- 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.eclipse.xtext.example.arithmetics.arithmetics.ArithmeticsPackage * @generated */ public class ArithmeticsSwitch<T> { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static ArithmeticsPackage modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ArithmeticsSwitch() { if (modelPackage == null) { modelPackage = ArithmeticsPackage.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 ArithmeticsPackage.MODULE: { Module module = (Module)theEObject; T result = caseModule(module); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.IMPORT: { Import import_ = (Import)theEObject; T result = caseImport(import_); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.STATEMENT: { Statement statement = (Statement)theEObject; T result = caseStatement(statement); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.DEFINITION: { Definition definition = (Definition)theEObject; T result = caseDefinition(definition); if (result == null) result = caseStatement(definition); if (result == null) result = caseAbstractDefinition(definition); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.DECLARED_PARAMETER: { DeclaredParameter declaredParameter = (DeclaredParameter)theEObject; T result = caseDeclaredParameter(declaredParameter); if (result == null) result = caseAbstractDefinition(declaredParameter); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.ABSTRACT_DEFINITION: { AbstractDefinition abstractDefinition = (AbstractDefinition)theEObject; T result = caseAbstractDefinition(abstractDefinition); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.EVALUATION: { Evaluation evaluation = (Evaluation)theEObject; T result = caseEvaluation(evaluation); if (result == null) result = caseStatement(evaluation); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.EXPRESSION: { Expression expression = (Expression)theEObject; T result = caseExpression(expression); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.PLUS: { Plus plus = (Plus)theEObject; T result = casePlus(plus); if (result == null) result = caseExpression(plus); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.MINUS: { Minus minus = (Minus)theEObject; T result = caseMinus(minus); if (result == null) result = caseExpression(minus); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.MULTI: { Multi multi = (Multi)theEObject; T result = caseMulti(multi); if (result == null) result = caseExpression(multi); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.DIV: { Div div = (Div)theEObject; T result = caseDiv(div); if (result == null) result = caseExpression(div); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.NUMBER_LITERAL: { NumberLiteral numberLiteral = (NumberLiteral)theEObject; T result = caseNumberLiteral(numberLiteral); if (result == null) result = caseExpression(numberLiteral); if (result == null) result = defaultCase(theEObject); return result; } case ArithmeticsPackage.FUNCTION_CALL: { FunctionCall functionCall = (FunctionCall)theEObject; T result = caseFunctionCall(functionCall); if (result == null) result = caseExpression(functionCall); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>Module</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>Module</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseModule(Module 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>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>Statement</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseStatement(Statement 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>Declared Parameter</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>Declared Parameter</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseDeclaredParameter(DeclaredParameter object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Abstract 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>Abstract Definition</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseAbstractDefinition(AbstractDefinition object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Evaluation</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>Evaluation</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseEvaluation(Evaluation object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Expression</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>Expression</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseExpression(Expression 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>Minus</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>Minus</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseMinus(Minus object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Multi</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>Multi</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseMulti(Multi object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Div</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>Div</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseDiv(Div object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Number Literal</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>Number Literal</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseNumberLiteral(NumberLiteral object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Function Call</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>Function Call</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseFunctionCall(FunctionCall 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; } } //ArithmeticsSwitch