| 1 | /** |
| 2 | * Copyright 2008, sdq.ipd.uka.de, U KA |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.simucomframework.simucomstatus.util; |
| 7 | |
| 8 | import de.uka.ipd.sdq.simucomframework.simucomstatus.Action; |
| 9 | import de.uka.ipd.sdq.simucomframework.simucomstatus.ActiveResouce; |
| 10 | import de.uka.ipd.sdq.simucomframework.simucomstatus.PassiveResource; |
| 11 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimuComStatus; |
| 12 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimucomstatusPackage; |
| 13 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimulatedProcesses; |
| 14 | import de.uka.ipd.sdq.simucomframework.simucomstatus.SimulatedResources; |
| 15 | import de.uka.ipd.sdq.simucomframework.simucomstatus.WaitForAcquire; |
| 16 | import de.uka.ipd.sdq.simucomframework.simucomstatus.WaitForDelay; |
| 17 | import de.uka.ipd.sdq.simucomframework.simucomstatus.WaitForDemand; |
| 18 | |
| 19 | import java.util.List; |
| 20 | |
| 21 | import org.eclipse.emf.ecore.EClass; |
| 22 | import org.eclipse.emf.ecore.EObject; |
| 23 | |
| 24 | /** |
| 25 | * <!-- begin-user-doc --> |
| 26 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 27 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 28 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 29 | * starting with the actual class of the object |
| 30 | * and proceeding up the inheritance hierarchy |
| 31 | * until a non-null result is returned, |
| 32 | * which is the result of the switch. |
| 33 | * <!-- end-user-doc --> |
| 34 | * @see de.uka.ipd.sdq.simucomframework.simucomstatus.SimucomstatusPackage |
| 35 | * @generated |
| 36 | */ |
| 37 | public class SimucomstatusSwitch<T> { |
| 38 | /** |
| 39 | * The cached model package |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @generated |
| 43 | */ |
| 44 | protected static SimucomstatusPackage modelPackage; |
| 45 | |
| 46 | /** |
| 47 | * Creates an instance of the switch. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @generated |
| 51 | */ |
| 52 | public SimucomstatusSwitch() { |
| 53 | if (modelPackage == null) { |
| 54 | modelPackage = SimucomstatusPackage.eINSTANCE; |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 60 | * <!-- begin-user-doc --> |
| 61 | * <!-- end-user-doc --> |
| 62 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 63 | * @generated |
| 64 | */ |
| 65 | public T doSwitch(EObject theEObject) { |
| 66 | return doSwitch(theEObject.eClass(), theEObject); |
| 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 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 77 | if (theEClass.eContainer() == modelPackage) { |
| 78 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 79 | } |
| 80 | else { |
| 81 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 82 | return |
| 83 | eSuperTypes.isEmpty() ? |
| 84 | defaultCase(theEObject) : |
| 85 | doSwitch(eSuperTypes.get(0), theEObject); |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 91 | * <!-- begin-user-doc --> |
| 92 | * <!-- end-user-doc --> |
| 93 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 94 | * @generated |
| 95 | */ |
| 96 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 97 | switch (classifierID) { |
| 98 | case SimucomstatusPackage.SIMU_COM_STATUS: { |
| 99 | SimuComStatus simuComStatus = (SimuComStatus)theEObject; |
| 100 | T result = caseSimuComStatus(simuComStatus); |
| 101 | if (result == null) result = defaultCase(theEObject); |
| 102 | return result; |
| 103 | } |
| 104 | case SimucomstatusPackage.SIMULATED_PROCESSES: { |
| 105 | SimulatedProcesses simulatedProcesses = (SimulatedProcesses)theEObject; |
| 106 | T result = caseSimulatedProcesses(simulatedProcesses); |
| 107 | if (result == null) result = defaultCase(theEObject); |
| 108 | return result; |
| 109 | } |
| 110 | case SimucomstatusPackage.PROCESS: { |
| 111 | de.uka.ipd.sdq.simucomframework.simucomstatus.Process process = (de.uka.ipd.sdq.simucomframework.simucomstatus.Process)theEObject; |
| 112 | T result = caseProcess(process); |
| 113 | if (result == null) result = defaultCase(theEObject); |
| 114 | return result; |
| 115 | } |
| 116 | case SimucomstatusPackage.ACTION: { |
| 117 | Action action = (Action)theEObject; |
| 118 | T result = caseAction(action); |
| 119 | if (result == null) result = defaultCase(theEObject); |
| 120 | return result; |
| 121 | } |
| 122 | case SimucomstatusPackage.SIMULATED_RESOURCES: { |
| 123 | SimulatedResources simulatedResources = (SimulatedResources)theEObject; |
| 124 | T result = caseSimulatedResources(simulatedResources); |
| 125 | if (result == null) result = defaultCase(theEObject); |
| 126 | return result; |
| 127 | } |
| 128 | case SimucomstatusPackage.ACTIVE_RESOUCE: { |
| 129 | ActiveResouce activeResouce = (ActiveResouce)theEObject; |
| 130 | T result = caseActiveResouce(activeResouce); |
| 131 | if (result == null) result = defaultCase(theEObject); |
| 132 | return result; |
| 133 | } |
| 134 | case SimucomstatusPackage.WAIT_FOR_DEMAND: { |
| 135 | WaitForDemand waitForDemand = (WaitForDemand)theEObject; |
| 136 | T result = caseWaitForDemand(waitForDemand); |
| 137 | if (result == null) result = caseAction(waitForDemand); |
| 138 | if (result == null) result = defaultCase(theEObject); |
| 139 | return result; |
| 140 | } |
| 141 | case SimucomstatusPackage.PASSIVE_RESOURCE: { |
| 142 | PassiveResource passiveResource = (PassiveResource)theEObject; |
| 143 | T result = casePassiveResource(passiveResource); |
| 144 | if (result == null) result = defaultCase(theEObject); |
| 145 | return result; |
| 146 | } |
| 147 | case SimucomstatusPackage.WAIT_FOR_ACQUIRE: { |
| 148 | WaitForAcquire waitForAcquire = (WaitForAcquire)theEObject; |
| 149 | T result = caseWaitForAcquire(waitForAcquire); |
| 150 | if (result == null) result = caseAction(waitForAcquire); |
| 151 | if (result == null) result = defaultCase(theEObject); |
| 152 | return result; |
| 153 | } |
| 154 | case SimucomstatusPackage.WAIT_FOR_DELAY: { |
| 155 | WaitForDelay waitForDelay = (WaitForDelay)theEObject; |
| 156 | T result = caseWaitForDelay(waitForDelay); |
| 157 | if (result == null) result = caseAction(waitForDelay); |
| 158 | if (result == null) result = defaultCase(theEObject); |
| 159 | return result; |
| 160 | } |
| 161 | default: return defaultCase(theEObject); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Returns the result of interpreting the object as an instance of '<em>Simu Com Status</em>'. |
| 167 | * <!-- begin-user-doc --> |
| 168 | * This implementation returns null; |
| 169 | * returning a non-null result will terminate the switch. |
| 170 | * <!-- end-user-doc --> |
| 171 | * @param object the target of the switch. |
| 172 | * @return the result of interpreting the object as an instance of '<em>Simu Com Status</em>'. |
| 173 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 174 | * @generated |
| 175 | */ |
| 176 | public T caseSimuComStatus(SimuComStatus object) { |
| 177 | return null; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Returns the result of interpreting the object as an instance of '<em>Simulated Processes</em>'. |
| 182 | * <!-- begin-user-doc --> |
| 183 | * This implementation returns null; |
| 184 | * returning a non-null result will terminate the switch. |
| 185 | * <!-- end-user-doc --> |
| 186 | * @param object the target of the switch. |
| 187 | * @return the result of interpreting the object as an instance of '<em>Simulated Processes</em>'. |
| 188 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 189 | * @generated |
| 190 | */ |
| 191 | public T caseSimulatedProcesses(SimulatedProcesses object) { |
| 192 | return null; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Returns the result of interpreting the object as an instance of '<em>Process</em>'. |
| 197 | * <!-- begin-user-doc --> |
| 198 | * This implementation returns null; |
| 199 | * returning a non-null result will terminate the switch. |
| 200 | * <!-- end-user-doc --> |
| 201 | * @param object the target of the switch. |
| 202 | * @return the result of interpreting the object as an instance of '<em>Process</em>'. |
| 203 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 204 | * @generated |
| 205 | */ |
| 206 | public T caseProcess(de.uka.ipd.sdq.simucomframework.simucomstatus.Process object) { |
| 207 | return null; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Returns the result of interpreting the object as an instance of '<em>Action</em>'. |
| 212 | * <!-- begin-user-doc --> |
| 213 | * This implementation returns null; |
| 214 | * returning a non-null result will terminate the switch. |
| 215 | * <!-- end-user-doc --> |
| 216 | * @param object the target of the switch. |
| 217 | * @return the result of interpreting the object as an instance of '<em>Action</em>'. |
| 218 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 219 | * @generated |
| 220 | */ |
| 221 | public T caseAction(Action object) { |
| 222 | return null; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Returns the result of interpreting the object as an instance of '<em>Simulated Resources</em>'. |
| 227 | * <!-- begin-user-doc --> |
| 228 | * This implementation returns null; |
| 229 | * returning a non-null result will terminate the switch. |
| 230 | * <!-- end-user-doc --> |
| 231 | * @param object the target of the switch. |
| 232 | * @return the result of interpreting the object as an instance of '<em>Simulated Resources</em>'. |
| 233 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 234 | * @generated |
| 235 | */ |
| 236 | public T caseSimulatedResources(SimulatedResources object) { |
| 237 | return null; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Returns the result of interpreting the object as an instance of '<em>Active Resouce</em>'. |
| 242 | * <!-- begin-user-doc --> |
| 243 | * This implementation returns null; |
| 244 | * returning a non-null result will terminate the switch. |
| 245 | * <!-- end-user-doc --> |
| 246 | * @param object the target of the switch. |
| 247 | * @return the result of interpreting the object as an instance of '<em>Active Resouce</em>'. |
| 248 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 249 | * @generated |
| 250 | */ |
| 251 | public T caseActiveResouce(ActiveResouce object) { |
| 252 | return null; |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * Returns the result of interpreting the object as an instance of '<em>Wait For Demand</em>'. |
| 257 | * <!-- begin-user-doc --> |
| 258 | * This implementation returns null; |
| 259 | * returning a non-null result will terminate the switch. |
| 260 | * <!-- end-user-doc --> |
| 261 | * @param object the target of the switch. |
| 262 | * @return the result of interpreting the object as an instance of '<em>Wait For Demand</em>'. |
| 263 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 264 | * @generated |
| 265 | */ |
| 266 | public T caseWaitForDemand(WaitForDemand object) { |
| 267 | return null; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * Returns the result of interpreting the object as an instance of '<em>Passive Resource</em>'. |
| 272 | * <!-- begin-user-doc --> |
| 273 | * This implementation returns null; |
| 274 | * returning a non-null result will terminate the switch. |
| 275 | * <!-- end-user-doc --> |
| 276 | * @param object the target of the switch. |
| 277 | * @return the result of interpreting the object as an instance of '<em>Passive Resource</em>'. |
| 278 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 279 | * @generated |
| 280 | */ |
| 281 | public T casePassiveResource(PassiveResource object) { |
| 282 | return null; |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * Returns the result of interpreting the object as an instance of '<em>Wait For Acquire</em>'. |
| 287 | * <!-- begin-user-doc --> |
| 288 | * This implementation returns null; |
| 289 | * returning a non-null result will terminate the switch. |
| 290 | * <!-- end-user-doc --> |
| 291 | * @param object the target of the switch. |
| 292 | * @return the result of interpreting the object as an instance of '<em>Wait For Acquire</em>'. |
| 293 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 294 | * @generated |
| 295 | */ |
| 296 | public T caseWaitForAcquire(WaitForAcquire object) { |
| 297 | return null; |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Returns the result of interpreting the object as an instance of '<em>Wait For Delay</em>'. |
| 302 | * <!-- begin-user-doc --> |
| 303 | * This implementation returns null; |
| 304 | * returning a non-null result will terminate the switch. |
| 305 | * <!-- end-user-doc --> |
| 306 | * @param object the target of the switch. |
| 307 | * @return the result of interpreting the object as an instance of '<em>Wait For Delay</em>'. |
| 308 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 309 | * @generated |
| 310 | */ |
| 311 | public T caseWaitForDelay(WaitForDelay object) { |
| 312 | return null; |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 317 | * <!-- begin-user-doc --> |
| 318 | * This implementation returns null; |
| 319 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 320 | * <!-- end-user-doc --> |
| 321 | * @param object the target of the switch. |
| 322 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 323 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 324 | * @generated |
| 325 | */ |
| 326 | public T defaultCase(EObject object) { |
| 327 | return null; |
| 328 | } |
| 329 | |
| 330 | } //SimucomstatusSwitch |