| package org.eclipse.stem.tests.util.decorators.util; |
| |
| /******************************************************************************* |
| * Copyright (c) 2006 IBM Corporation 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: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| |
| |
| import java.util.List; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EObject; |
| import org.eclipse.stem.core.common.Identifiable; |
| import org.eclipse.stem.core.model.Decorator; |
| import org.eclipse.stem.core.model.EdgeDecorator; |
| import org.eclipse.stem.core.model.GraphDecorator; |
| import org.eclipse.stem.core.model.NodeDecorator; |
| import org.eclipse.stem.tests.util.decorators.DecoratorsPackage; |
| import org.eclipse.stem.tests.util.decorators.TestEdgeDecorator1; |
| import org.eclipse.stem.tests.util.decorators.TestGraphDecorator1; |
| import org.eclipse.stem.tests.util.decorators.TestNodeDecorator1; |
| import org.eclipse.stem.tests.util.decorators.TestScenarioGraphDecorator1; |
| |
| /** |
| * <!-- 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.stem.tests.util.decorators.DecoratorsPackage |
| * @generated |
| */ |
| public class DecoratorsSwitch<T1> { |
| /** |
| * The cached model package |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected static DecoratorsPackage modelPackage; |
| |
| /** |
| * Creates an instance of the switch. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DecoratorsSwitch() { |
| if (modelPackage == null) { |
| modelPackage = DecoratorsPackage.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 T1 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 T1 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 T1 doSwitch(int classifierID, EObject theEObject) { |
| switch (classifierID) { |
| case DecoratorsPackage.TEST_EDGE_DECORATOR1: { |
| TestEdgeDecorator1 testEdgeDecorator1 = (TestEdgeDecorator1)theEObject; |
| T1 result = caseTestEdgeDecorator1(testEdgeDecorator1); |
| if (result == null) result = caseEdgeDecorator_1(testEdgeDecorator1); |
| if (result == null) result = caseDecorator(testEdgeDecorator1); |
| if (result == null) result = caseIdentifiable(testEdgeDecorator1); |
| if (result == null) result = caseComparable(testEdgeDecorator1); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case DecoratorsPackage.TEST_GRAPH_DECORATOR1: { |
| TestGraphDecorator1 testGraphDecorator1 = (TestGraphDecorator1)theEObject; |
| T1 result = caseTestGraphDecorator1(testGraphDecorator1); |
| if (result == null) result = caseGraphDecorator_1(testGraphDecorator1); |
| if (result == null) result = caseDecorator(testGraphDecorator1); |
| if (result == null) result = caseIdentifiable(testGraphDecorator1); |
| if (result == null) result = caseComparable(testGraphDecorator1); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case DecoratorsPackage.TEST_NODE_DECORATOR1: { |
| TestNodeDecorator1 testNodeDecorator1 = (TestNodeDecorator1)theEObject; |
| T1 result = caseTestNodeDecorator1(testNodeDecorator1); |
| if (result == null) result = caseNodeDecorator_1(testNodeDecorator1); |
| if (result == null) result = caseDecorator(testNodeDecorator1); |
| if (result == null) result = caseIdentifiable(testNodeDecorator1); |
| if (result == null) result = caseComparable(testNodeDecorator1); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| case DecoratorsPackage.TEST_SCENARIO_GRAPH_DECORATOR1: { |
| TestScenarioGraphDecorator1 testScenarioGraphDecorator1 = (TestScenarioGraphDecorator1)theEObject; |
| T1 result = caseTestScenarioGraphDecorator1(testScenarioGraphDecorator1); |
| if (result == null) result = caseGraphDecorator_1(testScenarioGraphDecorator1); |
| if (result == null) result = caseDecorator(testScenarioGraphDecorator1); |
| if (result == null) result = caseIdentifiable(testScenarioGraphDecorator1); |
| if (result == null) result = caseComparable(testScenarioGraphDecorator1); |
| if (result == null) result = defaultCase(theEObject); |
| return result; |
| } |
| default: return defaultCase(theEObject); |
| } |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Test Node Decorator1</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>Test Node Decorator1</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseTestNodeDecorator1(TestNodeDecorator1 object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Test Edge Decorator1</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>Test Edge Decorator1</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseTestEdgeDecorator1(TestEdgeDecorator1 object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Test Graph Decorator1</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>Test Graph Decorator1</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseTestGraphDecorator1(TestGraphDecorator1 object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Test Scenario Graph Decorator1</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>Test Scenario Graph Decorator1</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseTestScenarioGraphDecorator1(TestScenarioGraphDecorator1 object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Node Decorator</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>Node Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseNodeDecorator(NodeDecorator object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Comparable</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>Comparable</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public <T> T1 caseComparable(Comparable<T> object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Identifiable</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>Identifiable</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseIdentifiable(Identifiable object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Decorator</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>Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseDecorator(Decorator object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Edge Decorator</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>Edge Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseEdgeDecorator_1(EdgeDecorator object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Graph Decorator</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>Graph Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseGraphDecorator_1(GraphDecorator object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Node Decorator</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>Node Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseNodeDecorator_1(NodeDecorator object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Edge Decorator</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>Edge Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseEdgeDecorator(EdgeDecorator object) { |
| return null; |
| } |
| |
| /** |
| * Returns the result of interpreting the object as an instance of '<em>Graph Decorator</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>Graph Decorator</em>'. |
| * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| * @generated |
| */ |
| public T1 caseGraphDecorator(GraphDecorator 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 T1 defaultCase(EObject object) { |
| return null; |
| } |
| |
| } //DecoratorsSwitch |