| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.*; |
| 10 | |
| 11 | import de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.QMLDeclaration; |
| 12 | |
| 13 | import de.uka.ipd.sdq.identifier.Identifier; |
| 14 | |
| 15 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
| 16 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
| 17 | |
| 18 | import java.util.List; |
| 19 | |
| 20 | import org.eclipse.emf.ecore.EClass; |
| 21 | import org.eclipse.emf.ecore.EObject; |
| 22 | |
| 23 | /** |
| 24 | * <!-- begin-user-doc --> |
| 25 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 26 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 27 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 28 | * starting with the actual class of the object |
| 29 | * and proceeding up the inheritance hierarchy |
| 30 | * until a non-null result is returned, |
| 31 | * which is the result of the switch. |
| 32 | * <!-- end-user-doc --> |
| 33 | * @see de.uka.ipd.sdq.dsexplore.qml.contracttype.QMLContractType.QMLContractTypePackage |
| 34 | * @generated |
| 35 | */ |
| 36 | public class QMLContractTypeSwitch<T> { |
| 37 | /** |
| 38 | * The cached model package |
| 39 | * <!-- begin-user-doc --> |
| 40 | * <!-- end-user-doc --> |
| 41 | * @generated |
| 42 | */ |
| 43 | protected static QMLContractTypePackage modelPackage; |
| 44 | |
| 45 | /** |
| 46 | * Creates an instance of the switch. |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @generated |
| 50 | */ |
| 51 | public QMLContractTypeSwitch() { |
| 52 | if (modelPackage == null) { |
| 53 | modelPackage = QMLContractTypePackage.eINSTANCE; |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 59 | * <!-- begin-user-doc --> |
| 60 | * <!-- end-user-doc --> |
| 61 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 62 | * @generated |
| 63 | */ |
| 64 | public T doSwitch(EObject theEObject) { |
| 65 | return doSwitch(theEObject.eClass(), theEObject); |
| 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 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 76 | if (theEClass.eContainer() == modelPackage) { |
| 77 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 78 | } |
| 79 | else { |
| 80 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 81 | return |
| 82 | eSuperTypes.isEmpty() ? |
| 83 | defaultCase(theEObject) : |
| 84 | doSwitch(eSuperTypes.get(0), theEObject); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 93 | * @generated |
| 94 | */ |
| 95 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 96 | switch (classifierID) { |
| 97 | case QMLContractTypePackage.DIMENSION_TYPE_SET: { |
| 98 | DimensionTypeSet dimensionTypeSet = (DimensionTypeSet)theEObject; |
| 99 | T result = caseDimensionTypeSet(dimensionTypeSet); |
| 100 | if (result == null) result = caseDimensionType(dimensionTypeSet); |
| 101 | if (result == null) result = caseIdentifier(dimensionTypeSet); |
| 102 | if (result == null) result = defaultCase(theEObject); |
| 103 | return result; |
| 104 | } |
| 105 | case QMLContractTypePackage.DIMENSION_TYPE: { |
| 106 | DimensionType dimensionType = (DimensionType)theEObject; |
| 107 | T result = caseDimensionType(dimensionType); |
| 108 | if (result == null) result = caseIdentifier(dimensionType); |
| 109 | if (result == null) result = defaultCase(theEObject); |
| 110 | return result; |
| 111 | } |
| 112 | case QMLContractTypePackage.RELATION_SEMANTICS: { |
| 113 | RelationSemantics relationSemantics = (RelationSemantics)theEObject; |
| 114 | T result = caseRelationSemantics(relationSemantics); |
| 115 | if (result == null) result = caseIdentifier(relationSemantics); |
| 116 | if (result == null) result = defaultCase(theEObject); |
| 117 | return result; |
| 118 | } |
| 119 | case QMLContractTypePackage.ELEMENT: { |
| 120 | Element element = (Element)theEObject; |
| 121 | T result = caseElement(element); |
| 122 | if (result == null) result = caseEntity(element); |
| 123 | if (result == null) result = caseIdentifier(element); |
| 124 | if (result == null) result = caseNamedElement(element); |
| 125 | if (result == null) result = defaultCase(theEObject); |
| 126 | return result; |
| 127 | } |
| 128 | case QMLContractTypePackage.ORDER: { |
| 129 | Order order = (Order)theEObject; |
| 130 | T result = caseOrder(order); |
| 131 | if (result == null) result = caseIdentifier(order); |
| 132 | if (result == null) result = defaultCase(theEObject); |
| 133 | return result; |
| 134 | } |
| 135 | case QMLContractTypePackage.DIMENSION_TYPE_ENUM: { |
| 136 | DimensionTypeEnum dimensionTypeEnum = (DimensionTypeEnum)theEObject; |
| 137 | T result = caseDimensionTypeEnum(dimensionTypeEnum); |
| 138 | if (result == null) result = caseDimensionType(dimensionTypeEnum); |
| 139 | if (result == null) result = caseIdentifier(dimensionTypeEnum); |
| 140 | if (result == null) result = defaultCase(theEObject); |
| 141 | return result; |
| 142 | } |
| 143 | case QMLContractTypePackage.UNIT: { |
| 144 | Unit unit = (Unit)theEObject; |
| 145 | T result = caseUnit(unit); |
| 146 | if (result == null) result = caseEntity(unit); |
| 147 | if (result == null) result = caseIdentifier(unit); |
| 148 | if (result == null) result = caseNamedElement(unit); |
| 149 | if (result == null) result = defaultCase(theEObject); |
| 150 | return result; |
| 151 | } |
| 152 | case QMLContractTypePackage.DIMENSION_TYPE_NUMERIC: { |
| 153 | DimensionTypeNumeric dimensionTypeNumeric = (DimensionTypeNumeric)theEObject; |
| 154 | T result = caseDimensionTypeNumeric(dimensionTypeNumeric); |
| 155 | if (result == null) result = caseDimensionType(dimensionTypeNumeric); |
| 156 | if (result == null) result = caseIdentifier(dimensionTypeNumeric); |
| 157 | if (result == null) result = defaultCase(theEObject); |
| 158 | return result; |
| 159 | } |
| 160 | case QMLContractTypePackage.NUMERIC_RANGE: { |
| 161 | NumericRange numericRange = (NumericRange)theEObject; |
| 162 | T result = caseNumericRange(numericRange); |
| 163 | if (result == null) result = caseIdentifier(numericRange); |
| 164 | if (result == null) result = defaultCase(theEObject); |
| 165 | return result; |
| 166 | } |
| 167 | case QMLContractTypePackage.QML_CONTRACT_TYPE: { |
| 168 | QMLContractType qmlContractType = (QMLContractType)theEObject; |
| 169 | T result = caseQMLContractType(qmlContractType); |
| 170 | if (result == null) result = caseQMLDeclaration(qmlContractType); |
| 171 | if (result == null) result = caseEntity(qmlContractType); |
| 172 | if (result == null) result = caseIdentifier(qmlContractType); |
| 173 | if (result == null) result = caseNamedElement(qmlContractType); |
| 174 | if (result == null) result = defaultCase(theEObject); |
| 175 | return result; |
| 176 | } |
| 177 | case QMLContractTypePackage.UNIT_REPOSITORY: { |
| 178 | UnitRepository unitRepository = (UnitRepository)theEObject; |
| 179 | T result = caseUnitRepository(unitRepository); |
| 180 | if (result == null) result = caseIdentifier(unitRepository); |
| 181 | if (result == null) result = defaultCase(theEObject); |
| 182 | return result; |
| 183 | } |
| 184 | case QMLContractTypePackage.DIMENSION_TYPE_REPOSITORY: { |
| 185 | DimensionTypeRepository dimensionTypeRepository = (DimensionTypeRepository)theEObject; |
| 186 | T result = caseDimensionTypeRepository(dimensionTypeRepository); |
| 187 | if (result == null) result = caseIdentifier(dimensionTypeRepository); |
| 188 | if (result == null) result = defaultCase(theEObject); |
| 189 | return result; |
| 190 | } |
| 191 | case QMLContractTypePackage.DIMENSION: { |
| 192 | Dimension dimension = (Dimension)theEObject; |
| 193 | T result = caseDimension(dimension); |
| 194 | if (result == null) result = caseEntity(dimension); |
| 195 | if (result == null) result = caseIdentifier(dimension); |
| 196 | if (result == null) result = caseNamedElement(dimension); |
| 197 | if (result == null) result = defaultCase(theEObject); |
| 198 | return result; |
| 199 | } |
| 200 | default: return defaultCase(theEObject); |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Returns the result of interpreting the object as an instance of '<em>Dimension Type Set</em>'. |
| 206 | * <!-- begin-user-doc --> |
| 207 | * This implementation returns null; |
| 208 | * returning a non-null result will terminate the switch. |
| 209 | * <!-- end-user-doc --> |
| 210 | * @param object the target of the switch. |
| 211 | * @return the result of interpreting the object as an instance of '<em>Dimension Type Set</em>'. |
| 212 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 213 | * @generated |
| 214 | */ |
| 215 | public T caseDimensionTypeSet(DimensionTypeSet object) { |
| 216 | return null; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * Returns the result of interpreting the object as an instance of '<em>Dimension Type</em>'. |
| 221 | * <!-- begin-user-doc --> |
| 222 | * This implementation returns null; |
| 223 | * returning a non-null result will terminate the switch. |
| 224 | * <!-- end-user-doc --> |
| 225 | * @param object the target of the switch. |
| 226 | * @return the result of interpreting the object as an instance of '<em>Dimension Type</em>'. |
| 227 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 228 | * @generated |
| 229 | */ |
| 230 | public T caseDimensionType(DimensionType object) { |
| 231 | return null; |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * Returns the result of interpreting the object as an instance of '<em>Relation Semantics</em>'. |
| 236 | * <!-- begin-user-doc --> |
| 237 | * This implementation returns null; |
| 238 | * returning a non-null result will terminate the switch. |
| 239 | * <!-- end-user-doc --> |
| 240 | * @param object the target of the switch. |
| 241 | * @return the result of interpreting the object as an instance of '<em>Relation Semantics</em>'. |
| 242 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 243 | * @generated |
| 244 | */ |
| 245 | public T caseRelationSemantics(RelationSemantics object) { |
| 246 | return null; |
| 247 | } |
| 248 | |
| 249 | /** |
| 250 | * Returns the result of interpreting the object as an instance of '<em>Element</em>'. |
| 251 | * <!-- begin-user-doc --> |
| 252 | * This implementation returns null; |
| 253 | * returning a non-null result will terminate the switch. |
| 254 | * <!-- end-user-doc --> |
| 255 | * @param object the target of the switch. |
| 256 | * @return the result of interpreting the object as an instance of '<em>Element</em>'. |
| 257 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 258 | * @generated |
| 259 | */ |
| 260 | public T caseElement(Element object) { |
| 261 | return null; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Returns the result of interpreting the object as an instance of '<em>Order</em>'. |
| 266 | * <!-- begin-user-doc --> |
| 267 | * This implementation returns null; |
| 268 | * returning a non-null result will terminate the switch. |
| 269 | * <!-- end-user-doc --> |
| 270 | * @param object the target of the switch. |
| 271 | * @return the result of interpreting the object as an instance of '<em>Order</em>'. |
| 272 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 273 | * @generated |
| 274 | */ |
| 275 | public T caseOrder(Order object) { |
| 276 | return null; |
| 277 | } |
| 278 | |
| 279 | /** |
| 280 | * Returns the result of interpreting the object as an instance of '<em>Dimension Type Enum</em>'. |
| 281 | * <!-- begin-user-doc --> |
| 282 | * This implementation returns null; |
| 283 | * returning a non-null result will terminate the switch. |
| 284 | * <!-- end-user-doc --> |
| 285 | * @param object the target of the switch. |
| 286 | * @return the result of interpreting the object as an instance of '<em>Dimension Type Enum</em>'. |
| 287 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 288 | * @generated |
| 289 | */ |
| 290 | public T caseDimensionTypeEnum(DimensionTypeEnum object) { |
| 291 | return null; |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * Returns the result of interpreting the object as an instance of '<em>Unit</em>'. |
| 296 | * <!-- begin-user-doc --> |
| 297 | * This implementation returns null; |
| 298 | * returning a non-null result will terminate the switch. |
| 299 | * <!-- end-user-doc --> |
| 300 | * @param object the target of the switch. |
| 301 | * @return the result of interpreting the object as an instance of '<em>Unit</em>'. |
| 302 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 303 | * @generated |
| 304 | */ |
| 305 | public T caseUnit(Unit object) { |
| 306 | return null; |
| 307 | } |
| 308 | |
| 309 | /** |
| 310 | * Returns the result of interpreting the object as an instance of '<em>Dimension Type Numeric</em>'. |
| 311 | * <!-- begin-user-doc --> |
| 312 | * This implementation returns null; |
| 313 | * returning a non-null result will terminate the switch. |
| 314 | * <!-- end-user-doc --> |
| 315 | * @param object the target of the switch. |
| 316 | * @return the result of interpreting the object as an instance of '<em>Dimension Type Numeric</em>'. |
| 317 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 318 | * @generated |
| 319 | */ |
| 320 | public T caseDimensionTypeNumeric(DimensionTypeNumeric object) { |
| 321 | return null; |
| 322 | } |
| 323 | |
| 324 | /** |
| 325 | * Returns the result of interpreting the object as an instance of '<em>Numeric Range</em>'. |
| 326 | * <!-- begin-user-doc --> |
| 327 | * This implementation returns null; |
| 328 | * returning a non-null result will terminate the switch. |
| 329 | * <!-- end-user-doc --> |
| 330 | * @param object the target of the switch. |
| 331 | * @return the result of interpreting the object as an instance of '<em>Numeric Range</em>'. |
| 332 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 333 | * @generated |
| 334 | */ |
| 335 | public T caseNumericRange(NumericRange object) { |
| 336 | return null; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * Returns the result of interpreting the object as an instance of '<em>QML Contract Type</em>'. |
| 341 | * <!-- begin-user-doc --> |
| 342 | * This implementation returns null; |
| 343 | * returning a non-null result will terminate the switch. |
| 344 | * <!-- end-user-doc --> |
| 345 | * @param object the target of the switch. |
| 346 | * @return the result of interpreting the object as an instance of '<em>QML Contract Type</em>'. |
| 347 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 348 | * @generated |
| 349 | */ |
| 350 | public T caseQMLContractType(QMLContractType object) { |
| 351 | return null; |
| 352 | } |
| 353 | |
| 354 | /** |
| 355 | * Returns the result of interpreting the object as an instance of '<em>Unit Repository</em>'. |
| 356 | * <!-- begin-user-doc --> |
| 357 | * This implementation returns null; |
| 358 | * returning a non-null result will terminate the switch. |
| 359 | * <!-- end-user-doc --> |
| 360 | * @param object the target of the switch. |
| 361 | * @return the result of interpreting the object as an instance of '<em>Unit Repository</em>'. |
| 362 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 363 | * @generated |
| 364 | */ |
| 365 | public T caseUnitRepository(UnitRepository object) { |
| 366 | return null; |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * Returns the result of interpreting the object as an instance of '<em>Dimension Type Repository</em>'. |
| 371 | * <!-- begin-user-doc --> |
| 372 | * This implementation returns null; |
| 373 | * returning a non-null result will terminate the switch. |
| 374 | * <!-- end-user-doc --> |
| 375 | * @param object the target of the switch. |
| 376 | * @return the result of interpreting the object as an instance of '<em>Dimension Type Repository</em>'. |
| 377 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 378 | * @generated |
| 379 | */ |
| 380 | public T caseDimensionTypeRepository(DimensionTypeRepository object) { |
| 381 | return null; |
| 382 | } |
| 383 | |
| 384 | /** |
| 385 | * Returns the result of interpreting the object as an instance of '<em>Dimension</em>'. |
| 386 | * <!-- begin-user-doc --> |
| 387 | * This implementation returns null; |
| 388 | * returning a non-null result will terminate the switch. |
| 389 | * <!-- end-user-doc --> |
| 390 | * @param object the target of the switch. |
| 391 | * @return the result of interpreting the object as an instance of '<em>Dimension</em>'. |
| 392 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 393 | * @generated |
| 394 | */ |
| 395 | public T caseDimension(Dimension object) { |
| 396 | return null; |
| 397 | } |
| 398 | |
| 399 | /** |
| 400 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 401 | * <!-- begin-user-doc --> |
| 402 | * This implementation returns null; |
| 403 | * returning a non-null result will terminate the switch. |
| 404 | * <!-- end-user-doc --> |
| 405 | * @param object the target of the switch. |
| 406 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 407 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 408 | * @generated |
| 409 | */ |
| 410 | public T caseIdentifier(Identifier object) { |
| 411 | return null; |
| 412 | } |
| 413 | |
| 414 | /** |
| 415 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 416 | * <!-- begin-user-doc --> |
| 417 | * This implementation returns null; |
| 418 | * returning a non-null result will terminate the switch. |
| 419 | * <!-- end-user-doc --> |
| 420 | * @param object the target of the switch. |
| 421 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 422 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 423 | * @generated |
| 424 | */ |
| 425 | public T caseNamedElement(NamedElement object) { |
| 426 | return null; |
| 427 | } |
| 428 | |
| 429 | /** |
| 430 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 431 | * <!-- begin-user-doc --> |
| 432 | * This implementation returns null; |
| 433 | * returning a non-null result will terminate the switch. |
| 434 | * <!-- end-user-doc --> |
| 435 | * @param object the target of the switch. |
| 436 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 437 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 438 | * @generated |
| 439 | */ |
| 440 | public T caseEntity(Entity object) { |
| 441 | return null; |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * Returns the result of interpreting the object as an instance of '<em>QML Declaration</em>'. |
| 446 | * <!-- begin-user-doc --> |
| 447 | * This implementation returns null; |
| 448 | * returning a non-null result will terminate the switch. |
| 449 | * <!-- end-user-doc --> |
| 450 | * @param object the target of the switch. |
| 451 | * @return the result of interpreting the object as an instance of '<em>QML Declaration</em>'. |
| 452 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 453 | * @generated |
| 454 | */ |
| 455 | public T caseQMLDeclaration(QMLDeclaration object) { |
| 456 | return null; |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 461 | * <!-- begin-user-doc --> |
| 462 | * This implementation returns null; |
| 463 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 464 | * <!-- end-user-doc --> |
| 465 | * @param object the target of the switch. |
| 466 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 467 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 468 | * @generated |
| 469 | */ |
| 470 | public T defaultCase(EObject object) { |
| 471 | return null; |
| 472 | } |
| 473 | |
| 474 | } //QMLContractTypeSwitch |