| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
| 10 | |
| 11 | import de.uka.ipd.sdq.pcm.resultdecorator.repositorydecorator.*; |
| 12 | |
| 13 | import java.util.List; |
| 14 | |
| 15 | import org.eclipse.emf.ecore.EClass; |
| 16 | import org.eclipse.emf.ecore.EObject; |
| 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.pcm.resultdecorator.repositorydecorator.RepositorydecoratorPackage |
| 29 | * @generated |
| 30 | */ |
| 31 | public class RepositorydecoratorSwitch<T> { |
| 32 | /** |
| 33 | * The cached model package |
| 34 | * <!-- begin-user-doc --> |
| 35 | * <!-- end-user-doc --> |
| 36 | * @generated |
| 37 | */ |
| 38 | protected static RepositorydecoratorPackage modelPackage; |
| 39 | |
| 40 | /** |
| 41 | * Creates an instance of the switch. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public RepositorydecoratorSwitch() { |
| 47 | if (modelPackage == null) { |
| 48 | modelPackage = RepositorydecoratorPackage.eINSTANCE; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 57 | * @generated |
| 58 | */ |
| 59 | public T doSwitch(EObject theEObject) { |
| 60 | return doSwitch(theEObject.eClass(), theEObject); |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 65 | * <!-- begin-user-doc --> |
| 66 | * <!-- end-user-doc --> |
| 67 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 68 | * @generated |
| 69 | */ |
| 70 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 71 | if (theEClass.eContainer() == modelPackage) { |
| 72 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 73 | } |
| 74 | else { |
| 75 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 76 | return |
| 77 | eSuperTypes.isEmpty() ? |
| 78 | defaultCase(theEObject) : |
| 79 | doSwitch(eSuperTypes.get(0), theEObject); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 88 | * @generated |
| 89 | */ |
| 90 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 91 | switch (classifierID) { |
| 92 | case RepositorydecoratorPackage.INTERFACE_PROVIDING_REQUIRING_ENTITY_RESULTS: { |
| 93 | InterfaceProvidingRequiringEntityResults interfaceProvidingRequiringEntityResults = (InterfaceProvidingRequiringEntityResults)theEObject; |
| 94 | T result = caseInterfaceProvidingRequiringEntityResults(interfaceProvidingRequiringEntityResults); |
| 95 | if (result == null) result = caseComponentResult(interfaceProvidingRequiringEntityResults); |
| 96 | if (result == null) result = caseNamedElement(interfaceProvidingRequiringEntityResults); |
| 97 | if (result == null) result = defaultCase(theEObject); |
| 98 | return result; |
| 99 | } |
| 100 | case RepositorydecoratorPackage.COMPONENT_RESULT: { |
| 101 | ComponentResult componentResult = (ComponentResult)theEObject; |
| 102 | T result = caseComponentResult(componentResult); |
| 103 | if (result == null) result = caseNamedElement(componentResult); |
| 104 | if (result == null) result = defaultCase(theEObject); |
| 105 | return result; |
| 106 | } |
| 107 | case RepositorydecoratorPackage.ALLOCATION_CONTEXT_RESULTS: { |
| 108 | AllocationContextResults allocationContextResults = (AllocationContextResults)theEObject; |
| 109 | T result = caseAllocationContextResults(allocationContextResults); |
| 110 | if (result == null) result = caseComponentResult(allocationContextResults); |
| 111 | if (result == null) result = caseNamedElement(allocationContextResults); |
| 112 | if (result == null) result = defaultCase(theEObject); |
| 113 | return result; |
| 114 | } |
| 115 | case RepositorydecoratorPackage.SERVICE_RESULT: { |
| 116 | ServiceResult serviceResult = (ServiceResult)theEObject; |
| 117 | T result = caseServiceResult(serviceResult); |
| 118 | if (result == null) result = defaultCase(theEObject); |
| 119 | return result; |
| 120 | } |
| 121 | case RepositorydecoratorPackage.ALLOCATION_SERVICE_RESULT: { |
| 122 | AllocationServiceResult allocationServiceResult = (AllocationServiceResult)theEObject; |
| 123 | T result = caseAllocationServiceResult(allocationServiceResult); |
| 124 | if (result == null) result = caseServiceResult(allocationServiceResult); |
| 125 | if (result == null) result = defaultCase(theEObject); |
| 126 | return result; |
| 127 | } |
| 128 | default: return defaultCase(theEObject); |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | /** |
| 133 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity Results</em>'. |
| 134 | * <!-- begin-user-doc --> |
| 135 | * This implementation returns null; |
| 136 | * returning a non-null result will terminate the switch. |
| 137 | * <!-- end-user-doc --> |
| 138 | * @param object the target of the switch. |
| 139 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity Results</em>'. |
| 140 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 141 | * @generated |
| 142 | */ |
| 143 | public T caseInterfaceProvidingRequiringEntityResults(InterfaceProvidingRequiringEntityResults object) { |
| 144 | return null; |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * Returns the result of interpreting the object as an instance of '<em>Component Result</em>'. |
| 149 | * <!-- begin-user-doc --> |
| 150 | * This implementation returns null; |
| 151 | * returning a non-null result will terminate the switch. |
| 152 | * <!-- end-user-doc --> |
| 153 | * @param object the target of the switch. |
| 154 | * @return the result of interpreting the object as an instance of '<em>Component Result</em>'. |
| 155 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 156 | * @generated |
| 157 | */ |
| 158 | public T caseComponentResult(ComponentResult object) { |
| 159 | return null; |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * Returns the result of interpreting the object as an instance of '<em>Allocation Context Results</em>'. |
| 164 | * <!-- begin-user-doc --> |
| 165 | * This implementation returns null; |
| 166 | * returning a non-null result will terminate the switch. |
| 167 | * <!-- end-user-doc --> |
| 168 | * @param object the target of the switch. |
| 169 | * @return the result of interpreting the object as an instance of '<em>Allocation Context Results</em>'. |
| 170 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 171 | * @generated |
| 172 | */ |
| 173 | public T caseAllocationContextResults(AllocationContextResults object) { |
| 174 | return null; |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Returns the result of interpreting the object as an instance of '<em>Service Result</em>'. |
| 179 | * <!-- begin-user-doc --> |
| 180 | * This implementation returns null; |
| 181 | * returning a non-null result will terminate the switch. |
| 182 | * <!-- end-user-doc --> |
| 183 | * @param object the target of the switch. |
| 184 | * @return the result of interpreting the object as an instance of '<em>Service Result</em>'. |
| 185 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 186 | * @generated |
| 187 | */ |
| 188 | public T caseServiceResult(ServiceResult object) { |
| 189 | return null; |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Returns the result of interpreting the object as an instance of '<em>Allocation Service Result</em>'. |
| 194 | * <!-- begin-user-doc --> |
| 195 | * This implementation returns null; |
| 196 | * returning a non-null result will terminate the switch. |
| 197 | * <!-- end-user-doc --> |
| 198 | * @param object the target of the switch. |
| 199 | * @return the result of interpreting the object as an instance of '<em>Allocation Service Result</em>'. |
| 200 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 201 | * @generated |
| 202 | */ |
| 203 | public T caseAllocationServiceResult(AllocationServiceResult object) { |
| 204 | return null; |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 209 | * <!-- begin-user-doc --> |
| 210 | * This implementation returns null; |
| 211 | * returning a non-null result will terminate the switch. |
| 212 | * <!-- end-user-doc --> |
| 213 | * @param object the target of the switch. |
| 214 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 215 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 216 | * @generated |
| 217 | */ |
| 218 | public T caseNamedElement(NamedElement object) { |
| 219 | return null; |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 224 | * <!-- begin-user-doc --> |
| 225 | * This implementation returns null; |
| 226 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 227 | * <!-- end-user-doc --> |
| 228 | * @param object the target of the switch. |
| 229 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 230 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 231 | * @generated |
| 232 | */ |
| 233 | public T defaultCase(EObject object) { |
| 234 | return null; |
| 235 | } |
| 236 | |
| 237 | } //RepositorydecoratorSwitch |