| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.fzi.se.quality.parameters.pcm.util; |
| 8 | |
| 9 | import de.fzi.se.quality.parameters.BusinessOperationReference; |
| 10 | import de.fzi.se.quality.parameters.ComponentReference; |
| 11 | import de.fzi.se.quality.parameters.InfrastructureOperationReference; |
| 12 | import de.fzi.se.quality.parameters.OperationReference; |
| 13 | import de.fzi.se.quality.parameters.ParameterReference; |
| 14 | import de.fzi.se.quality.parameters.ParameterValue; |
| 15 | |
| 16 | import de.fzi.se.quality.parameters.pcm.*; |
| 17 | |
| 18 | import de.uka.ipd.sdq.identifier.Identifier; |
| 19 | |
| 20 | import java.util.List; |
| 21 | |
| 22 | import org.eclipse.emf.ecore.EClass; |
| 23 | import org.eclipse.emf.ecore.EObject; |
| 24 | |
| 25 | /** |
| 26 | * <!-- begin-user-doc --> |
| 27 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 28 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 29 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 30 | * starting with the actual class of the object |
| 31 | * and proceeding up the inheritance hierarchy |
| 32 | * until a non-null result is returned, |
| 33 | * which is the result of the switch. |
| 34 | * <!-- end-user-doc --> |
| 35 | * @see de.fzi.se.quality.parameters.pcm.PCMPackage |
| 36 | * @generated |
| 37 | */ |
| 38 | public class PCMSwitch<T> { |
| 39 | /** |
| 40 | * The cached model package |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @generated |
| 44 | */ |
| 45 | protected static PCMPackage modelPackage; |
| 46 | |
| 47 | /** |
| 48 | * Creates an instance of the switch. |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @generated |
| 52 | */ |
| 53 | public PCMSwitch() { |
| 54 | if (modelPackage == null) { |
| 55 | modelPackage = PCMPackage.eINSTANCE; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 64 | * @generated |
| 65 | */ |
| 66 | public T doSwitch(EObject theEObject) { |
| 67 | return doSwitch(theEObject.eClass(), theEObject); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 75 | * @generated |
| 76 | */ |
| 77 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 78 | if (theEClass.eContainer() == modelPackage) { |
| 79 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 80 | } |
| 81 | else { |
| 82 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 83 | return |
| 84 | eSuperTypes.isEmpty() ? |
| 85 | defaultCase(theEObject) : |
| 86 | doSwitch(eSuperTypes.get(0), theEObject); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 92 | * <!-- begin-user-doc --> |
| 93 | * <!-- end-user-doc --> |
| 94 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 95 | * @generated |
| 96 | */ |
| 97 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 98 | switch (classifierID) { |
| 99 | case PCMPackage.PCM_PARAMETER_REFERENCE: { |
| 100 | PCMParameterReference pcmParameterReference = (PCMParameterReference)theEObject; |
| 101 | T result = casePCMParameterReference(pcmParameterReference); |
| 102 | if (result == null) result = caseParameterReference(pcmParameterReference); |
| 103 | if (result == null) result = caseIdentifier(pcmParameterReference); |
| 104 | if (result == null) result = defaultCase(theEObject); |
| 105 | return result; |
| 106 | } |
| 107 | case PCMPackage.PCM_PARAMETER_VALUE: { |
| 108 | PCMParameterValue pcmParameterValue = (PCMParameterValue)theEObject; |
| 109 | T result = casePCMParameterValue(pcmParameterValue); |
| 110 | if (result == null) result = caseParameterValue(pcmParameterValue); |
| 111 | if (result == null) result = caseIdentifier(pcmParameterValue); |
| 112 | if (result == null) result = defaultCase(theEObject); |
| 113 | return result; |
| 114 | } |
| 115 | case PCMPackage.PCM_INFRASTRUCTURE_OPERATION_REFERENCE: { |
| 116 | PCMInfrastructureOperationReference pcmInfrastructureOperationReference = (PCMInfrastructureOperationReference)theEObject; |
| 117 | T result = casePCMInfrastructureOperationReference(pcmInfrastructureOperationReference); |
| 118 | if (result == null) result = caseInfrastructureOperationReference(pcmInfrastructureOperationReference); |
| 119 | if (result == null) result = caseOperationReference(pcmInfrastructureOperationReference); |
| 120 | if (result == null) result = defaultCase(theEObject); |
| 121 | return result; |
| 122 | } |
| 123 | case PCMPackage.PCM_BUSINESS_OPERATION_REFERENCE: { |
| 124 | PCMBusinessOperationReference pcmBusinessOperationReference = (PCMBusinessOperationReference)theEObject; |
| 125 | T result = casePCMBusinessOperationReference(pcmBusinessOperationReference); |
| 126 | if (result == null) result = caseBusinessOperationReference(pcmBusinessOperationReference); |
| 127 | if (result == null) result = caseOperationReference(pcmBusinessOperationReference); |
| 128 | if (result == null) result = defaultCase(theEObject); |
| 129 | return result; |
| 130 | } |
| 131 | case PCMPackage.PCM_COMPONENT_REFERENCE: { |
| 132 | PCMComponentReference pcmComponentReference = (PCMComponentReference)theEObject; |
| 133 | T result = casePCMComponentReference(pcmComponentReference); |
| 134 | if (result == null) result = caseComponentReference(pcmComponentReference); |
| 135 | if (result == null) result = defaultCase(theEObject); |
| 136 | return result; |
| 137 | } |
| 138 | case PCMPackage.PCM_COMPONENT_PARAMETER_REFERENCE: { |
| 139 | PCMComponentParameterReference pcmComponentParameterReference = (PCMComponentParameterReference)theEObject; |
| 140 | T result = casePCMComponentParameterReference(pcmComponentParameterReference); |
| 141 | if (result == null) result = casePCMParameterReference(pcmComponentParameterReference); |
| 142 | if (result == null) result = caseParameterReference(pcmComponentParameterReference); |
| 143 | if (result == null) result = caseIdentifier(pcmComponentParameterReference); |
| 144 | if (result == null) result = defaultCase(theEObject); |
| 145 | return result; |
| 146 | } |
| 147 | case PCMPackage.PCM_OPERATION_PARAMETER_REFERENCE: { |
| 148 | PCMOperationParameterReference pcmOperationParameterReference = (PCMOperationParameterReference)theEObject; |
| 149 | T result = casePCMOperationParameterReference(pcmOperationParameterReference); |
| 150 | if (result == null) result = casePCMParameterReference(pcmOperationParameterReference); |
| 151 | if (result == null) result = caseParameterReference(pcmOperationParameterReference); |
| 152 | if (result == null) result = caseIdentifier(pcmOperationParameterReference); |
| 153 | if (result == null) result = defaultCase(theEObject); |
| 154 | return result; |
| 155 | } |
| 156 | case PCMPackage.PCM_REQUIRED_BUSINESS_OPERATION_RETURN_PARAMETER_REFERENCE: { |
| 157 | PCMRequiredBusinessOperationReturnParameterReference pcmRequiredBusinessOperationReturnParameterReference = (PCMRequiredBusinessOperationReturnParameterReference)theEObject; |
| 158 | T result = casePCMRequiredBusinessOperationReturnParameterReference(pcmRequiredBusinessOperationReturnParameterReference); |
| 159 | if (result == null) result = casePCMParameterReference(pcmRequiredBusinessOperationReturnParameterReference); |
| 160 | if (result == null) result = caseParameterReference(pcmRequiredBusinessOperationReturnParameterReference); |
| 161 | if (result == null) result = caseIdentifier(pcmRequiredBusinessOperationReturnParameterReference); |
| 162 | if (result == null) result = defaultCase(theEObject); |
| 163 | return result; |
| 164 | } |
| 165 | default: return defaultCase(theEObject); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Returns the result of interpreting the object as an instance of '<em>Parameter Reference</em>'. |
| 171 | * <!-- begin-user-doc --> |
| 172 | * This implementation returns null; |
| 173 | * returning a non-null result will terminate the switch. |
| 174 | * <!-- end-user-doc --> |
| 175 | * @param object the target of the switch. |
| 176 | * @return the result of interpreting the object as an instance of '<em>Parameter Reference</em>'. |
| 177 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 178 | * @generated |
| 179 | */ |
| 180 | public T casePCMParameterReference(PCMParameterReference object) { |
| 181 | return null; |
| 182 | } |
| 183 | |
| 184 | /** |
| 185 | * Returns the result of interpreting the object as an instance of '<em>Parameter Value</em>'. |
| 186 | * <!-- begin-user-doc --> |
| 187 | * This implementation returns null; |
| 188 | * returning a non-null result will terminate the switch. |
| 189 | * <!-- end-user-doc --> |
| 190 | * @param object the target of the switch. |
| 191 | * @return the result of interpreting the object as an instance of '<em>Parameter Value</em>'. |
| 192 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 193 | * @generated |
| 194 | */ |
| 195 | public T casePCMParameterValue(PCMParameterValue object) { |
| 196 | return null; |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * Returns the result of interpreting the object as an instance of '<em>Infrastructure Operation Reference</em>'. |
| 201 | * <!-- begin-user-doc --> |
| 202 | * This implementation returns null; |
| 203 | * returning a non-null result will terminate the switch. |
| 204 | * <!-- end-user-doc --> |
| 205 | * @param object the target of the switch. |
| 206 | * @return the result of interpreting the object as an instance of '<em>Infrastructure Operation Reference</em>'. |
| 207 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 208 | * @generated |
| 209 | */ |
| 210 | public T casePCMInfrastructureOperationReference(PCMInfrastructureOperationReference object) { |
| 211 | return null; |
| 212 | } |
| 213 | |
| 214 | /** |
| 215 | * Returns the result of interpreting the object as an instance of '<em>Business Operation Reference</em>'. |
| 216 | * <!-- begin-user-doc --> |
| 217 | * This implementation returns null; |
| 218 | * returning a non-null result will terminate the switch. |
| 219 | * <!-- end-user-doc --> |
| 220 | * @param object the target of the switch. |
| 221 | * @return the result of interpreting the object as an instance of '<em>Business Operation Reference</em>'. |
| 222 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 223 | * @generated |
| 224 | */ |
| 225 | public T casePCMBusinessOperationReference(PCMBusinessOperationReference object) { |
| 226 | return null; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * Returns the result of interpreting the object as an instance of '<em>Component Reference</em>'. |
| 231 | * <!-- begin-user-doc --> |
| 232 | * This implementation returns null; |
| 233 | * returning a non-null result will terminate the switch. |
| 234 | * <!-- end-user-doc --> |
| 235 | * @param object the target of the switch. |
| 236 | * @return the result of interpreting the object as an instance of '<em>Component Reference</em>'. |
| 237 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 238 | * @generated |
| 239 | */ |
| 240 | public T casePCMComponentReference(PCMComponentReference object) { |
| 241 | return null; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Returns the result of interpreting the object as an instance of '<em>Component Parameter Reference</em>'. |
| 246 | * <!-- begin-user-doc --> |
| 247 | * This implementation returns null; |
| 248 | * returning a non-null result will terminate the switch. |
| 249 | * <!-- end-user-doc --> |
| 250 | * @param object the target of the switch. |
| 251 | * @return the result of interpreting the object as an instance of '<em>Component Parameter Reference</em>'. |
| 252 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 253 | * @generated |
| 254 | */ |
| 255 | public T casePCMComponentParameterReference(PCMComponentParameterReference object) { |
| 256 | return null; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * Returns the result of interpreting the object as an instance of '<em>Operation Parameter Reference</em>'. |
| 261 | * <!-- begin-user-doc --> |
| 262 | * This implementation returns null; |
| 263 | * returning a non-null result will terminate the switch. |
| 264 | * <!-- end-user-doc --> |
| 265 | * @param object the target of the switch. |
| 266 | * @return the result of interpreting the object as an instance of '<em>Operation Parameter Reference</em>'. |
| 267 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 268 | * @generated |
| 269 | */ |
| 270 | public T casePCMOperationParameterReference(PCMOperationParameterReference object) { |
| 271 | return null; |
| 272 | } |
| 273 | |
| 274 | /** |
| 275 | * Returns the result of interpreting the object as an instance of '<em>Required Business Operation Return Parameter Reference</em>'. |
| 276 | * <!-- begin-user-doc --> |
| 277 | * This implementation returns null; |
| 278 | * returning a non-null result will terminate the switch. |
| 279 | * <!-- end-user-doc --> |
| 280 | * @param object the target of the switch. |
| 281 | * @return the result of interpreting the object as an instance of '<em>Required Business Operation Return Parameter Reference</em>'. |
| 282 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 283 | * @generated |
| 284 | */ |
| 285 | public T casePCMRequiredBusinessOperationReturnParameterReference(PCMRequiredBusinessOperationReturnParameterReference object) { |
| 286 | return null; |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 291 | * <!-- begin-user-doc --> |
| 292 | * This implementation returns null; |
| 293 | * returning a non-null result will terminate the switch. |
| 294 | * <!-- end-user-doc --> |
| 295 | * @param object the target of the switch. |
| 296 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 297 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 298 | * @generated |
| 299 | */ |
| 300 | public T caseIdentifier(Identifier object) { |
| 301 | return null; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Returns the result of interpreting the object as an instance of '<em>Parameter Reference</em>'. |
| 306 | * <!-- begin-user-doc --> |
| 307 | * This implementation returns null; |
| 308 | * returning a non-null result will terminate the switch. |
| 309 | * <!-- end-user-doc --> |
| 310 | * @param object the target of the switch. |
| 311 | * @return the result of interpreting the object as an instance of '<em>Parameter Reference</em>'. |
| 312 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 313 | * @generated |
| 314 | */ |
| 315 | public T caseParameterReference(ParameterReference object) { |
| 316 | return null; |
| 317 | } |
| 318 | |
| 319 | /** |
| 320 | * Returns the result of interpreting the object as an instance of '<em>Parameter Value</em>'. |
| 321 | * <!-- begin-user-doc --> |
| 322 | * This implementation returns null; |
| 323 | * returning a non-null result will terminate the switch. |
| 324 | * <!-- end-user-doc --> |
| 325 | * @param object the target of the switch. |
| 326 | * @return the result of interpreting the object as an instance of '<em>Parameter Value</em>'. |
| 327 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 328 | * @generated |
| 329 | */ |
| 330 | public T caseParameterValue(ParameterValue object) { |
| 331 | return null; |
| 332 | } |
| 333 | |
| 334 | /** |
| 335 | * Returns the result of interpreting the object as an instance of '<em>Operation Reference</em>'. |
| 336 | * <!-- begin-user-doc --> |
| 337 | * This implementation returns null; |
| 338 | * returning a non-null result will terminate the switch. |
| 339 | * <!-- end-user-doc --> |
| 340 | * @param object the target of the switch. |
| 341 | * @return the result of interpreting the object as an instance of '<em>Operation Reference</em>'. |
| 342 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 343 | * @generated |
| 344 | */ |
| 345 | public T caseOperationReference(OperationReference object) { |
| 346 | return null; |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * Returns the result of interpreting the object as an instance of '<em>Infrastructure Operation Reference</em>'. |
| 351 | * <!-- begin-user-doc --> |
| 352 | * This implementation returns null; |
| 353 | * returning a non-null result will terminate the switch. |
| 354 | * <!-- end-user-doc --> |
| 355 | * @param object the target of the switch. |
| 356 | * @return the result of interpreting the object as an instance of '<em>Infrastructure Operation Reference</em>'. |
| 357 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 358 | * @generated |
| 359 | */ |
| 360 | public T caseInfrastructureOperationReference(InfrastructureOperationReference object) { |
| 361 | return null; |
| 362 | } |
| 363 | |
| 364 | /** |
| 365 | * Returns the result of interpreting the object as an instance of '<em>Business Operation Reference</em>'. |
| 366 | * <!-- begin-user-doc --> |
| 367 | * This implementation returns null; |
| 368 | * returning a non-null result will terminate the switch. |
| 369 | * <!-- end-user-doc --> |
| 370 | * @param object the target of the switch. |
| 371 | * @return the result of interpreting the object as an instance of '<em>Business Operation Reference</em>'. |
| 372 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 373 | * @generated |
| 374 | */ |
| 375 | public T caseBusinessOperationReference(BusinessOperationReference object) { |
| 376 | return null; |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * Returns the result of interpreting the object as an instance of '<em>Component Reference</em>'. |
| 381 | * <!-- begin-user-doc --> |
| 382 | * This implementation returns null; |
| 383 | * returning a non-null result will terminate the switch. |
| 384 | * <!-- end-user-doc --> |
| 385 | * @param object the target of the switch. |
| 386 | * @return the result of interpreting the object as an instance of '<em>Component Reference</em>'. |
| 387 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 388 | * @generated |
| 389 | */ |
| 390 | public T caseComponentReference(ComponentReference object) { |
| 391 | return null; |
| 392 | } |
| 393 | |
| 394 | /** |
| 395 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 396 | * <!-- begin-user-doc --> |
| 397 | * This implementation returns null; |
| 398 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 399 | * <!-- end-user-doc --> |
| 400 | * @param object the target of the switch. |
| 401 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 402 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 403 | * @generated |
| 404 | */ |
| 405 | public T defaultCase(EObject object) { |
| 406 | return null; |
| 407 | } |
| 408 | |
| 409 | } //PCMSwitch |