| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.util; |
| 7 | |
| 8 | import java.util.List; |
| 9 | |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.EObject; |
| 12 | |
| 13 | import de.uka.ipd.sdq.pcm.qosannotations.SpecifiedQoSAnnotation; |
| 14 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.*; |
| 15 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.Qos_reliabilityPackage; |
| 16 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.SpecifiedReliabilityAnnotation; |
| 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.qosannotations.qos_reliability.Qos_reliabilityPackage |
| 29 | * @generated |
| 30 | */ |
| 31 | public class Qos_reliabilitySwitch<T> { |
| 32 | /** |
| 33 | * <!-- begin-user-doc --> |
| 34 | * <!-- end-user-doc --> |
| 35 | * @generated |
| 36 | */ |
| 37 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 38 | |
| 39 | /** |
| 40 | * The cached model package |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @generated |
| 44 | */ |
| 45 | protected static Qos_reliabilityPackage modelPackage; |
| 46 | |
| 47 | /** |
| 48 | * Creates an instance of the switch. |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @generated |
| 52 | */ |
| 53 | public Qos_reliabilitySwitch() { |
| 54 | if (modelPackage == null) { |
| 55 | modelPackage = Qos_reliabilityPackage.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 Qos_reliabilityPackage.SPECIFIED_RELIABILITY_ANNOTATION: { |
| 100 | SpecifiedReliabilityAnnotation specifiedReliabilityAnnotation = (SpecifiedReliabilityAnnotation)theEObject; |
| 101 | T result = caseSpecifiedReliabilityAnnotation(specifiedReliabilityAnnotation); |
| 102 | if (result == null) result = caseSpecifiedQoSAnnotation(specifiedReliabilityAnnotation); |
| 103 | if (result == null) result = defaultCase(theEObject); |
| 104 | return result; |
| 105 | } |
| 106 | default: return defaultCase(theEObject); |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * Returns the result of interpreting the object as an instance of '<em>Specified Reliability Annotation</em>'. |
| 112 | * <!-- begin-user-doc --> |
| 113 | * This implementation returns null; |
| 114 | * returning a non-null result will terminate the switch. |
| 115 | * <!-- end-user-doc --> |
| 116 | * @param object the target of the switch. |
| 117 | * @return the result of interpreting the object as an instance of '<em>Specified Reliability Annotation</em>'. |
| 118 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 119 | * @generated |
| 120 | */ |
| 121 | public T caseSpecifiedReliabilityAnnotation(SpecifiedReliabilityAnnotation object) { |
| 122 | return null; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Returns the result of interpreting the object as an instance of '<em>Specified Qo SAnnotation</em>'. |
| 127 | * <!-- begin-user-doc --> |
| 128 | * This implementation returns null; |
| 129 | * returning a non-null result will terminate the switch. |
| 130 | * <!-- end-user-doc --> |
| 131 | * @param object the target of the switch. |
| 132 | * @return the result of interpreting the object as an instance of '<em>Specified Qo SAnnotation</em>'. |
| 133 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 134 | * @generated |
| 135 | */ |
| 136 | public T caseSpecifiedQoSAnnotation(SpecifiedQoSAnnotation object) { |
| 137 | return null; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 142 | * <!-- begin-user-doc --> |
| 143 | * This implementation returns null; |
| 144 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 145 | * <!-- end-user-doc --> |
| 146 | * @param object the target of the switch. |
| 147 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 148 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 149 | * @generated |
| 150 | */ |
| 151 | public T defaultCase(EObject object) { |
| 152 | return null; |
| 153 | } |
| 154 | |
| 155 | } //Qos_reliabilitySwitch |