blob: 715eb21e73b47e08f261ba8da2ef80b0141b694f [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.gt.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.definitions.Variable;
import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.gt.*;
/**
* <!-- 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.gt.GtPackage
* @generated
*/
public class GtSwitch<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 GtPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public GtSwitch()
{
if (modelPackage == null)
{
modelPackage = GtPackage.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 GtPackage.GT_PATTERN_BODY:
{
GTPatternBody gtPatternBody = (GTPatternBody)theEObject;
T result = caseGTPatternBody(gtPatternBody);
if (result == null) result = casePatternContainer(gtPatternBody);
if (result == null) result = caseGTASMElement(gtPatternBody);
if (result == null) result = caseAnnotatedElement(gtPatternBody);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.GT_PATTERN:
{
GTPattern gtPattern = (GTPattern)theEObject;
T result = caseGTPattern(gtPattern);
if (result == null) result = caseGTASMElement(gtPattern);
if (result == null) result = caseAnnotatedElement(gtPattern);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.PATTERN_VARIABLE:
{
PatternVariable patternVariable = (PatternVariable)theEObject;
T result = casePatternVariable(patternVariable);
if (result == null) result = caseVariable(patternVariable);
if (result == null) result = caseGTASMElement(patternVariable);
if (result == null) result = caseAnnotatedElement(patternVariable);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.PATTERN_VARIABLE_ASSIGNMENT:
{
PatternVariableAssignment patternVariableAssignment = (PatternVariableAssignment)theEObject;
T result = casePatternVariableAssignment(patternVariableAssignment);
if (result == null) result = casePatternVariableConstraint(patternVariableAssignment);
if (result == null) result = caseGTASMElement(patternVariableAssignment);
if (result == null) result = caseAnnotatedElement(patternVariableAssignment);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.GT_RULE:
{
GTRule gtRule = (GTRule)theEObject;
T result = caseGTRule(gtRule);
if (result == null) result = casePatternContainer(gtRule);
if (result == null) result = caseGTASMElement(gtRule);
if (result == null) result = caseAnnotatedElement(gtRule);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.CONTAINMENT_CONSTRAINT:
{
ContainmentConstraint containmentConstraint = (ContainmentConstraint)theEObject;
T result = caseContainmentConstraint(containmentConstraint);
if (result == null) result = caseGTASMElement(containmentConstraint);
if (result == null) result = caseAnnotatedElement(containmentConstraint);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.GT_MATCH_COUNTER:
{
GTMatchCounter gtMatchCounter = (GTMatchCounter)theEObject;
T result = caseGTMatchCounter(gtMatchCounter);
if (result == null) result = caseGTASMElement(gtMatchCounter);
if (result == null) result = caseAnnotatedElement(gtMatchCounter);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.NON_INJECTIVITY_CONSTRAINT:
{
NonInjectivityConstraint nonInjectivityConstraint = (NonInjectivityConstraint)theEObject;
T result = caseNonInjectivityConstraint(nonInjectivityConstraint);
if (result == null) result = casePatternVariableConstraint(nonInjectivityConstraint);
if (result == null) result = caseGTASMElement(nonInjectivityConstraint);
if (result == null) result = caseAnnotatedElement(nonInjectivityConstraint);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.PATTERN_VARIABLE_CONSTRAINT:
{
PatternVariableConstraint patternVariableConstraint = (PatternVariableConstraint)theEObject;
T result = casePatternVariableConstraint(patternVariableConstraint);
if (result == null) result = caseGTASMElement(patternVariableConstraint);
if (result == null) result = caseAnnotatedElement(patternVariableConstraint);
if (result == null) result = defaultCase(theEObject);
return result;
}
case GtPackage.PATTERN_CONTAINER:
{
PatternContainer patternContainer = (PatternContainer)theEObject;
T result = casePatternContainer(patternContainer);
if (result == null) result = caseGTASMElement(patternContainer);
if (result == null) result = caseAnnotatedElement(patternContainer);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>GT Pattern Body</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 Body</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGTPatternBody(GTPatternBody object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>GT Pattern</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</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGTPattern(GTPattern object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Pattern Variable</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>Pattern Variable</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePatternVariable(PatternVariable object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Pattern Variable Assignment</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>Pattern Variable Assignment</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePatternVariableAssignment(PatternVariableAssignment object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>GT Rule</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 Rule</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGTRule(GTRule object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Containment Constraint</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 Constraint</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseContainmentConstraint(ContainmentConstraint object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>GT Match Counter</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 Match Counter</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseGTMatchCounter(GTMatchCounter object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Non Injectivity Constraint</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>Non Injectivity Constraint</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNonInjectivityConstraint(NonInjectivityConstraint object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Pattern Variable Constraint</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>Pattern Variable Constraint</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePatternVariableConstraint(PatternVariableConstraint object)
{
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Pattern Container</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>Pattern Container</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePatternContainer(PatternContainer 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>Variable</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</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVariable(Variable 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;
}
} //GtSwitch