blob: ce65bad7a1af0fc1ca733e8adb4559969e67dc1c [file] [log] [blame]
/**
* Copyright (c) 2011, 2012 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) - Design
* Nicolas Guyomar (Mia-Software) - Implementation
* Emmanuelle Rouillé (Mia-Software) - Bug 352618 - To be able to use non derived facet structural features and save them values.
* Nicolas Bros (Mia-Software) - Bug 361823 - [Restructuring] eFacet2 meta-model
* Gregoire Dupe (Mia-Software) - Bug 366055 - NavigationQuery
* Gregoire Dupe (Mia-Software) - Bug 369673 - [Facet] IsOneOfQuery
* Olivier Remaud (Soft-Maint) - Bug 369824 - Add a simple way to return string literal constants from a customization query
* Gregoire Dupe (Mia-software) - Bug 369987 - [Restructuring][Table] Switch to the new customization and facet framework
* Gregoire Dupe (Mia-Software) - Bug 364325 - [Restructuring] The user must be able to navigate into a model using the Facet.
*/
package org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.util;
import java.util.List;
import org.eclipse.emf.ecore.EAttribute;
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.EOperation;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.ETypedElement;
import org.eclipse.modisco.facet.efacet.metamodel.v0_2_0.efacet.*;
/**
* <!-- 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.efacet.metamodel.v0_2_0.efacet.EFacetPackage
* @generated
*/
public class EFacetSwitch<T> {
/**
* The cached model package
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected static EFacetPackage modelPackage;
/**
* Creates an instance of the switch.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EFacetSwitch() {
if (modelPackage == null) {
modelPackage = EFacetPackage.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 EFacetPackage.FACET_ATTRIBUTE: {
FacetAttribute facetAttribute = (FacetAttribute)theEObject;
T result = caseFacetAttribute(facetAttribute);
if (result == null) result = caseEAttribute(facetAttribute);
if (result == null) result = caseDerivedTypedElement(facetAttribute);
if (result == null) result = caseEStructuralFeature(facetAttribute);
if (result == null) result = caseFacetElement(facetAttribute);
if (result == null) result = caseETypedElement(facetAttribute);
if (result == null) result = caseDocumentedElement(facetAttribute);
if (result == null) result = caseENamedElement(facetAttribute);
if (result == null) result = caseEModelElement(facetAttribute);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.FACET_REFERENCE: {
FacetReference facetReference = (FacetReference)theEObject;
T result = caseFacetReference(facetReference);
if (result == null) result = caseEReference(facetReference);
if (result == null) result = caseDerivedTypedElement(facetReference);
if (result == null) result = caseEStructuralFeature(facetReference);
if (result == null) result = caseFacetElement(facetReference);
if (result == null) result = caseETypedElement(facetReference);
if (result == null) result = caseDocumentedElement(facetReference);
if (result == null) result = caseENamedElement(facetReference);
if (result == null) result = caseEModelElement(facetReference);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.FACET_OPERATION: {
FacetOperation facetOperation = (FacetOperation)theEObject;
T result = caseFacetOperation(facetOperation);
if (result == null) result = caseEOperation(facetOperation);
if (result == null) result = caseDerivedTypedElement(facetOperation);
if (result == null) result = caseFacetElement(facetOperation);
if (result == null) result = caseETypedElement(facetOperation);
if (result == null) result = caseENamedElement(facetOperation);
if (result == null) result = caseDocumentedElement(facetOperation);
if (result == null) result = caseEModelElement(facetOperation);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.FACET_SET: {
FacetSet facetSet = (FacetSet)theEObject;
T result = caseFacetSet(facetSet);
if (result == null) result = caseEPackage(facetSet);
if (result == null) result = caseDocumentedElement(facetSet);
if (result == null) result = caseENamedElement(facetSet);
if (result == null) result = caseEModelElement(facetSet);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.FACET: {
Facet facet = (Facet)theEObject;
T result = caseFacet(facet);
if (result == null) result = caseEClassifier(facet);
if (result == null) result = caseDocumentedElement(facet);
if (result == null) result = caseENamedElement(facet);
if (result == null) result = caseEModelElement(facet);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.CATEGORY: {
Category category = (Category)theEObject;
T result = caseCategory(category);
if (result == null) result = caseENamedElement(category);
if (result == null) result = caseDocumentedElement(category);
if (result == null) result = caseEModelElement(category);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.FACET_ELEMENT: {
FacetElement facetElement = (FacetElement)theEObject;
T result = caseFacetElement(facetElement);
if (result == null) result = caseETypedElement(facetElement);
if (result == null) result = caseDocumentedElement(facetElement);
if (result == null) result = caseENamedElement(facetElement);
if (result == null) result = caseEModelElement(facetElement);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.DERIVED_TYPED_ELEMENT: {
DerivedTypedElement derivedTypedElement = (DerivedTypedElement)theEObject;
T result = caseDerivedTypedElement(derivedTypedElement);
if (result == null) result = caseFacetElement(derivedTypedElement);
if (result == null) result = caseETypedElement(derivedTypedElement);
if (result == null) result = caseDocumentedElement(derivedTypedElement);
if (result == null) result = caseENamedElement(derivedTypedElement);
if (result == null) result = caseEModelElement(derivedTypedElement);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.PARAMETER_VALUE: {
ParameterValue parameterValue = (ParameterValue)theEObject;
T result = caseParameterValue(parameterValue);
if (result == null) result = defaultCase(theEObject);
return result;
}
case EFacetPackage.DOCUMENTED_ELEMENT: {
DocumentedElement documentedElement = (DocumentedElement)theEObject;
T result = caseDocumentedElement(documentedElement);
if (result == null) result = defaultCase(theEObject);
return result;
}
default: return defaultCase(theEObject);
}
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet Attribute</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 Attribute</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacetAttribute(FacetAttribute object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet 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>Facet Reference</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacetReference(FacetReference object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet 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>Facet Operation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacetOperation(FacetOperation 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>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>Category</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>Category</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseCategory(Category object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Facet 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>Facet Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseFacetElement(FacetElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Derived 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>Derived Typed Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseDerivedTypedElement(DerivedTypedElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>Parameter 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>Parameter Value</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseParameterValue(ParameterValue 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>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>ETyped 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>ETyped Element</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseETypedElement(ETypedElement object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EStructural 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>EStructural Feature</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEStructuralFeature(EStructuralFeature object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EAttribute</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>EAttribute</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEAttribute(EAttribute object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EReference</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>EReference</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEReference(EReference object) {
return null;
}
/**
* Returns the result of interpreting the object as an instance of '<em>EOperation</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>EOperation</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/
public T caseEOperation(EOperation 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>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>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;
}
} //EFacetSwitch