| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.fzi.se.quality.parameters.util; |
| 8 | |
| 9 | import de.fzi.se.quality.parameters.*; |
| 10 | |
| 11 | import de.uka.ipd.sdq.identifier.Identifier; |
| 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.fzi.se.quality.parameters.ParametersPackage |
| 29 | * @generated |
| 30 | */ |
| 31 | public class ParametersSwitch<T> { |
| 32 | /** |
| 33 | * The cached model package |
| 34 | * <!-- begin-user-doc --> |
| 35 | * <!-- end-user-doc --> |
| 36 | * @generated |
| 37 | */ |
| 38 | protected static ParametersPackage modelPackage; |
| 39 | |
| 40 | /** |
| 41 | * Creates an instance of the switch. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public ParametersSwitch() { |
| 47 | if (modelPackage == null) { |
| 48 | modelPackage = ParametersPackage.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 ParametersPackage.PARAMETER_PARTITION: { |
| 93 | ParameterPartition parameterPartition = (ParameterPartition)theEObject; |
| 94 | T result = caseParameterPartition(parameterPartition); |
| 95 | if (result == null) result = caseIdentifier(parameterPartition); |
| 96 | if (result == null) result = defaultCase(theEObject); |
| 97 | return result; |
| 98 | } |
| 99 | case ParametersPackage.PARAMETER_VALUE: { |
| 100 | ParameterValue parameterValue = (ParameterValue)theEObject; |
| 101 | T result = caseParameterValue(parameterValue); |
| 102 | if (result == null) result = caseIdentifier(parameterValue); |
| 103 | if (result == null) result = defaultCase(theEObject); |
| 104 | return result; |
| 105 | } |
| 106 | case ParametersPackage.PARAMETER_INSTANCE: { |
| 107 | ParameterInstance parameterInstance = (ParameterInstance)theEObject; |
| 108 | T result = caseParameterInstance(parameterInstance); |
| 109 | if (result == null) result = defaultCase(theEObject); |
| 110 | return result; |
| 111 | } |
| 112 | case ParametersPackage.CALL_INSTANCE: { |
| 113 | CallInstance callInstance = (CallInstance)theEObject; |
| 114 | T result = caseCallInstance(callInstance); |
| 115 | if (result == null) result = caseIdentifier(callInstance); |
| 116 | if (result == null) result = defaultCase(theEObject); |
| 117 | return result; |
| 118 | } |
| 119 | case ParametersPackage.OPERATION_REFERENCE: { |
| 120 | OperationReference operationReference = (OperationReference)theEObject; |
| 121 | T result = caseOperationReference(operationReference); |
| 122 | if (result == null) result = defaultCase(theEObject); |
| 123 | return result; |
| 124 | } |
| 125 | case ParametersPackage.COMPONENT_INSTANCE: { |
| 126 | ComponentInstance componentInstance = (ComponentInstance)theEObject; |
| 127 | T result = caseComponentInstance(componentInstance); |
| 128 | if (result == null) result = caseIdentifier(componentInstance); |
| 129 | if (result == null) result = defaultCase(theEObject); |
| 130 | return result; |
| 131 | } |
| 132 | case ParametersPackage.COMPONENT_REFERENCE: { |
| 133 | ComponentReference componentReference = (ComponentReference)theEObject; |
| 134 | T result = caseComponentReference(componentReference); |
| 135 | if (result == null) result = defaultCase(theEObject); |
| 136 | return result; |
| 137 | } |
| 138 | case ParametersPackage.INFRASTRUCTURE_OPERATION_REFERENCE: { |
| 139 | InfrastructureOperationReference infrastructureOperationReference = (InfrastructureOperationReference)theEObject; |
| 140 | T result = caseInfrastructureOperationReference(infrastructureOperationReference); |
| 141 | if (result == null) result = caseOperationReference(infrastructureOperationReference); |
| 142 | if (result == null) result = defaultCase(theEObject); |
| 143 | return result; |
| 144 | } |
| 145 | case ParametersPackage.BUSINESS_OPERATION_REFERENCE: { |
| 146 | BusinessOperationReference businessOperationReference = (BusinessOperationReference)theEObject; |
| 147 | T result = caseBusinessOperationReference(businessOperationReference); |
| 148 | if (result == null) result = caseOperationReference(businessOperationReference); |
| 149 | if (result == null) result = defaultCase(theEObject); |
| 150 | return result; |
| 151 | } |
| 152 | case ParametersPackage.PARAMETER_REFERENCE: { |
| 153 | ParameterReference parameterReference = (ParameterReference)theEObject; |
| 154 | T result = caseParameterReference(parameterReference); |
| 155 | if (result == null) result = caseIdentifier(parameterReference); |
| 156 | if (result == null) result = defaultCase(theEObject); |
| 157 | return result; |
| 158 | } |
| 159 | default: return defaultCase(theEObject); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Returns the result of interpreting the object as an instance of '<em>Parameter Partition</em>'. |
| 165 | * <!-- begin-user-doc --> |
| 166 | * This implementation returns null; |
| 167 | * returning a non-null result will terminate the switch. |
| 168 | * <!-- end-user-doc --> |
| 169 | * @param object the target of the switch. |
| 170 | * @return the result of interpreting the object as an instance of '<em>Parameter Partition</em>'. |
| 171 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 172 | * @generated |
| 173 | */ |
| 174 | public T caseParameterPartition(ParameterPartition object) { |
| 175 | return null; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Returns the result of interpreting the object as an instance of '<em>Parameter Value</em>'. |
| 180 | * <!-- begin-user-doc --> |
| 181 | * This implementation returns null; |
| 182 | * returning a non-null result will terminate the switch. |
| 183 | * <!-- end-user-doc --> |
| 184 | * @param object the target of the switch. |
| 185 | * @return the result of interpreting the object as an instance of '<em>Parameter Value</em>'. |
| 186 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 187 | * @generated |
| 188 | */ |
| 189 | public T caseParameterValue(ParameterValue object) { |
| 190 | return null; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Returns the result of interpreting the object as an instance of '<em>Parameter Instance</em>'. |
| 195 | * <!-- begin-user-doc --> |
| 196 | * This implementation returns null; |
| 197 | * returning a non-null result will terminate the switch. |
| 198 | * <!-- end-user-doc --> |
| 199 | * @param object the target of the switch. |
| 200 | * @return the result of interpreting the object as an instance of '<em>Parameter Instance</em>'. |
| 201 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 202 | * @generated |
| 203 | */ |
| 204 | public T caseParameterInstance(ParameterInstance object) { |
| 205 | return null; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Returns the result of interpreting the object as an instance of '<em>Call Instance</em>'. |
| 210 | * <!-- begin-user-doc --> |
| 211 | * This implementation returns null; |
| 212 | * returning a non-null result will terminate the switch. |
| 213 | * <!-- end-user-doc --> |
| 214 | * @param object the target of the switch. |
| 215 | * @return the result of interpreting the object as an instance of '<em>Call Instance</em>'. |
| 216 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 217 | * @generated |
| 218 | */ |
| 219 | public T caseCallInstance(CallInstance object) { |
| 220 | return null; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Returns the result of interpreting the object as an instance of '<em>Operation Reference</em>'. |
| 225 | * <!-- begin-user-doc --> |
| 226 | * This implementation returns null; |
| 227 | * returning a non-null result will terminate the switch. |
| 228 | * <!-- end-user-doc --> |
| 229 | * @param object the target of the switch. |
| 230 | * @return the result of interpreting the object as an instance of '<em>Operation Reference</em>'. |
| 231 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 232 | * @generated |
| 233 | */ |
| 234 | public T caseOperationReference(OperationReference object) { |
| 235 | return null; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Returns the result of interpreting the object as an instance of '<em>Component Instance</em>'. |
| 240 | * <!-- begin-user-doc --> |
| 241 | * This implementation returns null; |
| 242 | * returning a non-null result will terminate the switch. |
| 243 | * <!-- end-user-doc --> |
| 244 | * @param object the target of the switch. |
| 245 | * @return the result of interpreting the object as an instance of '<em>Component Instance</em>'. |
| 246 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 247 | * @generated |
| 248 | */ |
| 249 | public T caseComponentInstance(ComponentInstance object) { |
| 250 | return null; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Returns the result of interpreting the object as an instance of '<em>Component Reference</em>'. |
| 255 | * <!-- begin-user-doc --> |
| 256 | * This implementation returns null; |
| 257 | * returning a non-null result will terminate the switch. |
| 258 | * <!-- end-user-doc --> |
| 259 | * @param object the target of the switch. |
| 260 | * @return the result of interpreting the object as an instance of '<em>Component Reference</em>'. |
| 261 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 262 | * @generated |
| 263 | */ |
| 264 | public T caseComponentReference(ComponentReference object) { |
| 265 | return null; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Returns the result of interpreting the object as an instance of '<em>Infrastructure Operation Reference</em>'. |
| 270 | * <!-- begin-user-doc --> |
| 271 | * This implementation returns null; |
| 272 | * returning a non-null result will terminate the switch. |
| 273 | * <!-- end-user-doc --> |
| 274 | * @param object the target of the switch. |
| 275 | * @return the result of interpreting the object as an instance of '<em>Infrastructure Operation Reference</em>'. |
| 276 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 277 | * @generated |
| 278 | */ |
| 279 | public T caseInfrastructureOperationReference(InfrastructureOperationReference object) { |
| 280 | return null; |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Returns the result of interpreting the object as an instance of '<em>Business Operation Reference</em>'. |
| 285 | * <!-- begin-user-doc --> |
| 286 | * This implementation returns null; |
| 287 | * returning a non-null result will terminate the switch. |
| 288 | * <!-- end-user-doc --> |
| 289 | * @param object the target of the switch. |
| 290 | * @return the result of interpreting the object as an instance of '<em>Business Operation Reference</em>'. |
| 291 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 292 | * @generated |
| 293 | */ |
| 294 | public T caseBusinessOperationReference(BusinessOperationReference object) { |
| 295 | return null; |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * Returns the result of interpreting the object as an instance of '<em>Parameter Reference</em>'. |
| 300 | * <!-- begin-user-doc --> |
| 301 | * This implementation returns null; |
| 302 | * returning a non-null result will terminate the switch. |
| 303 | * <!-- end-user-doc --> |
| 304 | * @param object the target of the switch. |
| 305 | * @return the result of interpreting the object as an instance of '<em>Parameter Reference</em>'. |
| 306 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 307 | * @generated |
| 308 | */ |
| 309 | public T caseParameterReference(ParameterReference object) { |
| 310 | return null; |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 315 | * <!-- begin-user-doc --> |
| 316 | * This implementation returns null; |
| 317 | * returning a non-null result will terminate the switch. |
| 318 | * <!-- end-user-doc --> |
| 319 | * @param object the target of the switch. |
| 320 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 321 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 322 | * @generated |
| 323 | */ |
| 324 | public T caseIdentifier(Identifier object) { |
| 325 | return null; |
| 326 | } |
| 327 | |
| 328 | /** |
| 329 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 330 | * <!-- begin-user-doc --> |
| 331 | * This implementation returns null; |
| 332 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 333 | * <!-- end-user-doc --> |
| 334 | * @param object the target of the switch. |
| 335 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 336 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 337 | * @generated |
| 338 | */ |
| 339 | public T defaultCase(EObject object) { |
| 340 | return null; |
| 341 | } |
| 342 | |
| 343 | } //ParametersSwitch |