| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.identifier.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.identifier.*; |
| 10 | import java.util.List; |
| 11 | |
| 12 | import org.eclipse.emf.ecore.EClass; |
| 13 | import org.eclipse.emf.ecore.EObject; |
| 14 | |
| 15 | import de.uka.ipd.sdq.identifier.Identifier; |
| 16 | import de.uka.ipd.sdq.identifier.IdentifierPackage; |
| 17 | |
| 18 | /** |
| 19 | * <!-- begin-user-doc --> |
| 20 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 21 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 22 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 23 | * starting with the actual class of the object |
| 24 | * and proceeding up the inheritance hierarchy |
| 25 | * until a non-null result is returned, |
| 26 | * which is the result of the switch. |
| 27 | * <!-- end-user-doc --> |
| 28 | * @see de.uka.ipd.sdq.identifier.IdentifierPackage |
| 29 | * @generated |
| 30 | */ |
| 31 | public class IdentifierSwitch<T> { |
| 32 | /** |
| 33 | * <!-- begin-user-doc --> |
| 34 | * <!-- end-user-doc --> |
| 35 | * @generated |
| 36 | */ |
| 37 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 38 | /** |
| 39 | * The cached model package |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @generated |
| 43 | */ |
| 44 | protected static IdentifierPackage modelPackage; |
| 45 | |
| 46 | /** |
| 47 | * Creates an instance of the switch. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @generated |
| 51 | */ |
| 52 | public IdentifierSwitch() { |
| 53 | if (modelPackage == null) { |
| 54 | modelPackage = IdentifierPackage.eINSTANCE; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 60 | * <!-- begin-user-doc --> |
| 61 | * <!-- end-user-doc --> |
| 62 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 63 | * @generated |
| 64 | */ |
| 65 | public T doSwitch(EObject theEObject) { |
| 66 | return doSwitch(theEObject.eClass(), theEObject); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 74 | * @generated |
| 75 | */ |
| 76 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 77 | if (theEClass.eContainer() == modelPackage) { |
| 78 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 79 | } |
| 80 | else { |
| 81 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 82 | return |
| 83 | eSuperTypes.isEmpty() ? |
| 84 | defaultCase(theEObject) : |
| 85 | doSwitch(eSuperTypes.get(0), theEObject); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 91 | * <!-- begin-user-doc --> |
| 92 | * <!-- end-user-doc --> |
| 93 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 94 | * @generated |
| 95 | */ |
| 96 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 97 | switch (classifierID) { |
| 98 | case IdentifierPackage.IDENTIFIER: { |
| 99 | Identifier identifier = (Identifier)theEObject; |
| 100 | T result = caseIdentifier(identifier); |
| 101 | if (result == null) result = defaultCase(theEObject); |
| 102 | return result; |
| 103 | } |
| 104 | default: return defaultCase(theEObject); |
| 105 | } |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 110 | * <!-- begin-user-doc --> |
| 111 | * This implementation returns null; |
| 112 | * returning a non-null result will terminate the switch. |
| 113 | * <!-- end-user-doc --> |
| 114 | * @param object the target of the switch. |
| 115 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 116 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 117 | * @generated |
| 118 | */ |
| 119 | public T caseIdentifier(Identifier object) { |
| 120 | return null; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 125 | * <!-- begin-user-doc --> |
| 126 | * This implementation returns null; |
| 127 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 128 | * <!-- end-user-doc --> |
| 129 | * @param object the target of the switch. |
| 130 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 131 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 132 | * @generated |
| 133 | */ |
| 134 | public T defaultCase(EObject object) { |
| 135 | return null; |
| 136 | } |
| 137 | |
| 138 | } //IdentifierSwitch |