| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.probfunction.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.probfunction.*; |
| 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.probfunction.BoxedPDF; |
| 16 | import de.uka.ipd.sdq.probfunction.Complex; |
| 17 | import de.uka.ipd.sdq.probfunction.ContinuousPDF; |
| 18 | import de.uka.ipd.sdq.probfunction.ContinuousSample; |
| 19 | import de.uka.ipd.sdq.probfunction.ExponentialDistribution; |
| 20 | import de.uka.ipd.sdq.probfunction.NormalDistribution; |
| 21 | import de.uka.ipd.sdq.probfunction.ProbabilityDensityFunction; |
| 22 | import de.uka.ipd.sdq.probfunction.ProbabilityFunction; |
| 23 | import de.uka.ipd.sdq.probfunction.ProbabilityMassFunction; |
| 24 | import de.uka.ipd.sdq.probfunction.ProbfunctionPackage; |
| 25 | import de.uka.ipd.sdq.probfunction.Sample; |
| 26 | import de.uka.ipd.sdq.probfunction.SamplePDF; |
| 27 | import de.uka.ipd.sdq.units.UnitCarryingElement; |
| 28 | |
| 29 | /** |
| 30 | * <!-- begin-user-doc --> |
| 31 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 32 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 33 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 34 | * starting with the actual class of the object |
| 35 | * and proceeding up the inheritance hierarchy |
| 36 | * until a non-null result is returned, |
| 37 | * which is the result of the switch. |
| 38 | * <!-- end-user-doc --> |
| 39 | * @see de.uka.ipd.sdq.probfunction.ProbfunctionPackage |
| 40 | * @generated |
| 41 | */ |
| 42 | public class ProbfunctionSwitch<T1> { |
| 43 | /** |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @generated |
| 47 | */ |
| 48 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 49 | /** |
| 50 | * The cached model package |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @generated |
| 54 | */ |
| 55 | protected static ProbfunctionPackage modelPackage; |
| 56 | |
| 57 | /** |
| 58 | * Creates an instance of the switch. |
| 59 | * <!-- begin-user-doc --> |
| 60 | * <!-- end-user-doc --> |
| 61 | * @generated |
| 62 | */ |
| 63 | public ProbfunctionSwitch() { |
| 64 | if (modelPackage == null) { |
| 65 | modelPackage = ProbfunctionPackage.eINSTANCE; |
| 66 | } |
| 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 | public T1 doSwitch(EObject theEObject) { |
| 77 | return doSwitch(theEObject.eClass(), theEObject); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 85 | * @generated |
| 86 | */ |
| 87 | protected T1 doSwitch(EClass theEClass, EObject theEObject) { |
| 88 | if (theEClass.eContainer() == modelPackage) { |
| 89 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 90 | } |
| 91 | else { |
| 92 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 93 | return |
| 94 | eSuperTypes.isEmpty() ? |
| 95 | defaultCase(theEObject) : |
| 96 | doSwitch(eSuperTypes.get(0), theEObject); |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 102 | * <!-- begin-user-doc --> |
| 103 | * <!-- end-user-doc --> |
| 104 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 105 | * @generated |
| 106 | */ |
| 107 | protected T1 doSwitch(int classifierID, EObject theEObject) { |
| 108 | switch (classifierID) { |
| 109 | case ProbfunctionPackage.BOXED_PDF: { |
| 110 | BoxedPDF boxedPDF = (BoxedPDF)theEObject; |
| 111 | T1 result = caseBoxedPDF(boxedPDF); |
| 112 | if (result == null) result = caseProbabilityDensityFunction(boxedPDF); |
| 113 | if (result == null) result = caseProbabilityFunction(boxedPDF); |
| 114 | if (result == null) result = caseUnitCarryingElement(boxedPDF); |
| 115 | if (result == null) result = defaultCase(theEObject); |
| 116 | return result; |
| 117 | } |
| 118 | case ProbfunctionPackage.PROBABILITY_DENSITY_FUNCTION: { |
| 119 | ProbabilityDensityFunction probabilityDensityFunction = (ProbabilityDensityFunction)theEObject; |
| 120 | T1 result = caseProbabilityDensityFunction(probabilityDensityFunction); |
| 121 | if (result == null) result = caseProbabilityFunction(probabilityDensityFunction); |
| 122 | if (result == null) result = caseUnitCarryingElement(probabilityDensityFunction); |
| 123 | if (result == null) result = defaultCase(theEObject); |
| 124 | return result; |
| 125 | } |
| 126 | case ProbfunctionPackage.PROBABILITY_FUNCTION: { |
| 127 | ProbabilityFunction probabilityFunction = (ProbabilityFunction)theEObject; |
| 128 | T1 result = caseProbabilityFunction(probabilityFunction); |
| 129 | if (result == null) result = caseUnitCarryingElement(probabilityFunction); |
| 130 | if (result == null) result = defaultCase(theEObject); |
| 131 | return result; |
| 132 | } |
| 133 | case ProbfunctionPackage.CONTINUOUS_SAMPLE: { |
| 134 | ContinuousSample continuousSample = (ContinuousSample)theEObject; |
| 135 | T1 result = caseContinuousSample(continuousSample); |
| 136 | if (result == null) result = defaultCase(theEObject); |
| 137 | return result; |
| 138 | } |
| 139 | case ProbfunctionPackage.PROBABILITY_MASS_FUNCTION: { |
| 140 | ProbabilityMassFunction probabilityMassFunction = (ProbabilityMassFunction)theEObject; |
| 141 | T1 result = caseProbabilityMassFunction(probabilityMassFunction); |
| 142 | if (result == null) result = caseProbabilityFunction(probabilityMassFunction); |
| 143 | if (result == null) result = caseUnitCarryingElement(probabilityMassFunction); |
| 144 | if (result == null) result = defaultCase(theEObject); |
| 145 | return result; |
| 146 | } |
| 147 | case ProbfunctionPackage.SAMPLE: { |
| 148 | Sample<?> sample = (Sample<?>)theEObject; |
| 149 | T1 result = caseSample(sample); |
| 150 | if (result == null) result = defaultCase(theEObject); |
| 151 | return result; |
| 152 | } |
| 153 | case ProbfunctionPackage.SAMPLE_PDF: { |
| 154 | SamplePDF samplePDF = (SamplePDF)theEObject; |
| 155 | T1 result = caseSamplePDF(samplePDF); |
| 156 | if (result == null) result = caseProbabilityDensityFunction(samplePDF); |
| 157 | if (result == null) result = caseProbabilityFunction(samplePDF); |
| 158 | if (result == null) result = caseUnitCarryingElement(samplePDF); |
| 159 | if (result == null) result = defaultCase(theEObject); |
| 160 | return result; |
| 161 | } |
| 162 | case ProbfunctionPackage.COMPLEX: { |
| 163 | Complex complex = (Complex)theEObject; |
| 164 | T1 result = caseComplex(complex); |
| 165 | if (result == null) result = defaultCase(theEObject); |
| 166 | return result; |
| 167 | } |
| 168 | case ProbfunctionPackage.CONTINUOUS_PDF: { |
| 169 | ContinuousPDF continuousPDF = (ContinuousPDF)theEObject; |
| 170 | T1 result = caseContinuousPDF(continuousPDF); |
| 171 | if (result == null) result = caseProbabilityDensityFunction(continuousPDF); |
| 172 | if (result == null) result = caseProbabilityFunction(continuousPDF); |
| 173 | if (result == null) result = caseUnitCarryingElement(continuousPDF); |
| 174 | if (result == null) result = defaultCase(theEObject); |
| 175 | return result; |
| 176 | } |
| 177 | case ProbfunctionPackage.EXPONENTIAL_DISTRIBUTION: { |
| 178 | ExponentialDistribution exponentialDistribution = (ExponentialDistribution)theEObject; |
| 179 | T1 result = caseExponentialDistribution(exponentialDistribution); |
| 180 | if (result == null) result = caseContinuousPDF(exponentialDistribution); |
| 181 | if (result == null) result = caseProbabilityDensityFunction(exponentialDistribution); |
| 182 | if (result == null) result = caseProbabilityFunction(exponentialDistribution); |
| 183 | if (result == null) result = caseUnitCarryingElement(exponentialDistribution); |
| 184 | if (result == null) result = defaultCase(theEObject); |
| 185 | return result; |
| 186 | } |
| 187 | case ProbfunctionPackage.NORMAL_DISTRIBUTION: { |
| 188 | NormalDistribution normalDistribution = (NormalDistribution)theEObject; |
| 189 | T1 result = caseNormalDistribution(normalDistribution); |
| 190 | if (result == null) result = caseContinuousPDF(normalDistribution); |
| 191 | if (result == null) result = caseProbabilityDensityFunction(normalDistribution); |
| 192 | if (result == null) result = caseProbabilityFunction(normalDistribution); |
| 193 | if (result == null) result = caseUnitCarryingElement(normalDistribution); |
| 194 | if (result == null) result = defaultCase(theEObject); |
| 195 | return result; |
| 196 | } |
| 197 | case ProbfunctionPackage.LOGNORMAL_DISTRIBUTION: { |
| 198 | LognormalDistribution lognormalDistribution = (LognormalDistribution)theEObject; |
| 199 | T1 result = caseLognormalDistribution(lognormalDistribution); |
| 200 | if (result == null) result = caseContinuousPDF(lognormalDistribution); |
| 201 | if (result == null) result = caseProbabilityDensityFunction(lognormalDistribution); |
| 202 | if (result == null) result = caseProbabilityFunction(lognormalDistribution); |
| 203 | if (result == null) result = caseUnitCarryingElement(lognormalDistribution); |
| 204 | if (result == null) result = defaultCase(theEObject); |
| 205 | return result; |
| 206 | } |
| 207 | case ProbfunctionPackage.GAMMA_DISTRIBUTION: { |
| 208 | GammaDistribution gammaDistribution = (GammaDistribution)theEObject; |
| 209 | T1 result = caseGammaDistribution(gammaDistribution); |
| 210 | if (result == null) result = caseContinuousPDF(gammaDistribution); |
| 211 | if (result == null) result = caseProbabilityDensityFunction(gammaDistribution); |
| 212 | if (result == null) result = caseProbabilityFunction(gammaDistribution); |
| 213 | if (result == null) result = caseUnitCarryingElement(gammaDistribution); |
| 214 | if (result == null) result = defaultCase(theEObject); |
| 215 | return result; |
| 216 | } |
| 217 | default: return defaultCase(theEObject); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Returns the result of interpreting the object as an instance of '<em>Boxed PDF</em>'. |
| 223 | * <!-- begin-user-doc --> |
| 224 | * This implementation returns null; |
| 225 | * returning a non-null result will terminate the switch. |
| 226 | * <!-- end-user-doc --> |
| 227 | * @param object the target of the switch. |
| 228 | * @return the result of interpreting the object as an instance of '<em>Boxed PDF</em>'. |
| 229 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 230 | * @generated |
| 231 | */ |
| 232 | public T1 caseBoxedPDF(BoxedPDF object) { |
| 233 | return null; |
| 234 | } |
| 235 | |
| 236 | /** |
| 237 | * Returns the result of interpreting the object as an instance of '<em>Probability Density Function</em>'. |
| 238 | * <!-- begin-user-doc --> |
| 239 | * This implementation returns null; |
| 240 | * returning a non-null result will terminate the switch. |
| 241 | * <!-- end-user-doc --> |
| 242 | * @param object the target of the switch. |
| 243 | * @return the result of interpreting the object as an instance of '<em>Probability Density Function</em>'. |
| 244 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 245 | * @generated |
| 246 | */ |
| 247 | public T1 caseProbabilityDensityFunction(ProbabilityDensityFunction object) { |
| 248 | return null; |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * Returns the result of interpreting the object as an instance of '<em>Probability Function</em>'. |
| 253 | * <!-- begin-user-doc --> |
| 254 | * This implementation returns null; |
| 255 | * returning a non-null result will terminate the switch. |
| 256 | * <!-- end-user-doc --> |
| 257 | * @param object the target of the switch. |
| 258 | * @return the result of interpreting the object as an instance of '<em>Probability Function</em>'. |
| 259 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 260 | * @generated |
| 261 | */ |
| 262 | public T1 caseProbabilityFunction(ProbabilityFunction object) { |
| 263 | return null; |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * Returns the result of interpreting the object as an instance of '<em>Continuous Sample</em>'. |
| 268 | * <!-- begin-user-doc --> |
| 269 | * This implementation returns null; |
| 270 | * returning a non-null result will terminate the switch. |
| 271 | * <!-- end-user-doc --> |
| 272 | * @param object the target of the switch. |
| 273 | * @return the result of interpreting the object as an instance of '<em>Continuous Sample</em>'. |
| 274 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 275 | * @generated |
| 276 | */ |
| 277 | public T1 caseContinuousSample(ContinuousSample object) { |
| 278 | return null; |
| 279 | } |
| 280 | |
| 281 | /** |
| 282 | * Returns the result of interpreting the object as an instance of '<em>Probability Mass Function</em>'. |
| 283 | * <!-- begin-user-doc --> |
| 284 | * This implementation returns null; |
| 285 | * returning a non-null result will terminate the switch. |
| 286 | * <!-- end-user-doc --> |
| 287 | * @param object the target of the switch. |
| 288 | * @return the result of interpreting the object as an instance of '<em>Probability Mass Function</em>'. |
| 289 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 290 | * @generated |
| 291 | */ |
| 292 | public T1 caseProbabilityMassFunction(ProbabilityMassFunction object) { |
| 293 | return null; |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * Returns the result of interpreting the object as an instance of '<em>Sample</em>'. |
| 298 | * <!-- begin-user-doc --> |
| 299 | * This implementation returns null; |
| 300 | * returning a non-null result will terminate the switch. |
| 301 | * <!-- end-user-doc --> |
| 302 | * @param object the target of the switch. |
| 303 | * @return the result of interpreting the object as an instance of '<em>Sample</em>'. |
| 304 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 305 | * @generated |
| 306 | */ |
| 307 | public <T> T1 caseSample(Sample<T> object) { |
| 308 | return null; |
| 309 | } |
| 310 | |
| 311 | /** |
| 312 | * Returns the result of interpreting the object as an instance of '<em>Sample PDF</em>'. |
| 313 | * <!-- begin-user-doc --> |
| 314 | * This implementation returns null; |
| 315 | * returning a non-null result will terminate the switch. |
| 316 | * <!-- end-user-doc --> |
| 317 | * @param object the target of the switch. |
| 318 | * @return the result of interpreting the object as an instance of '<em>Sample PDF</em>'. |
| 319 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 320 | * @generated |
| 321 | */ |
| 322 | public T1 caseSamplePDF(SamplePDF object) { |
| 323 | return null; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Returns the result of interpreting the object as an instance of '<em>Complex</em>'. |
| 328 | * <!-- begin-user-doc --> |
| 329 | * This implementation returns null; |
| 330 | * returning a non-null result will terminate the switch. |
| 331 | * <!-- end-user-doc --> |
| 332 | * @param object the target of the switch. |
| 333 | * @return the result of interpreting the object as an instance of '<em>Complex</em>'. |
| 334 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 335 | * @generated |
| 336 | */ |
| 337 | public T1 caseComplex(Complex object) { |
| 338 | return null; |
| 339 | } |
| 340 | |
| 341 | /** |
| 342 | * Returns the result of interpreting the object as an instance of '<em>Continuous PDF</em>'. |
| 343 | * <!-- begin-user-doc --> |
| 344 | * This implementation returns null; |
| 345 | * returning a non-null result will terminate the switch. |
| 346 | * <!-- end-user-doc --> |
| 347 | * @param object the target of the switch. |
| 348 | * @return the result of interpreting the object as an instance of '<em>Continuous PDF</em>'. |
| 349 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 350 | * @generated |
| 351 | */ |
| 352 | public T1 caseContinuousPDF(ContinuousPDF object) { |
| 353 | return null; |
| 354 | } |
| 355 | |
| 356 | /** |
| 357 | * Returns the result of interpreting the object as an instance of '<em>Exponential Distribution</em>'. |
| 358 | * <!-- begin-user-doc --> |
| 359 | * This implementation returns null; |
| 360 | * returning a non-null result will terminate the switch. |
| 361 | * <!-- end-user-doc --> |
| 362 | * @param object the target of the switch. |
| 363 | * @return the result of interpreting the object as an instance of '<em>Exponential Distribution</em>'. |
| 364 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 365 | * @generated |
| 366 | */ |
| 367 | public T1 caseExponentialDistribution(ExponentialDistribution object) { |
| 368 | return null; |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * Returns the result of interpreting the object as an instance of '<em>Normal Distribution</em>'. |
| 373 | * <!-- begin-user-doc --> |
| 374 | * This implementation returns null; |
| 375 | * returning a non-null result will terminate the switch. |
| 376 | * <!-- end-user-doc --> |
| 377 | * @param object the target of the switch. |
| 378 | * @return the result of interpreting the object as an instance of '<em>Normal Distribution</em>'. |
| 379 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 380 | * @generated |
| 381 | */ |
| 382 | public T1 caseNormalDistribution(NormalDistribution object) { |
| 383 | return null; |
| 384 | } |
| 385 | |
| 386 | /** |
| 387 | * Returns the result of interpreting the object as an instance of '<em>Lognormal Distribution</em>'. |
| 388 | * <!-- begin-user-doc --> |
| 389 | * This implementation returns null; |
| 390 | * returning a non-null result will terminate the switch. |
| 391 | * <!-- end-user-doc --> |
| 392 | * @param object the target of the switch. |
| 393 | * @return the result of interpreting the object as an instance of '<em>Lognormal Distribution</em>'. |
| 394 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 395 | * @generated |
| 396 | */ |
| 397 | public T1 caseLognormalDistribution(LognormalDistribution object) { |
| 398 | return null; |
| 399 | } |
| 400 | |
| 401 | /** |
| 402 | * Returns the result of interpreting the object as an instance of '<em>Gamma Distribution</em>'. |
| 403 | * <!-- begin-user-doc --> |
| 404 | * This implementation returns null; |
| 405 | * returning a non-null result will terminate the switch. |
| 406 | * <!-- end-user-doc --> |
| 407 | * @param object the target of the switch. |
| 408 | * @return the result of interpreting the object as an instance of '<em>Gamma Distribution</em>'. |
| 409 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 410 | * @generated |
| 411 | */ |
| 412 | public T1 caseGammaDistribution(GammaDistribution object) { |
| 413 | return null; |
| 414 | } |
| 415 | |
| 416 | /** |
| 417 | * Returns the result of interpreting the object as an instance of '<em>Unit Carrying Element</em>'. |
| 418 | * <!-- begin-user-doc --> |
| 419 | * This implementation returns null; |
| 420 | * returning a non-null result will terminate the switch. |
| 421 | * <!-- end-user-doc --> |
| 422 | * @param object the target of the switch. |
| 423 | * @return the result of interpreting the object as an instance of '<em>Unit Carrying Element</em>'. |
| 424 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 425 | * @generated |
| 426 | */ |
| 427 | public T1 caseUnitCarryingElement(UnitCarryingElement object) { |
| 428 | return null; |
| 429 | } |
| 430 | |
| 431 | /** |
| 432 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 433 | * <!-- begin-user-doc --> |
| 434 | * This implementation returns null; |
| 435 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 436 | * <!-- end-user-doc --> |
| 437 | * @param object the target of the switch. |
| 438 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 439 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 440 | * @generated |
| 441 | */ |
| 442 | public T1 defaultCase(EObject object) { |
| 443 | return null; |
| 444 | } |
| 445 | |
| 446 | } //ProbfunctionSwitch |