| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.*; |
| 10 | |
| 11 | import de.uka.ipd.sdq.identifier.Identifier; |
| 12 | |
| 13 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
| 14 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
| 15 | |
| 16 | import java.util.List; |
| 17 | |
| 18 | import org.eclipse.emf.ecore.EClass; |
| 19 | import org.eclipse.emf.ecore.EObject; |
| 20 | |
| 21 | /** |
| 22 | * <!-- begin-user-doc --> |
| 23 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 24 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 25 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 26 | * starting with the actual class of the object |
| 27 | * and proceeding up the inheritance hierarchy |
| 28 | * until a non-null result is returned, |
| 29 | * which is the result of the switch. |
| 30 | * <!-- end-user-doc --> |
| 31 | * @see de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.QMLDeclarationsPackage |
| 32 | * @generated |
| 33 | */ |
| 34 | public class QMLDeclarationsSwitch<T> { |
| 35 | /** |
| 36 | * The cached model package |
| 37 | * <!-- begin-user-doc --> |
| 38 | * <!-- end-user-doc --> |
| 39 | * @generated |
| 40 | */ |
| 41 | protected static QMLDeclarationsPackage modelPackage; |
| 42 | |
| 43 | /** |
| 44 | * Creates an instance of the switch. |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @generated |
| 48 | */ |
| 49 | public QMLDeclarationsSwitch() { |
| 50 | if (modelPackage == null) { |
| 51 | modelPackage = QMLDeclarationsPackage.eINSTANCE; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 60 | * @generated |
| 61 | */ |
| 62 | public T doSwitch(EObject theEObject) { |
| 63 | return doSwitch(theEObject.eClass(), theEObject); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 68 | * <!-- begin-user-doc --> |
| 69 | * <!-- end-user-doc --> |
| 70 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 71 | * @generated |
| 72 | */ |
| 73 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 74 | if (theEClass.eContainer() == modelPackage) { |
| 75 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 76 | } |
| 77 | else { |
| 78 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 79 | return |
| 80 | eSuperTypes.isEmpty() ? |
| 81 | defaultCase(theEObject) : |
| 82 | doSwitch(eSuperTypes.get(0), theEObject); |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 88 | * <!-- begin-user-doc --> |
| 89 | * <!-- end-user-doc --> |
| 90 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 91 | * @generated |
| 92 | */ |
| 93 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 94 | switch (classifierID) { |
| 95 | case QMLDeclarationsPackage.QML_DECLARATIONS: { |
| 96 | QMLDeclarations qmlDeclarations = (QMLDeclarations)theEObject; |
| 97 | T result = caseQMLDeclarations(qmlDeclarations); |
| 98 | if (result == null) result = caseIdentifier(qmlDeclarations); |
| 99 | if (result == null) result = defaultCase(theEObject); |
| 100 | return result; |
| 101 | } |
| 102 | case QMLDeclarationsPackage.QML_DECLARATION: { |
| 103 | QMLDeclaration qmlDeclaration = (QMLDeclaration)theEObject; |
| 104 | T result = caseQMLDeclaration(qmlDeclaration); |
| 105 | if (result == null) result = caseEntity(qmlDeclaration); |
| 106 | if (result == null) result = caseIdentifier(qmlDeclaration); |
| 107 | if (result == null) result = caseNamedElement(qmlDeclaration); |
| 108 | if (result == null) result = defaultCase(theEObject); |
| 109 | return result; |
| 110 | } |
| 111 | default: return defaultCase(theEObject); |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Returns the result of interpreting the object as an instance of '<em>QML Declarations</em>'. |
| 117 | * <!-- begin-user-doc --> |
| 118 | * This implementation returns null; |
| 119 | * returning a non-null result will terminate the switch. |
| 120 | * <!-- end-user-doc --> |
| 121 | * @param object the target of the switch. |
| 122 | * @return the result of interpreting the object as an instance of '<em>QML Declarations</em>'. |
| 123 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 124 | * @generated |
| 125 | */ |
| 126 | public T caseQMLDeclarations(QMLDeclarations object) { |
| 127 | return null; |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * Returns the result of interpreting the object as an instance of '<em>QML Declaration</em>'. |
| 132 | * <!-- begin-user-doc --> |
| 133 | * This implementation returns null; |
| 134 | * returning a non-null result will terminate the switch. |
| 135 | * <!-- end-user-doc --> |
| 136 | * @param object the target of the switch. |
| 137 | * @return the result of interpreting the object as an instance of '<em>QML Declaration</em>'. |
| 138 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 139 | * @generated |
| 140 | */ |
| 141 | public T caseQMLDeclaration(QMLDeclaration object) { |
| 142 | return null; |
| 143 | } |
| 144 | |
| 145 | /** |
| 146 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 147 | * <!-- begin-user-doc --> |
| 148 | * This implementation returns null; |
| 149 | * returning a non-null result will terminate the switch. |
| 150 | * <!-- end-user-doc --> |
| 151 | * @param object the target of the switch. |
| 152 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 153 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 154 | * @generated |
| 155 | */ |
| 156 | public T caseIdentifier(Identifier object) { |
| 157 | return null; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 162 | * <!-- begin-user-doc --> |
| 163 | * This implementation returns null; |
| 164 | * returning a non-null result will terminate the switch. |
| 165 | * <!-- end-user-doc --> |
| 166 | * @param object the target of the switch. |
| 167 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 168 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 169 | * @generated |
| 170 | */ |
| 171 | public T caseNamedElement(NamedElement object) { |
| 172 | return null; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 177 | * <!-- begin-user-doc --> |
| 178 | * This implementation returns null; |
| 179 | * returning a non-null result will terminate the switch. |
| 180 | * <!-- end-user-doc --> |
| 181 | * @param object the target of the switch. |
| 182 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 183 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 184 | * @generated |
| 185 | */ |
| 186 | public T caseEntity(Entity object) { |
| 187 | return null; |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 192 | * <!-- begin-user-doc --> |
| 193 | * This implementation returns null; |
| 194 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 195 | * <!-- end-user-doc --> |
| 196 | * @param object the target of the switch. |
| 197 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 198 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 199 | * @generated |
| 200 | */ |
| 201 | public T defaultCase(EObject object) { |
| 202 | return null; |
| 203 | } |
| 204 | |
| 205 | } //QMLDeclarationsSwitch |