blob: 4d352ff24fd1e679c10472e68cd3af3bed738253 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011, 2015 Willink Transformations and others.
* 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:
* E.D.Willink - initial API and implementation
*******************************************************************************/
package org.eclipse.qvtd.pivot.qvtbase.util;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.Feature;
import org.eclipse.ocl.pivot.Model;
import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.Namespace;
import org.eclipse.ocl.pivot.Operation;
import org.eclipse.ocl.pivot.Parameter;
import org.eclipse.ocl.pivot.ReferringElement;
import org.eclipse.ocl.pivot.TemplateableElement;
import org.eclipse.ocl.pivot.Type;
import org.eclipse.ocl.pivot.TypedElement;
import org.eclipse.ocl.pivot.Variable;
import org.eclipse.ocl.pivot.VariableDeclaration;
import org.eclipse.ocl.pivot.util.Visitable;
import org.eclipse.ocl.pivot.utilities.Nameable;
import org.eclipse.qvtd.pivot.qvtbase.BaseModel;
import org.eclipse.qvtd.pivot.qvtbase.Domain;
import org.eclipse.qvtd.pivot.qvtbase.Function;
import org.eclipse.qvtd.pivot.qvtbase.FunctionParameter;
import org.eclipse.qvtd.pivot.qvtbase.Pattern;
import org.eclipse.qvtd.pivot.qvtbase.Predicate;
import org.eclipse.qvtd.pivot.qvtbase.QVTbasePackage;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtbase.TypedModel;
/**
* <!-- 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.qvtd.pivot.qvtbase.QVTbasePackage
* @generated
*/
public class QVTbaseSwitch<T> extends Switch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static QVTbasePackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QVTbaseSwitch() {
if (modelPackage == null) {
modelPackage = QVTbasePackage.eINSTANCE;
}
}
/**
* Checks whether this is a switch for the given package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param ePackage the package in question.
* @return whether this is a switch for the given package.
* @generated
*/
@Override
protected boolean isSwitchFor(EPackage ePackage) {
return ePackage == modelPackage;
}
/**
* 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
*/
@Override
protected T doSwitch(int classifierID, EObject theEObject) {
switch (classifierID) {
case QVTbasePackage.BASE_MODEL: {
BaseModel baseModel = (BaseModel)theEObject;
T result = caseBaseModel(baseModel);
if (result == null) result = caseModel(baseModel);
if (result == null) result = caseNamespace(baseModel);
if (result == null) result = caseNamedElement(baseModel);
if (result == null) result = caseElement(baseModel);
if (result == null) result = caseNameable(baseModel);
if (result == null) result = caseVisitable(baseModel);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.DOMAIN: {
Domain domain = (Domain)theEObject;
T result = caseDomain(domain);
if (result == null) result = caseNamedElement(domain);
if (result == null) result = caseReferringElement(domain);
if (result == null) result = caseElement(domain);
if (result == null) result = caseNameable(domain);
if (result == null) result = caseVisitable(domain);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.FUNCTION: {
Function function = (Function)theEObject;
T result = caseFunction(function);
if (result == null) result = caseOperation(function);
if (result == null) result = caseFeature(function);
if (result == null) result = caseNamespace(function);
if (result == null) result = caseTemplateableElement(function);
if (result == null) result = caseTypedElement(function);
if (result == null) result = caseNamedElement(function);
if (result == null) result = caseElement(function);
if (result == null) result = caseNameable(function);
if (result == null) result = caseVisitable(function);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.FUNCTION_PARAMETER: {
FunctionParameter functionParameter = (FunctionParameter)theEObject;
T result = caseFunctionParameter(functionParameter);
if (result == null) result = caseParameter(functionParameter);
if (result == null) result = caseVariable(functionParameter);
if (result == null) result = caseVariableDeclaration(functionParameter);
if (result == null) result = caseTypedElement(functionParameter);
if (result == null) result = caseNamedElement(functionParameter);
if (result == null) result = caseElement(functionParameter);
if (result == null) result = caseNameable(functionParameter);
if (result == null) result = caseVisitable(functionParameter);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.PATTERN: {
Pattern pattern = (Pattern)theEObject;
T result = casePattern(pattern);
if (result == null) result = caseElement(pattern);
if (result == null) result = caseVisitable(pattern);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.PREDICATE: {
Predicate predicate = (Predicate)theEObject;
T result = casePredicate(predicate);
if (result == null) result = caseElement(predicate);
if (result == null) result = caseVisitable(predicate);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.RULE: {
Rule rule = (Rule)theEObject;
T result = caseRule(rule);
if (result == null) result = caseNamedElement(rule);
if (result == null) result = caseElement(rule);
if (result == null) result = caseNameable(rule);
if (result == null) result = caseVisitable(rule);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.TRANSFORMATION: {
Transformation transformation = (Transformation)theEObject;
T result = caseTransformation(transformation);
if (result == null) result = caseClass(transformation);
if (result == null) result = caseType(transformation);
if (result == null) result = caseNamespace(transformation);
if (result == null) result = caseTemplateableElement(transformation);
if (result == null) result = caseNamedElement(transformation);
if (result == null) result = caseElement(transformation);
if (result == null) result = caseNameable(transformation);
if (result == null) result = caseVisitable(transformation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTbasePackage.TYPED_MODEL: {
TypedModel typedModel = (TypedModel)theEObject;
T result = caseTypedModel(typedModel);
if (result == null) result = caseNamedElement(typedModel);
if (result == null) result = caseElement(typedModel);
if (result == null) result = caseNameable(typedModel);
if (result == null) result = caseVisitable(typedModel);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Base Model</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>Base Model</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseBaseModel(BaseModel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Domain</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>Domain</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDomain(Domain object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Function</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</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFunction(Function object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Function 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>Function Parameter</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFunctionParameter(FunctionParameter object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>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>Pattern</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePattern(Pattern object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Predicate</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>Predicate</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T casePredicate(Predicate object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>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>Rule</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRule(Rule object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Transformation</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>Transformation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTransformation(Transformation object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Typed Model</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>Typed Model</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTypedModel(TypedModel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Visitable</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>Visitable</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVisitable(Visitable object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>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>Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseElement(Element object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Nameable</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>Nameable</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNameable(Nameable object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Named 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>Named Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNamedElement(NamedElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Typed 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>Typed Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTypedElement(TypedElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>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>Feature</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFeature(Feature object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Namespace</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>Namespace</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseNamespace(Namespace object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Model</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</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseModel(Model object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Referring 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>Referring Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseReferringElement(ReferringElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Templateable 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>Templateable Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseTemplateableElement(TemplateableElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Operation</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>Operation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseOperation(Operation object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Variable Declaration</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 Declaration</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseVariableDeclaration(VariableDeclaration object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>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>Parameter</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseParameter(Parameter 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>Type</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>Type</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseType(Type object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Class</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>Class</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseClass(org.eclipse.ocl.pivot.Class 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
*/
@Override
public T defaultCase(EObject object) {
return null;
}
} //QVTbaseSwitch