/** * <copyright> * </copyright> * * $Id$ */ package org.ubicompforall.simplelanguage.util; import java.util.List; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.ubicompforall.simplelanguage.*; /** * <!-- 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.ubicompforall.simplelanguage.SimpleLanguagePackage * @generated */ public class SimpleLanguageSwitch<T> { /** * The cached model package * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected static SimpleLanguagePackage modelPackage; /** * Creates an instance of the switch. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public SimpleLanguageSwitch() { if (modelPackage == null) { modelPackage = SimpleLanguagePackage.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 SimpleLanguagePackage.STEP: { Step step = (Step)theEObject; T result = caseStep(step); if (result == null) result = caseBuildingBlock(step); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.TRIGGER: { Trigger trigger = (Trigger)theEObject; T result = caseTrigger(trigger); if (result == null) result = caseBuildingBlock(trigger); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.CONDITIONAL_STEP: { ConditionalStep conditionalStep = (ConditionalStep)theEObject; T result = caseConditionalStep(conditionalStep); if (result == null) result = caseStep(conditionalStep); if (result == null) result = caseBuildingBlock(conditionalStep); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.TASK: { Task task = (Task)theEObject; T result = caseTask(task); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.QUERY: { Query query = (Query)theEObject; T result = caseQuery(query); if (result == null) result = caseInformationObject(query); if (result == null) result = caseStep(query); if (result == null) result = caseBuildingBlock(query); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.PROPERTY_REFERENCE: { PropertyReference propertyReference = (PropertyReference)theEObject; T result = casePropertyReference(propertyReference); if (result == null) result = casePropertyAssignment(propertyReference); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.INFORMATION_OBJECT: { InformationObject informationObject = (InformationObject)theEObject; T result = caseInformationObject(informationObject); if (result == null) result = caseBuildingBlock(informationObject); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.CONDITION: { Condition condition = (Condition)theEObject; T result = caseCondition(condition); if (result == null) result = caseBuildingBlock(condition); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.BUILDING_BLOCK: { BuildingBlock buildingBlock = (BuildingBlock)theEObject; T result = caseBuildingBlock(buildingBlock); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.DOMAIN_OBJECT_REFERENCE: { DomainObjectReference domainObjectReference = (DomainObjectReference)theEObject; T result = caseDomainObjectReference(domainObjectReference); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.PROPERTY_ASSIGNMENT: { PropertyAssignment propertyAssignment = (PropertyAssignment)theEObject; T result = casePropertyAssignment(propertyAssignment); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.USER_SERVICE: { UserService userService = (UserService)theEObject; T result = caseUserService(userService); if (result == null) result = defaultCase(theEObject); return result; } case SimpleLanguagePackage.DOMAIN_OBJECT_ASSIGNMENT: { DomainObjectAssignment domainObjectAssignment = (DomainObjectAssignment)theEObject; T result = caseDomainObjectAssignment(domainObjectAssignment); if (result == null) result = casePropertyAssignment(domainObjectAssignment); if (result == null) result = defaultCase(theEObject); return result; } default: return defaultCase(theEObject); } } /** * Returns the result of interpreting the object as an instance of '<em>Step</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>Step</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseStep(Step object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Trigger</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>Trigger</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseTrigger(Trigger object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Conditional Step</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>Conditional Step</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseConditionalStep(ConditionalStep object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Task</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>Task</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseTask(Task 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>Property 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>Property Reference</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T casePropertyReference(PropertyReference object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Information Object</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>Information Object</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseInformationObject(InformationObject object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Condition</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>Condition</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseCondition(Condition object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Building Block</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>Building Block</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseBuildingBlock(BuildingBlock object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Domain Object 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>Domain Object Reference</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseDomainObjectReference(DomainObjectReference object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Property 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>Property Assignment</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T casePropertyAssignment(PropertyAssignment object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>User Service</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>User Service</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseUserService(UserService object) { return null; } /** * Returns the result of interpreting the object as an instance of '<em>Domain Object 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>Domain Object Assignment</em>'. * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) * @generated */ public T caseDomainObjectAssignment(DomainObjectAssignment 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; } } //SimpleLanguageSwitch