| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.spa.resourcemodel.util; |
| 8 | |
| 9 | import java.util.List; |
| 10 | |
| 11 | import org.eclipse.emf.ecore.EClass; |
| 12 | import org.eclipse.emf.ecore.EObject; |
| 13 | |
| 14 | import de.uka.ipd.sdq.spa.resourcemodel.AbstractResourceUsage; |
| 15 | import de.uka.ipd.sdq.spa.resourcemodel.ActiveResource; |
| 16 | import de.uka.ipd.sdq.spa.resourcemodel.AlternativeResourceUsage; |
| 17 | import de.uka.ipd.sdq.spa.resourcemodel.ContentionResource; |
| 18 | import de.uka.ipd.sdq.spa.resourcemodel.DelayResource; |
| 19 | import de.uka.ipd.sdq.spa.resourcemodel.Option; |
| 20 | import de.uka.ipd.sdq.spa.resourcemodel.PassiveResource; |
| 21 | import de.uka.ipd.sdq.spa.resourcemodel.ProcessingResource; |
| 22 | import de.uka.ipd.sdq.spa.resourcemodel.Resource; |
| 23 | import de.uka.ipd.sdq.spa.resourcemodel.ResourceModelPackage; |
| 24 | import de.uka.ipd.sdq.spa.resourcemodel.ResourceUsage; |
| 25 | import de.uka.ipd.sdq.spa.resourcemodel.SequentialResourceUsage; |
| 26 | |
| 27 | /** |
| 28 | * <!-- begin-user-doc --> |
| 29 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 30 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 31 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 32 | * starting with the actual class of the object |
| 33 | * and proceeding up the inheritance hierarchy |
| 34 | * until a non-null result is returned, |
| 35 | * which is the result of the switch. |
| 36 | * <!-- end-user-doc --> |
| 37 | * @see de.uka.ipd.sdq.spa.resourcemodel.ResourceModelPackage |
| 38 | * @generated |
| 39 | */ |
| 40 | public class ResourceModelSwitch { |
| 41 | /** |
| 42 | * The cached model package |
| 43 | * <!-- begin-user-doc --> |
| 44 | * <!-- end-user-doc --> |
| 45 | * @generated |
| 46 | */ |
| 47 | protected static ResourceModelPackage modelPackage; |
| 48 | |
| 49 | /** |
| 50 | * Creates an instance of the switch. |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @generated |
| 54 | */ |
| 55 | public ResourceModelSwitch() { |
| 56 | if (modelPackage == null) { |
| 57 | modelPackage = ResourceModelPackage.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 Object 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 Object doSwitch(EClass theEClass, EObject theEObject) { |
| 80 | if (theEClass.eContainer() == modelPackage) { |
| 81 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 82 | } |
| 83 | else { |
| 84 | List eSuperTypes = theEClass.getESuperTypes(); |
| 85 | return |
| 86 | eSuperTypes.isEmpty() ? |
| 87 | defaultCase(theEObject) : |
| 88 | doSwitch((EClass)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 Object doSwitch(int classifierID, EObject theEObject) { |
| 100 | switch (classifierID) { |
| 101 | case ResourceModelPackage.SEQUENTIAL_RESOURCE_USAGE: { |
| 102 | SequentialResourceUsage sequentialResourceUsage = (SequentialResourceUsage)theEObject; |
| 103 | Object result = caseSequentialResourceUsage(sequentialResourceUsage); |
| 104 | if (result == null) result = caseAbstractResourceUsage(sequentialResourceUsage); |
| 105 | if (result == null) result = defaultCase(theEObject); |
| 106 | return result; |
| 107 | } |
| 108 | case ResourceModelPackage.ABSTRACT_RESOURCE_USAGE: { |
| 109 | AbstractResourceUsage abstractResourceUsage = (AbstractResourceUsage)theEObject; |
| 110 | Object result = caseAbstractResourceUsage(abstractResourceUsage); |
| 111 | if (result == null) result = defaultCase(theEObject); |
| 112 | return result; |
| 113 | } |
| 114 | case ResourceModelPackage.RESOURCE: { |
| 115 | Resource resource = (Resource)theEObject; |
| 116 | Object result = caseResource(resource); |
| 117 | if (result == null) result = defaultCase(theEObject); |
| 118 | return result; |
| 119 | } |
| 120 | case ResourceModelPackage.ALTERNATIVE_RESOURCE_USAGE: { |
| 121 | AlternativeResourceUsage alternativeResourceUsage = (AlternativeResourceUsage)theEObject; |
| 122 | Object result = caseAlternativeResourceUsage(alternativeResourceUsage); |
| 123 | if (result == null) result = caseAbstractResourceUsage(alternativeResourceUsage); |
| 124 | if (result == null) result = defaultCase(theEObject); |
| 125 | return result; |
| 126 | } |
| 127 | case ResourceModelPackage.RESOURCE_USAGE: { |
| 128 | ResourceUsage resourceUsage = (ResourceUsage)theEObject; |
| 129 | Object result = caseResourceUsage(resourceUsage); |
| 130 | if (result == null) result = caseAbstractResourceUsage(resourceUsage); |
| 131 | if (result == null) result = defaultCase(theEObject); |
| 132 | return result; |
| 133 | } |
| 134 | case ResourceModelPackage.PASSIVE_RESOURCE: { |
| 135 | PassiveResource passiveResource = (PassiveResource)theEObject; |
| 136 | Object result = casePassiveResource(passiveResource); |
| 137 | if (result == null) result = caseContentionResource(passiveResource); |
| 138 | if (result == null) result = caseResource(passiveResource); |
| 139 | if (result == null) result = defaultCase(theEObject); |
| 140 | return result; |
| 141 | } |
| 142 | case ResourceModelPackage.CONTENTION_RESOURCE: { |
| 143 | ContentionResource contentionResource = (ContentionResource)theEObject; |
| 144 | Object result = caseContentionResource(contentionResource); |
| 145 | if (result == null) result = caseResource(contentionResource); |
| 146 | if (result == null) result = defaultCase(theEObject); |
| 147 | return result; |
| 148 | } |
| 149 | case ResourceModelPackage.PROCESSING_RESOURCE: { |
| 150 | ProcessingResource processingResource = (ProcessingResource)theEObject; |
| 151 | Object result = caseProcessingResource(processingResource); |
| 152 | if (result == null) result = caseContentionResource(processingResource); |
| 153 | if (result == null) result = caseActiveResource(processingResource); |
| 154 | if (result == null) result = caseResource(processingResource); |
| 155 | if (result == null) result = defaultCase(theEObject); |
| 156 | return result; |
| 157 | } |
| 158 | case ResourceModelPackage.ACTIVE_RESOURCE: { |
| 159 | ActiveResource activeResource = (ActiveResource)theEObject; |
| 160 | Object result = caseActiveResource(activeResource); |
| 161 | if (result == null) result = caseResource(activeResource); |
| 162 | if (result == null) result = defaultCase(theEObject); |
| 163 | return result; |
| 164 | } |
| 165 | case ResourceModelPackage.DELAY_RESOURCE: { |
| 166 | DelayResource delayResource = (DelayResource)theEObject; |
| 167 | Object result = caseDelayResource(delayResource); |
| 168 | if (result == null) result = caseActiveResource(delayResource); |
| 169 | if (result == null) result = caseResource(delayResource); |
| 170 | if (result == null) result = defaultCase(theEObject); |
| 171 | return result; |
| 172 | } |
| 173 | case ResourceModelPackage.OPTION: { |
| 174 | Option option = (Option)theEObject; |
| 175 | Object result = caseOption(option); |
| 176 | if (result == null) result = defaultCase(theEObject); |
| 177 | return result; |
| 178 | } |
| 179 | default: return defaultCase(theEObject); |
| 180 | } |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * Returns the result of interpretting the object as an instance of '<em>Sequential Resource Usage</em>'. |
| 185 | * <!-- begin-user-doc --> |
| 186 | * This implementation returns null; |
| 187 | * returning a non-null result will terminate the switch. |
| 188 | * <!-- end-user-doc --> |
| 189 | * @param object the target of the switch. |
| 190 | * @return the result of interpretting the object as an instance of '<em>Sequential Resource Usage</em>'. |
| 191 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 192 | * @generated |
| 193 | */ |
| 194 | public Object caseSequentialResourceUsage(SequentialResourceUsage object) { |
| 195 | return null; |
| 196 | } |
| 197 | |
| 198 | /** |
| 199 | * Returns the result of interpretting the object as an instance of '<em>Abstract Resource Usage</em>'. |
| 200 | * <!-- begin-user-doc --> |
| 201 | * This implementation returns null; |
| 202 | * returning a non-null result will terminate the switch. |
| 203 | * <!-- end-user-doc --> |
| 204 | * @param object the target of the switch. |
| 205 | * @return the result of interpretting the object as an instance of '<em>Abstract Resource Usage</em>'. |
| 206 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 207 | * @generated |
| 208 | */ |
| 209 | public Object caseAbstractResourceUsage(AbstractResourceUsage object) { |
| 210 | return null; |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Returns the result of interpretting the object as an instance of '<em>Resource</em>'. |
| 215 | * <!-- begin-user-doc --> |
| 216 | * This implementation returns null; |
| 217 | * returning a non-null result will terminate the switch. |
| 218 | * <!-- end-user-doc --> |
| 219 | * @param object the target of the switch. |
| 220 | * @return the result of interpretting the object as an instance of '<em>Resource</em>'. |
| 221 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 222 | * @generated |
| 223 | */ |
| 224 | public Object caseResource(Resource object) { |
| 225 | return null; |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * Returns the result of interpretting the object as an instance of '<em>Alternative Resource Usage</em>'. |
| 230 | * <!-- begin-user-doc --> |
| 231 | * This implementation returns null; |
| 232 | * returning a non-null result will terminate the switch. |
| 233 | * <!-- end-user-doc --> |
| 234 | * @param object the target of the switch. |
| 235 | * @return the result of interpretting the object as an instance of '<em>Alternative Resource Usage</em>'. |
| 236 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 237 | * @generated |
| 238 | */ |
| 239 | public Object caseAlternativeResourceUsage(AlternativeResourceUsage object) { |
| 240 | return null; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * Returns the result of interpretting the object as an instance of '<em>Resource Usage</em>'. |
| 245 | * <!-- begin-user-doc --> |
| 246 | * This implementation returns null; |
| 247 | * returning a non-null result will terminate the switch. |
| 248 | * <!-- end-user-doc --> |
| 249 | * @param object the target of the switch. |
| 250 | * @return the result of interpretting the object as an instance of '<em>Resource Usage</em>'. |
| 251 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 252 | * @generated |
| 253 | */ |
| 254 | public Object caseResourceUsage(ResourceUsage object) { |
| 255 | return null; |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * Returns the result of interpretting the object as an instance of '<em>Passive Resource</em>'. |
| 260 | * <!-- begin-user-doc --> |
| 261 | * This implementation returns null; |
| 262 | * returning a non-null result will terminate the switch. |
| 263 | * <!-- end-user-doc --> |
| 264 | * @param object the target of the switch. |
| 265 | * @return the result of interpretting the object as an instance of '<em>Passive Resource</em>'. |
| 266 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 267 | * @generated |
| 268 | */ |
| 269 | public Object casePassiveResource(PassiveResource object) { |
| 270 | return null; |
| 271 | } |
| 272 | |
| 273 | /** |
| 274 | * Returns the result of interpretting the object as an instance of '<em>Contention Resource</em>'. |
| 275 | * <!-- begin-user-doc --> |
| 276 | * This implementation returns null; |
| 277 | * returning a non-null result will terminate the switch. |
| 278 | * <!-- end-user-doc --> |
| 279 | * @param object the target of the switch. |
| 280 | * @return the result of interpretting the object as an instance of '<em>Contention Resource</em>'. |
| 281 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 282 | * @generated |
| 283 | */ |
| 284 | public Object caseContentionResource(ContentionResource object) { |
| 285 | return null; |
| 286 | } |
| 287 | |
| 288 | /** |
| 289 | * Returns the result of interpretting the object as an instance of '<em>Processing Resource</em>'. |
| 290 | * <!-- begin-user-doc --> |
| 291 | * This implementation returns null; |
| 292 | * returning a non-null result will terminate the switch. |
| 293 | * <!-- end-user-doc --> |
| 294 | * @param object the target of the switch. |
| 295 | * @return the result of interpretting the object as an instance of '<em>Processing Resource</em>'. |
| 296 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 297 | * @generated |
| 298 | */ |
| 299 | public Object caseProcessingResource(ProcessingResource object) { |
| 300 | return null; |
| 301 | } |
| 302 | |
| 303 | /** |
| 304 | * Returns the result of interpretting the object as an instance of '<em>Active Resource</em>'. |
| 305 | * <!-- begin-user-doc --> |
| 306 | * This implementation returns null; |
| 307 | * returning a non-null result will terminate the switch. |
| 308 | * <!-- end-user-doc --> |
| 309 | * @param object the target of the switch. |
| 310 | * @return the result of interpretting the object as an instance of '<em>Active Resource</em>'. |
| 311 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 312 | * @generated |
| 313 | */ |
| 314 | public Object caseActiveResource(ActiveResource object) { |
| 315 | return null; |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Returns the result of interpretting the object as an instance of '<em>Delay Resource</em>'. |
| 320 | * <!-- begin-user-doc --> |
| 321 | * This implementation returns null; |
| 322 | * returning a non-null result will terminate the switch. |
| 323 | * <!-- end-user-doc --> |
| 324 | * @param object the target of the switch. |
| 325 | * @return the result of interpretting the object as an instance of '<em>Delay Resource</em>'. |
| 326 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 327 | * @generated |
| 328 | */ |
| 329 | public Object caseDelayResource(DelayResource object) { |
| 330 | return null; |
| 331 | } |
| 332 | |
| 333 | /** |
| 334 | * Returns the result of interpretting the object as an instance of '<em>Option</em>'. |
| 335 | * <!-- begin-user-doc --> |
| 336 | * This implementation returns null; |
| 337 | * returning a non-null result will terminate the switch. |
| 338 | * <!-- end-user-doc --> |
| 339 | * @param object the target of the switch. |
| 340 | * @return the result of interpretting the object as an instance of '<em>Option</em>'. |
| 341 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 342 | * @generated |
| 343 | */ |
| 344 | public Object caseOption(Option object) { |
| 345 | return null; |
| 346 | } |
| 347 | |
| 348 | /** |
| 349 | * Returns the result of interpretting the object as an instance of '<em>EObject</em>'. |
| 350 | * <!-- begin-user-doc --> |
| 351 | * This implementation returns null; |
| 352 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 353 | * <!-- end-user-doc --> |
| 354 | * @param object the target of the switch. |
| 355 | * @return the result of interpretting the object as an instance of '<em>EObject</em>'. |
| 356 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 357 | * @generated |
| 358 | */ |
| 359 | public Object defaultCase(EObject object) { |
| 360 | return null; |
| 361 | } |
| 362 | |
| 363 | } //ResourceModelSwitch |