blob: 8d38a572405f3e70716b3761b718b3ea7934424a [file] [log] [blame]
/**
* * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro
* * All rights reserved. This program and the accompanying materials
* * are made available under the terms of the Eclipse Public License v1.0
* * which accompanies this distribution, and is available at
* * http://www.eclipse.org/legal/epl-v10.html
* *
* * Contributors:
* * Istvan Rath, Daniel Varro - initial API and implementation
*
*/
package org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.AnnotatedElement;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.core.GTASMElement;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.*;
/**
* <!-- 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.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.TermsPackage
* @generated
*/
public class TermsSwitch<T>
{
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public static final String copyright = " * Copyright (c) 2006-2010 Istvan Rath and Daniel Varro\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors:\r\n * Istvan Rath, Daniel Varro - initial API and implementation\r\n";
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static TermsPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TermsSwitch()
{
if (modelPackage == null)
{
modelPackage = TermsPackage.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 TermsPackage.TERM:
{
Term term = (Term)theEObject;
T result = caseTerm(term);
if (result == null) result = caseGTASMElement(term);
if (result == null) result = caseAnnotatedElement(term);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.VARIABLE_REFERENCE:
{
VariableReference variableReference = (VariableReference)theEObject;
T result = caseVariableReference(variableReference);
if (result == null) result = caseTerm(variableReference);
if (result == null) result = caseGTASMElement(variableReference);
if (result == null) result = caseAnnotatedElement(variableReference);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.GT_PATTERN_CALL:
{
GTPatternCall gtPatternCall = (GTPatternCall)theEObject;
T result = caseGTPatternCall(gtPatternCall);
if (result == null) result = caseTerm(gtPatternCall);
if (result == null) result = caseGTASMElement(gtPatternCall);
if (result == null) result = caseAnnotatedElement(gtPatternCall);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.ASM_FUNCTION_INVOCATION:
{
ASMFunctionInvocation asmFunctionInvocation = (ASMFunctionInvocation)theEObject;
T result = caseASMFunctionInvocation(asmFunctionInvocation);
if (result == null) result = caseFunctionInvocation(asmFunctionInvocation);
if (result == null) result = caseTerm(asmFunctionInvocation);
if (result == null) result = caseGTASMElement(asmFunctionInvocation);
if (result == null) result = caseAnnotatedElement(asmFunctionInvocation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.FUNCTION_INVOCATION:
{
FunctionInvocation functionInvocation = (FunctionInvocation)theEObject;
T result = caseFunctionInvocation(functionInvocation);
if (result == null) result = caseTerm(functionInvocation);
if (result == null) result = caseGTASMElement(functionInvocation);
if (result == null) result = caseAnnotatedElement(functionInvocation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.CONSTANT:
{
Constant constant = (Constant)theEObject;
T result = caseConstant(constant);
if (result == null) result = caseTerm(constant);
if (result == null) result = caseGTASMElement(constant);
if (result == null) result = caseAnnotatedElement(constant);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.NATIVE_FUNCTION_INVOCATION:
{
NativeFunctionInvocation nativeFunctionInvocation = (NativeFunctionInvocation)theEObject;
T result = caseNativeFunctionInvocation(nativeFunctionInvocation);
if (result == null) result = caseFunctionInvocation(nativeFunctionInvocation);
if (result == null) result = caseTerm(nativeFunctionInvocation);
if (result == null) result = caseGTASMElement(nativeFunctionInvocation);
if (result == null) result = caseAnnotatedElement(nativeFunctionInvocation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case TermsPackage.MODEL_ELEMENT_QUERY:
{
ModelElementQuery modelElementQuery = (ModelElementQuery)theEObject;
T result = caseModelElementQuery(modelElementQuery);
if (result == null) result = caseTerm(modelElementQuery);
if (result == null) result = caseGTASMElement(modelElementQuery);
if (result == null) result = caseAnnotatedElement(modelElementQuery);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Term</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>Term</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTerm(Term object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Variable 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>Variable Reference</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVariableReference(VariableReference object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>GT Pattern 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>GT Pattern Call</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGTPatternCall(GTPatternCall object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>ASM Function Invocation</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>ASM Function Invocation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseASMFunctionInvocation(ASMFunctionInvocation object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Function Invocation</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 Invocation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFunctionInvocation(FunctionInvocation object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Constant</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>Constant</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseConstant(Constant object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Native Function Invocation</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>Native Function Invocation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNativeFunctionInvocation(NativeFunctionInvocation object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Model Element Query</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>Model Element Query</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseModelElementQuery(ModelElementQuery object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Annotated Element</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>Annotated Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseAnnotatedElement(AnnotatedElement object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>GTASM Element</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>GTASM Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGTASMElement(GTASMElement 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;
}
} //TermsSwitch