| 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_performance.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_performance.*; |
| 15 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.ComponentSpecifiedExecutionTime; |
| 16 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.Qos_performancePackage; |
| 17 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.SpecifiedExecutionTime; |
| 18 | import de.uka.ipd.sdq.pcm.qosannotations.qos_performance.SystemSpecifiedExecutionTime; |
| 19 | |
| 20 | /** |
| 21 | * <!-- begin-user-doc --> |
| 22 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 23 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 24 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 25 | * starting with the actual class of the object |
| 26 | * and proceeding up the inheritance hierarchy |
| 27 | * until a non-null result is returned, |
| 28 | * which is the result of the switch. |
| 29 | * <!-- end-user-doc --> |
| 30 | * @see de.uka.ipd.sdq.pcm.qosannotations.qos_performance.Qos_performancePackage |
| 31 | * @generated |
| 32 | */ |
| 33 | public class Qos_performanceSwitch<T> { |
| 34 | /** |
| 35 | * <!-- begin-user-doc --> |
| 36 | * <!-- end-user-doc --> |
| 37 | * @generated |
| 38 | */ |
| 39 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 40 | |
| 41 | /** |
| 42 | * The cached model package |
| 43 | * <!-- begin-user-doc --> |
| 44 | * <!-- end-user-doc --> |
| 45 | * @generated |
| 46 | */ |
| 47 | protected static Qos_performancePackage modelPackage; |
| 48 | |
| 49 | /** |
| 50 | * Creates an instance of the switch. |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @generated |
| 54 | */ |
| 55 | public Qos_performanceSwitch() { |
| 56 | if (modelPackage == null) { |
| 57 | modelPackage = Qos_performancePackage.eINSTANCE; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 66 | * @generated |
| 67 | */ |
| 68 | public T doSwitch(EObject theEObject) { |
| 69 | return doSwitch(theEObject.eClass(), theEObject); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 74 | * <!-- begin-user-doc --> |
| 75 | * <!-- end-user-doc --> |
| 76 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 77 | * @generated |
| 78 | */ |
| 79 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 80 | if (theEClass.eContainer() == modelPackage) { |
| 81 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 82 | } |
| 83 | else { |
| 84 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 85 | return |
| 86 | eSuperTypes.isEmpty() ? |
| 87 | defaultCase(theEObject) : |
| 88 | doSwitch(eSuperTypes.get(0), theEObject); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 94 | * <!-- begin-user-doc --> |
| 95 | * <!-- end-user-doc --> |
| 96 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 97 | * @generated |
| 98 | */ |
| 99 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 100 | switch (classifierID) { |
| 101 | case Qos_performancePackage.SYSTEM_SPECIFIED_EXECUTION_TIME: { |
| 102 | SystemSpecifiedExecutionTime systemSpecifiedExecutionTime = (SystemSpecifiedExecutionTime)theEObject; |
| 103 | T result = caseSystemSpecifiedExecutionTime(systemSpecifiedExecutionTime); |
| 104 | if (result == null) result = caseSpecifiedExecutionTime(systemSpecifiedExecutionTime); |
| 105 | if (result == null) result = caseSpecifiedQoSAnnotation(systemSpecifiedExecutionTime); |
| 106 | if (result == null) result = defaultCase(theEObject); |
| 107 | return result; |
| 108 | } |
| 109 | case Qos_performancePackage.SPECIFIED_EXECUTION_TIME: { |
| 110 | SpecifiedExecutionTime specifiedExecutionTime = (SpecifiedExecutionTime)theEObject; |
| 111 | T result = caseSpecifiedExecutionTime(specifiedExecutionTime); |
| 112 | if (result == null) result = caseSpecifiedQoSAnnotation(specifiedExecutionTime); |
| 113 | if (result == null) result = defaultCase(theEObject); |
| 114 | return result; |
| 115 | } |
| 116 | case Qos_performancePackage.COMPONENT_SPECIFIED_EXECUTION_TIME: { |
| 117 | ComponentSpecifiedExecutionTime componentSpecifiedExecutionTime = (ComponentSpecifiedExecutionTime)theEObject; |
| 118 | T result = caseComponentSpecifiedExecutionTime(componentSpecifiedExecutionTime); |
| 119 | if (result == null) result = caseSpecifiedExecutionTime(componentSpecifiedExecutionTime); |
| 120 | if (result == null) result = caseSpecifiedQoSAnnotation(componentSpecifiedExecutionTime); |
| 121 | if (result == null) result = defaultCase(theEObject); |
| 122 | return result; |
| 123 | } |
| 124 | default: return defaultCase(theEObject); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Returns the result of interpreting the object as an instance of '<em>System Specified Execution Time</em>'. |
| 130 | * <!-- begin-user-doc --> |
| 131 | * This implementation returns null; |
| 132 | * returning a non-null result will terminate the switch. |
| 133 | * <!-- end-user-doc --> |
| 134 | * @param object the target of the switch. |
| 135 | * @return the result of interpreting the object as an instance of '<em>System Specified Execution Time</em>'. |
| 136 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 137 | * @generated |
| 138 | */ |
| 139 | public T caseSystemSpecifiedExecutionTime(SystemSpecifiedExecutionTime object) { |
| 140 | return null; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Returns the result of interpreting the object as an instance of '<em>Specified Execution Time</em>'. |
| 145 | * <!-- begin-user-doc --> |
| 146 | * This implementation returns null; |
| 147 | * returning a non-null result will terminate the switch. |
| 148 | * <!-- end-user-doc --> |
| 149 | * @param object the target of the switch. |
| 150 | * @return the result of interpreting the object as an instance of '<em>Specified Execution Time</em>'. |
| 151 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 152 | * @generated |
| 153 | */ |
| 154 | public T caseSpecifiedExecutionTime(SpecifiedExecutionTime object) { |
| 155 | return null; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Returns the result of interpreting the object as an instance of '<em>Component Specified Execution Time</em>'. |
| 160 | * <!-- begin-user-doc --> |
| 161 | * This implementation returns null; |
| 162 | * returning a non-null result will terminate the switch. |
| 163 | * <!-- end-user-doc --> |
| 164 | * @param object the target of the switch. |
| 165 | * @return the result of interpreting the object as an instance of '<em>Component Specified Execution Time</em>'. |
| 166 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 167 | * @generated |
| 168 | */ |
| 169 | public T caseComponentSpecifiedExecutionTime(ComponentSpecifiedExecutionTime object) { |
| 170 | return null; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Returns the result of interpreting the object as an instance of '<em>Specified Qo SAnnotation</em>'. |
| 175 | * <!-- begin-user-doc --> |
| 176 | * This implementation returns null; |
| 177 | * returning a non-null result will terminate the switch. |
| 178 | * <!-- end-user-doc --> |
| 179 | * @param object the target of the switch. |
| 180 | * @return the result of interpreting the object as an instance of '<em>Specified Qo SAnnotation</em>'. |
| 181 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 182 | * @generated |
| 183 | */ |
| 184 | public T caseSpecifiedQoSAnnotation(SpecifiedQoSAnnotation object) { |
| 185 | return null; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 190 | * <!-- begin-user-doc --> |
| 191 | * This implementation returns null; |
| 192 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 193 | * <!-- end-user-doc --> |
| 194 | * @param object the target of the switch. |
| 195 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 196 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 197 | * @generated |
| 198 | */ |
| 199 | public T defaultCase(EObject object) { |
| 200 | return null; |
| 201 | } |
| 202 | |
| 203 | } //Qos_performanceSwitch |