blob: 828162b606cc2b7a3d6dc64a053b7aa92536eda0 [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.qvtrelation.util;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.util.Switch;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.ocl.pivot.Element;
import org.eclipse.ocl.pivot.Model;
import org.eclipse.ocl.pivot.NamedElement;
import org.eclipse.ocl.pivot.Namespace;
import org.eclipse.ocl.pivot.OCLExpression;
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.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.Pattern;
import org.eclipse.qvtd.pivot.qvtbase.Rule;
import org.eclipse.qvtd.pivot.qvtbase.Transformation;
import org.eclipse.qvtd.pivot.qvtrelation.DomainPattern;
import org.eclipse.qvtd.pivot.qvtrelation.Key;
import org.eclipse.qvtd.pivot.qvtrelation.QVTrelationPackage;
import org.eclipse.qvtd.pivot.qvtrelation.Relation;
import org.eclipse.qvtd.pivot.qvtrelation.RelationCallExp;
import org.eclipse.qvtd.pivot.qvtrelation.RelationDomain;
import org.eclipse.qvtd.pivot.qvtrelation.RelationDomainAssignment;
import org.eclipse.qvtd.pivot.qvtrelation.RelationImplementation;
import org.eclipse.qvtd.pivot.qvtrelation.RelationModel;
import org.eclipse.qvtd.pivot.qvtrelation.RelationalTransformation;
/**
* <!-- 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.qvtrelation.QVTrelationPackage
* @generated
*/
public class QVTrelationSwitch<@Nullable T> extends Switch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static QVTrelationPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public QVTrelationSwitch() {
if (modelPackage == null) {
modelPackage = QVTrelationPackage.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 QVTrelationPackage.DOMAIN_PATTERN: {
DomainPattern domainPattern = (DomainPattern)theEObject;
T result = caseDomainPattern(domainPattern);
if (result == null) result = casePattern(domainPattern);
if (result == null) result = caseElement(domainPattern);
if (result == null) result = caseVisitable(domainPattern);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.KEY: {
Key key = (Key)theEObject;
T result = caseKey(key);
if (result == null) result = caseElement(key);
if (result == null) result = caseVisitable(key);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATION: {
Relation relation = (Relation)theEObject;
T result = caseRelation(relation);
if (result == null) result = caseRule(relation);
if (result == null) result = caseNamedElement(relation);
if (result == null) result = caseElement(relation);
if (result == null) result = caseNameable(relation);
if (result == null) result = caseVisitable(relation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATION_CALL_EXP: {
RelationCallExp relationCallExp = (RelationCallExp)theEObject;
T result = caseRelationCallExp(relationCallExp);
if (result == null) result = caseOCLExpression(relationCallExp);
if (result == null) result = caseTypedElement(relationCallExp);
if (result == null) result = caseNamedElement(relationCallExp);
if (result == null) result = caseElement(relationCallExp);
if (result == null) result = caseNameable(relationCallExp);
if (result == null) result = caseVisitable(relationCallExp);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATION_DOMAIN: {
RelationDomain relationDomain = (RelationDomain)theEObject;
T result = caseRelationDomain(relationDomain);
if (result == null) result = caseDomain(relationDomain);
if (result == null) result = caseNamedElement(relationDomain);
if (result == null) result = caseReferringElement(relationDomain);
if (result == null) result = caseElement(relationDomain);
if (result == null) result = caseNameable(relationDomain);
if (result == null) result = caseVisitable(relationDomain);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATION_DOMAIN_ASSIGNMENT: {
RelationDomainAssignment relationDomainAssignment = (RelationDomainAssignment)theEObject;
T result = caseRelationDomainAssignment(relationDomainAssignment);
if (result == null) result = caseElement(relationDomainAssignment);
if (result == null) result = caseVisitable(relationDomainAssignment);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATION_MODEL: {
RelationModel relationModel = (RelationModel)theEObject;
T result = caseRelationModel(relationModel);
if (result == null) result = caseBaseModel(relationModel);
if (result == null) result = caseModel(relationModel);
if (result == null) result = caseNamespace(relationModel);
if (result == null) result = caseNamedElement(relationModel);
if (result == null) result = caseElement(relationModel);
if (result == null) result = caseNameable(relationModel);
if (result == null) result = caseVisitable(relationModel);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATION_IMPLEMENTATION: {
RelationImplementation relationImplementation = (RelationImplementation)theEObject;
T result = caseRelationImplementation(relationImplementation);
if (result == null) result = caseElement(relationImplementation);
if (result == null) result = caseVisitable(relationImplementation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case QVTrelationPackage.RELATIONAL_TRANSFORMATION: {
RelationalTransformation relationalTransformation = (RelationalTransformation)theEObject;
T result = caseRelationalTransformation(relationalTransformation);
if (result == null) result = caseTransformation(relationalTransformation);
if (result == null) result = caseClass(relationalTransformation);
if (result == null) result = caseType(relationalTransformation);
if (result == null) result = caseNamespace(relationalTransformation);
if (result == null) result = caseTemplateableElement(relationalTransformation);
if (result == null) result = caseNamedElement(relationalTransformation);
if (result == null) result = caseElement(relationalTransformation);
if (result == null) result = caseNameable(relationalTransformation);
if (result == null) result = caseVisitable(relationalTransformation);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Domain 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>Domain Pattern</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDomainPattern(DomainPattern object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Key</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>Key</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseKey(Key object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relation</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>Relation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelation(Relation object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relation Call Exp</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>Relation Call Exp</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelationCallExp(RelationCallExp object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relation 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>Relation Domain</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelationDomain(RelationDomain object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relation Domain 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>Relation Domain Assignment</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelationDomainAssignment(RelationDomainAssignment object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relation 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>Relation Model</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelationModel(RelationModel object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relation Implementation</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>Relation Implementation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelationImplementation(RelationImplementation object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Relational 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>Relational Transformation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseRelationalTransformation(RelationalTransformation 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>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>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>OCL 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>OCL Expression</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseOCLExpression(OCLExpression 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>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>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>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>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>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>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>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>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>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;
}
} //QVTrelationSwitch