blob: b4ef8e16c20236d0eb7a258e2021eb0e34edb982 [file] [log] [blame]
/**
* Copyright (c) 2011, 2019 Mia-Software.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v2.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v20.html
*
* Contributors:
* Gregoire Dupe (Mia-Software) - Bug 361794 - [Restructuring] New customization meta-model
* Gregoire Dupe (Mia-Software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
* Gregoire Dupe (Mia-Software) - Bug 373078 - API Cleaning
*/
package org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.util;
import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EModelElement;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.modisco.facet.custom.metamodel.v0_2_0.custom.*;
import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.DocumentedElement;
import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.Facet;
import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.FacetSet;
import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
/**
* <!-- 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.modisco.facet.custom.metamodel.v0_2_0.custom.CustomPackage
* @generated
*/
public class CustomSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static CustomPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public CustomSwitch() {
if (modelPackage == null) {
modelPackage = CustomPackage.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 CustomPackage.CUSTOMIZATION: {
Customization customization = (Customization)theEObject;
T result = caseCustomization(customization);
if (result == null) result = caseFacetSet(customization);
if (result == null) result = caseEPackage(customization);
if (result == null) result = caseDocumentedElement(customization);
if (result == null) result = caseENamedElement(customization);
if (result == null) result = caseEModelElement(customization);
if (result == null) result = defaultCase(theEObject);
return result;
}
case CustomPackage.ECLASS_CUSTOMIZATION: {
EClassCustomization eClassCustomization = (EClassCustomization)theEObject;
T result = caseEClassCustomization(eClassCustomization);
if (result == null) result = caseFacet(eClassCustomization);
if (result == null) result = caseEClassifier(eClassCustomization);
if (result == null) result = caseDocumentedElement(eClassCustomization);
if (result == null) result = caseENamedElement(eClassCustomization);
if (result == null) result = caseEModelElement(eClassCustomization);
if (result == null) result = defaultCase(theEObject);
return result;
}
case CustomPackage.FACET_CUSTOMIZATION: {
FacetCustomization facetCustomization = (FacetCustomization)theEObject;
T result = caseFacetCustomization(facetCustomization);
if (result == null) result = caseFacet(facetCustomization);
if (result == null) result = caseEClassifier(facetCustomization);
if (result == null) result = caseDocumentedElement(facetCustomization);
if (result == null) result = caseENamedElement(facetCustomization);
if (result == null) result = caseEModelElement(facetCustomization);
if (result == null) result = defaultCase(theEObject);
return result;
}
case CustomPackage.ETYPED_ELEMENT_SWITCH_QUERY: {
ETypedElementSwitchQuery eTypedElementSwitchQuery = (ETypedElementSwitchQuery)theEObject;
T result = caseETypedElementSwitchQuery(eTypedElementSwitchQuery);
if (result == null) result = caseQuery(eTypedElementSwitchQuery);
if (result == null) result = defaultCase(theEObject);
return result;
}
case CustomPackage.ETYPED_ELEMENT_CASE: {
ETypedElementCase eTypedElementCase = (ETypedElementCase)theEObject;
T result = caseETypedElementCase(eTypedElementCase);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Customization</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>Customization</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCustomization(Customization object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EClass Customization</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>EClass Customization</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEClassCustomization(EClassCustomization object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet Customization</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>Facet Customization</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacetCustomization(FacetCustomization object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>ETyped Element Switch 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>ETyped Element Switch Query</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseETypedElementSwitchQuery(ETypedElementSwitchQuery object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>ETyped Element Case</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>ETyped Element Case</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseETypedElementCase(ETypedElementCase object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EModel 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>EModel Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEModelElement(EModelElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>ENamed 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>ENamed Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseENamedElement(ENamedElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EPackage</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>EPackage</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEPackage(EPackage object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Documented 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>Documented Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDocumentedElement(DocumentedElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet Set</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>Facet Set</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacetSet(FacetSet object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EClassifier</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>EClassifier</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEClassifier(EClassifier object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet</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>Facet</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacet(Facet object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>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>Query</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseQuery(Query 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;
}
} //CustomSwitch