/** * <copyright> * </copyright> * * $Id: ModelSwitch.java,v 1.4 2011/03/31 14:04:44 rbrodt Exp $ */ package org.eclipse.bpel.extensionsample.model.util; import java.util.List; import javax.wsdl.extensions.AttributeExtensible; import javax.wsdl.extensions.ElementExtensible; import org.eclipse.bpel.extensionsample.model.*; import org.eclipse.bpel.model.Activity; import org.eclipse.bpel.model.BPELExtensibleElement; import org.eclipse.bpel.model.ExtensionActivity; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.wst.wsdl.ExtensibleElement; import org.eclipse.wst.wsdl.WSDLElement; /** * <!-- 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. * * Bug 120110 - this class has been updated to include a Variable * reference for the SampleSimpleActivity and a Variable definition * for the SampleStructuredActivity. * * <!-- end-user-doc --> * @see org.eclipse.bpel.extensionsample.model.ModelPackage * @generated */ public class ModelSwitch<T> { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static ModelPackage modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ModelSwitch() { if (modelPackage == null) { modelPackage = ModelPackage.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 ModelPackage.SAMPLE_SIMPLE_ACTIVITY: { SampleSimpleActivity sampleSimpleActivity = (SampleSimpleActivity)theEObject; T result = caseSampleSimpleActivity(sampleSimpleActivity); if (result == null) result = caseExtensionActivity(sampleSimpleActivity); if (result == null) result = caseActivity(sampleSimpleActivity); if (result == null) result = caseBPELExtensibleElement(sampleSimpleActivity); if (result == null) result = caseExtensibleElement(sampleSimpleActivity); if (result == null) result = caseWSDLElement(sampleSimpleActivity); if (result == null) result = caseIElementExtensible(sampleSimpleActivity); if (result == null) result = caseIAttributeExtensible(sampleSimpleActivity); if (result == null) result = defaultCase(theEObject); return result; } case ModelPackage.SAMPLE_STRUCTURED_ACTIVITY: { SampleStructuredActivity sampleStructuredActivity = (SampleStructuredActivity)theEObject; T result = caseSampleStructuredActivity(sampleStructuredActivity); if (result == null) result = caseExtensionActivity(sampleStructuredActivity); if (result == null) result = caseActivity(sampleStructuredActivity); if (result == null) result = caseBPELExtensibleElement(sampleStructuredActivity); if (result == null) result = caseExtensibleElement(sampleStructuredActivity); if (result == null) result = caseWSDLElement(sampleStructuredActivity); if (result == null) result = caseIElementExtensible(sampleStructuredActivity); if (result == null) result = caseIAttributeExtensible(sampleStructuredActivity); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>Sample Simple Activity</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>Sample Simple Activity</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSampleSimpleActivity(SampleSimpleActivity object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Sample Structured Activity</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>Sample Structured Activity</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseSampleStructuredActivity(SampleStructuredActivity 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 caseWSDLElement(WSDLElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>IElement Extensible</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>IElement Extensible</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseIElementExtensible(ElementExtensible object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>IAttribute Extensible</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>IAttribute Extensible</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseIAttributeExtensible(AttributeExtensible object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Extensible 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>Extensible Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseExtensibleElement(ExtensibleElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Extensible 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>Extensible Element</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseBPELExtensibleElement(BPELExtensibleElement object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Activity</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>Activity</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseActivity(Activity object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Extension Activity</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>Extension Activity</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseExtensionActivity(ExtensionActivity 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; } } //ModelSwitch