| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.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.identifier.Identifier; |
| 14 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
| 15 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
| 16 | import de.uka.ipd.sdq.pcm.reliability.*; |
| 17 | import de.uka.ipd.sdq.pcm.reliability.ExternalFailureOccurrenceDescription; |
| 18 | import de.uka.ipd.sdq.pcm.reliability.FailureOccurrenceDescription; |
| 19 | import de.uka.ipd.sdq.pcm.reliability.FailureType; |
| 20 | import de.uka.ipd.sdq.pcm.reliability.HardwareInducedFailureType; |
| 21 | import de.uka.ipd.sdq.pcm.reliability.InternalFailureOccurrenceDescription; |
| 22 | import de.uka.ipd.sdq.pcm.reliability.NetworkInducedFailureType; |
| 23 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
| 24 | import de.uka.ipd.sdq.pcm.reliability.ResourceTimeoutFailureType; |
| 25 | import de.uka.ipd.sdq.pcm.reliability.SoftwareInducedFailureType; |
| 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.pcm.reliability.ReliabilityPackage |
| 38 | * @generated |
| 39 | */ |
| 40 | public class ReliabilitySwitch<T> { |
| 41 | /** |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 47 | |
| 48 | /** |
| 49 | * The cached model package |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @generated |
| 53 | */ |
| 54 | protected static ReliabilityPackage modelPackage; |
| 55 | |
| 56 | /** |
| 57 | * Creates an instance of the switch. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @generated |
| 61 | */ |
| 62 | public ReliabilitySwitch() { |
| 63 | if (modelPackage == null) { |
| 64 | modelPackage = ReliabilityPackage.eINSTANCE; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 73 | * @generated |
| 74 | */ |
| 75 | public T doSwitch(EObject theEObject) { |
| 76 | return doSwitch(theEObject.eClass(), theEObject); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 84 | * @generated |
| 85 | */ |
| 86 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 87 | if (theEClass.eContainer() == modelPackage) { |
| 88 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 89 | } |
| 90 | else { |
| 91 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 92 | return |
| 93 | eSuperTypes.isEmpty() ? |
| 94 | defaultCase(theEObject) : |
| 95 | doSwitch(eSuperTypes.get(0), theEObject); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 104 | * @generated |
| 105 | */ |
| 106 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 107 | switch (classifierID) { |
| 108 | case ReliabilityPackage.FAILURE_OCCURRENCE_DESCRIPTION: { |
| 109 | FailureOccurrenceDescription failureOccurrenceDescription = (FailureOccurrenceDescription)theEObject; |
| 110 | T result = caseFailureOccurrenceDescription(failureOccurrenceDescription); |
| 111 | if (result == null) result = defaultCase(theEObject); |
| 112 | return result; |
| 113 | } |
| 114 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE: { |
| 115 | HardwareInducedFailureType hardwareInducedFailureType = (HardwareInducedFailureType)theEObject; |
| 116 | T result = caseHardwareInducedFailureType(hardwareInducedFailureType); |
| 117 | if (result == null) result = caseFailureType(hardwareInducedFailureType); |
| 118 | if (result == null) result = caseEntity(hardwareInducedFailureType); |
| 119 | if (result == null) result = caseIdentifier(hardwareInducedFailureType); |
| 120 | if (result == null) result = caseNamedElement(hardwareInducedFailureType); |
| 121 | if (result == null) result = defaultCase(theEObject); |
| 122 | return result; |
| 123 | } |
| 124 | case ReliabilityPackage.SOFTWARE_INDUCED_FAILURE_TYPE: { |
| 125 | SoftwareInducedFailureType softwareInducedFailureType = (SoftwareInducedFailureType)theEObject; |
| 126 | T result = caseSoftwareInducedFailureType(softwareInducedFailureType); |
| 127 | if (result == null) result = caseFailureType(softwareInducedFailureType); |
| 128 | if (result == null) result = caseEntity(softwareInducedFailureType); |
| 129 | if (result == null) result = caseIdentifier(softwareInducedFailureType); |
| 130 | if (result == null) result = caseNamedElement(softwareInducedFailureType); |
| 131 | if (result == null) result = defaultCase(theEObject); |
| 132 | return result; |
| 133 | } |
| 134 | case ReliabilityPackage.INTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: { |
| 135 | InternalFailureOccurrenceDescription internalFailureOccurrenceDescription = (InternalFailureOccurrenceDescription)theEObject; |
| 136 | T result = caseInternalFailureOccurrenceDescription(internalFailureOccurrenceDescription); |
| 137 | if (result == null) result = caseFailureOccurrenceDescription(internalFailureOccurrenceDescription); |
| 138 | if (result == null) result = defaultCase(theEObject); |
| 139 | return result; |
| 140 | } |
| 141 | case ReliabilityPackage.NETWORK_INDUCED_FAILURE_TYPE: { |
| 142 | NetworkInducedFailureType networkInducedFailureType = (NetworkInducedFailureType)theEObject; |
| 143 | T result = caseNetworkInducedFailureType(networkInducedFailureType); |
| 144 | if (result == null) result = caseFailureType(networkInducedFailureType); |
| 145 | if (result == null) result = caseEntity(networkInducedFailureType); |
| 146 | if (result == null) result = caseIdentifier(networkInducedFailureType); |
| 147 | if (result == null) result = caseNamedElement(networkInducedFailureType); |
| 148 | if (result == null) result = defaultCase(theEObject); |
| 149 | return result; |
| 150 | } |
| 151 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: { |
| 152 | ExternalFailureOccurrenceDescription externalFailureOccurrenceDescription = (ExternalFailureOccurrenceDescription)theEObject; |
| 153 | T result = caseExternalFailureOccurrenceDescription(externalFailureOccurrenceDescription); |
| 154 | if (result == null) result = caseFailureOccurrenceDescription(externalFailureOccurrenceDescription); |
| 155 | if (result == null) result = defaultCase(theEObject); |
| 156 | return result; |
| 157 | } |
| 158 | case ReliabilityPackage.RESOURCE_TIMEOUT_FAILURE_TYPE: { |
| 159 | ResourceTimeoutFailureType resourceTimeoutFailureType = (ResourceTimeoutFailureType)theEObject; |
| 160 | T result = caseResourceTimeoutFailureType(resourceTimeoutFailureType); |
| 161 | if (result == null) result = caseSoftwareInducedFailureType(resourceTimeoutFailureType); |
| 162 | if (result == null) result = caseFailureType(resourceTimeoutFailureType); |
| 163 | if (result == null) result = caseEntity(resourceTimeoutFailureType); |
| 164 | if (result == null) result = caseIdentifier(resourceTimeoutFailureType); |
| 165 | if (result == null) result = caseNamedElement(resourceTimeoutFailureType); |
| 166 | if (result == null) result = defaultCase(theEObject); |
| 167 | return result; |
| 168 | } |
| 169 | case ReliabilityPackage.FAILURE_TYPE: { |
| 170 | FailureType failureType = (FailureType)theEObject; |
| 171 | T result = caseFailureType(failureType); |
| 172 | if (result == null) result = caseEntity(failureType); |
| 173 | if (result == null) result = caseIdentifier(failureType); |
| 174 | if (result == null) result = caseNamedElement(failureType); |
| 175 | if (result == null) result = defaultCase(theEObject); |
| 176 | return result; |
| 177 | } |
| 178 | default: return defaultCase(theEObject); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | /** |
| 183 | * Returns the result of interpreting the object as an instance of '<em>Failure Occurrence Description</em>'. |
| 184 | * <!-- begin-user-doc --> |
| 185 | * This implementation returns null; |
| 186 | * returning a non-null result will terminate the switch. |
| 187 | * <!-- end-user-doc --> |
| 188 | * @param object the target of the switch. |
| 189 | * @return the result of interpreting the object as an instance of '<em>Failure Occurrence Description</em>'. |
| 190 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 191 | * @generated |
| 192 | */ |
| 193 | public T caseFailureOccurrenceDescription(FailureOccurrenceDescription object) { |
| 194 | return null; |
| 195 | } |
| 196 | |
| 197 | /** |
| 198 | * Returns the result of interpreting the object as an instance of '<em>Hardware Induced Failure Type</em>'. |
| 199 | * <!-- begin-user-doc --> |
| 200 | * This implementation returns null; |
| 201 | * returning a non-null result will terminate the switch. |
| 202 | * <!-- end-user-doc --> |
| 203 | * @param object the target of the switch. |
| 204 | * @return the result of interpreting the object as an instance of '<em>Hardware Induced Failure Type</em>'. |
| 205 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 206 | * @generated |
| 207 | */ |
| 208 | public T caseHardwareInducedFailureType(HardwareInducedFailureType object) { |
| 209 | return null; |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * Returns the result of interpreting the object as an instance of '<em>External Failure Occurrence Description</em>'. |
| 214 | * <!-- begin-user-doc --> |
| 215 | * This implementation returns null; |
| 216 | * returning a non-null result will terminate the switch. |
| 217 | * <!-- end-user-doc --> |
| 218 | * @param object the target of the switch. |
| 219 | * @return the result of interpreting the object as an instance of '<em>External Failure Occurrence Description</em>'. |
| 220 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 221 | * @generated |
| 222 | */ |
| 223 | public T caseExternalFailureOccurrenceDescription(ExternalFailureOccurrenceDescription object) { |
| 224 | return null; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * Returns the result of interpreting the object as an instance of '<em>Resource Timeout Failure Type</em>'. |
| 229 | * <!-- begin-user-doc --> |
| 230 | * This implementation returns null; |
| 231 | * returning a non-null result will terminate the switch. |
| 232 | * <!-- end-user-doc --> |
| 233 | * @param object the target of the switch. |
| 234 | * @return the result of interpreting the object as an instance of '<em>Resource Timeout Failure Type</em>'. |
| 235 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 236 | * @generated |
| 237 | */ |
| 238 | public T caseResourceTimeoutFailureType(ResourceTimeoutFailureType object) { |
| 239 | return null; |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * Returns the result of interpreting the object as an instance of '<em>Network Induced Failure Type</em>'. |
| 244 | * <!-- begin-user-doc --> |
| 245 | * This implementation returns null; |
| 246 | * returning a non-null result will terminate the switch. |
| 247 | * <!-- end-user-doc --> |
| 248 | * @param object the target of the switch. |
| 249 | * @return the result of interpreting the object as an instance of '<em>Network Induced Failure Type</em>'. |
| 250 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 251 | * @generated |
| 252 | */ |
| 253 | public T caseNetworkInducedFailureType(NetworkInducedFailureType object) { |
| 254 | return null; |
| 255 | } |
| 256 | |
| 257 | /** |
| 258 | * Returns the result of interpreting the object as an instance of '<em>Internal Failure Occurrence Description</em>'. |
| 259 | * <!-- begin-user-doc --> |
| 260 | * This implementation returns null; |
| 261 | * returning a non-null result will terminate the switch. |
| 262 | * <!-- end-user-doc --> |
| 263 | * @param object the target of the switch. |
| 264 | * @return the result of interpreting the object as an instance of '<em>Internal Failure Occurrence Description</em>'. |
| 265 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 266 | * @generated |
| 267 | */ |
| 268 | public T caseInternalFailureOccurrenceDescription(InternalFailureOccurrenceDescription object) { |
| 269 | return null; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * Returns the result of interpreting the object as an instance of '<em>Software Induced Failure Type</em>'. |
| 274 | * <!-- begin-user-doc --> |
| 275 | * This implementation returns null; |
| 276 | * returning a non-null result will terminate the switch. |
| 277 | * <!-- end-user-doc --> |
| 278 | * @param object the target of the switch. |
| 279 | * @return the result of interpreting the object as an instance of '<em>Software Induced Failure Type</em>'. |
| 280 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 281 | * @generated |
| 282 | */ |
| 283 | public T caseSoftwareInducedFailureType(SoftwareInducedFailureType object) { |
| 284 | return null; |
| 285 | } |
| 286 | |
| 287 | /** |
| 288 | * Returns the result of interpreting the object as an instance of '<em>Failure Type</em>'. |
| 289 | * <!-- begin-user-doc --> |
| 290 | * This implementation returns null; |
| 291 | * returning a non-null result will terminate the switch. |
| 292 | * <!-- end-user-doc --> |
| 293 | * @param object the target of the switch. |
| 294 | * @return the result of interpreting the object as an instance of '<em>Failure Type</em>'. |
| 295 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 296 | * @generated |
| 297 | */ |
| 298 | public T caseFailureType(FailureType object) { |
| 299 | return null; |
| 300 | } |
| 301 | |
| 302 | /** |
| 303 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 304 | * <!-- begin-user-doc --> |
| 305 | * This implementation returns null; |
| 306 | * returning a non-null result will terminate the switch. |
| 307 | * <!-- end-user-doc --> |
| 308 | * @param object the target of the switch. |
| 309 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 310 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 311 | * @generated |
| 312 | */ |
| 313 | public T caseIdentifier(Identifier object) { |
| 314 | return null; |
| 315 | } |
| 316 | |
| 317 | /** |
| 318 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 319 | * <!-- begin-user-doc --> |
| 320 | * This implementation returns null; |
| 321 | * returning a non-null result will terminate the switch. |
| 322 | * <!-- end-user-doc --> |
| 323 | * @param object the target of the switch. |
| 324 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 325 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 326 | * @generated |
| 327 | */ |
| 328 | public T caseNamedElement(NamedElement object) { |
| 329 | return null; |
| 330 | } |
| 331 | |
| 332 | /** |
| 333 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 334 | * <!-- begin-user-doc --> |
| 335 | * This implementation returns null; |
| 336 | * returning a non-null result will terminate the switch. |
| 337 | * <!-- end-user-doc --> |
| 338 | * @param object the target of the switch. |
| 339 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 340 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 341 | * @generated |
| 342 | */ |
| 343 | public T caseEntity(Entity object) { |
| 344 | return null; |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 349 | * <!-- begin-user-doc --> |
| 350 | * This implementation returns null; |
| 351 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 352 | * <!-- end-user-doc --> |
| 353 | * @param object the target of the switch. |
| 354 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 355 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 356 | * @generated |
| 357 | */ |
| 358 | public T defaultCase(EObject object) { |
| 359 | return null; |
| 360 | } |
| 361 | |
| 362 | } //ReliabilitySwitch |