| /** |
| * * 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.modelmanagement.queryFunctions.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.ModelElementQuery; |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.asm.terms.Term; |
| |
| import org.eclipse.viatra2.gtasmmodel.gtasm.metamodel.modelmanagement.queryFunctions.*; |
| |
| /** |
| * <!-- 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.modelmanagement.queryFunctions.QueryFunctionsPackage |
| * @generated |
| */ |
| public class QueryFunctionsSwitch<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 QueryFunctionsPackage modelPackage; |
| |
| /** |
| * Creates an instance of the switch. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public QueryFunctionsSwitch() |
| { |
| if (modelPackage == null) |
| { |
| modelPackage = QueryFunctionsPackage.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 QueryFunctionsPackage.AGGREGATE: |
| { |
| Aggregate aggregate = (Aggregate)theEObject; |
| T result = caseAggregate(aggregate); |
| if (result == null) result = caseModelElementQuery(aggregate); |
| if (result == null) result = caseTerm(aggregate); |
| if (result == null) result = caseGTASMElement(aggregate); |
| if (result == null) result = caseAnnotatedElement(aggregate); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.SOURCE: |
| { |
| Source source = (Source)theEObject; |
| T result = caseSource(source); |
| if (result == null) result = caseModelElementQuery(source); |
| if (result == null) result = caseTerm(source); |
| if (result == null) result = caseGTASMElement(source); |
| if (result == null) result = caseAnnotatedElement(source); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.TARGET: |
| { |
| Target target = (Target)theEObject; |
| T result = caseTarget(target); |
| if (result == null) result = caseModelElementQuery(target); |
| if (result == null) result = caseTerm(target); |
| if (result == null) result = caseGTASMElement(target); |
| if (result == null) result = caseAnnotatedElement(target); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.ELEMENT_REFERENCE: |
| { |
| ElementReference elementReference = (ElementReference)theEObject; |
| T result = caseElementReference(elementReference); |
| if (result == null) result = caseModelElementQuery(elementReference); |
| if (result == null) result = caseTerm(elementReference); |
| if (result == null) result = caseGTASMElement(elementReference); |
| if (result == null) result = caseAnnotatedElement(elementReference); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.FULLY_QUALIFIED_NAME: |
| { |
| FullyQualifiedName fullyQualifiedName = (FullyQualifiedName)theEObject; |
| T result = caseFullyQualifiedName(fullyQualifiedName); |
| if (result == null) result = caseModelElementQuery(fullyQualifiedName); |
| if (result == null) result = caseTerm(fullyQualifiedName); |
| if (result == null) result = caseGTASMElement(fullyQualifiedName); |
| if (result == null) result = caseAnnotatedElement(fullyQualifiedName); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.NAME: |
| { |
| Name name = (Name)theEObject; |
| T result = caseName(name); |
| if (result == null) result = caseModelElementQuery(name); |
| if (result == null) result = caseTerm(name); |
| if (result == null) result = caseGTASMElement(name); |
| if (result == null) result = caseAnnotatedElement(name); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.VALUE: |
| { |
| Value value = (Value)theEObject; |
| T result = caseValue(value); |
| if (result == null) result = caseModelElementQuery(value); |
| if (result == null) result = caseTerm(value); |
| if (result == null) result = caseGTASMElement(value); |
| if (result == null) result = caseAnnotatedElement(value); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.INVERSE: |
| { |
| Inverse inverse = (Inverse)theEObject; |
| T result = caseInverse(inverse); |
| if (result == null) result = caseModelElementQuery(inverse); |
| if (result == null) result = caseTerm(inverse); |
| if (result == null) result = caseGTASMElement(inverse); |
| if (result == null) result = caseAnnotatedElement(inverse); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case QueryFunctionsPackage.MULTIPLICITY: |
| { |
| Multiplicity multiplicity = (Multiplicity)theEObject; |
| T result = caseMultiplicity(multiplicity); |
| if (result == null) result = caseModelElementQuery(multiplicity); |
| if (result == null) result = caseTerm(multiplicity); |
| if (result == null) result = caseGTASMElement(multiplicity); |
| if (result == null) result = caseAnnotatedElement(multiplicity); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| default: return defaultCase(theEObject); |
| } |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Aggregate</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>Aggregate</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseAggregate(Aggregate object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Source</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>Source</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseSource(Source object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Target</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>Target</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseTarget(Target object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Element 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>Element Reference</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseElementReference(ElementReference object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Fully Qualified Name</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>Fully Qualified Name</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseFullyQualifiedName(FullyQualifiedName object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Name</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>Name</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseName(Name object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Value</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>Value</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseValue(Value object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Inverse</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>Inverse</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseInverse(Inverse object) |
| { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Multiplicity</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>Multiplicity</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T caseMultiplicity(Multiplicity 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>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>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>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; |
| } |
| |
| } //QueryFunctionsSwitch |