| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.dsexplore.qml.declarations.QMLDeclarations.QMLDeclaration; |
| 10 | |
| 11 | import de.uka.ipd.sdq.dsexplore.qml.profile.QMLProfile.*; |
| 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.profile.QMLProfile.QMLProfilePackage |
| 34 | * @generated |
| 35 | */ |
| 36 | public class QMLProfileSwitch<T> { |
| 37 | /** |
| 38 | * The cached model package |
| 39 | * <!-- begin-user-doc --> |
| 40 | * <!-- end-user-doc --> |
| 41 | * @generated |
| 42 | */ |
| 43 | protected static QMLProfilePackage modelPackage; |
| 44 | |
| 45 | /** |
| 46 | * Creates an instance of the switch. |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @generated |
| 50 | */ |
| 51 | public QMLProfileSwitch() { |
| 52 | if (modelPackage == null) { |
| 53 | modelPackage = QMLProfilePackage.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 QMLProfilePackage.SIMPLE_QML_PROFILE: { |
| 98 | SimpleQMLProfile simpleQMLProfile = (SimpleQMLProfile)theEObject; |
| 99 | T result = caseSimpleQMLProfile(simpleQMLProfile); |
| 100 | if (result == null) result = caseGenericQMLProfile(simpleQMLProfile); |
| 101 | if (result == null) result = caseQMLDeclaration(simpleQMLProfile); |
| 102 | if (result == null) result = caseEntity(simpleQMLProfile); |
| 103 | if (result == null) result = caseIdentifier(simpleQMLProfile); |
| 104 | if (result == null) result = caseNamedElement(simpleQMLProfile); |
| 105 | if (result == null) result = defaultCase(theEObject); |
| 106 | return result; |
| 107 | } |
| 108 | case QMLProfilePackage.GENERIC_QML_PROFILE: { |
| 109 | GenericQMLProfile genericQMLProfile = (GenericQMLProfile)theEObject; |
| 110 | T result = caseGenericQMLProfile(genericQMLProfile); |
| 111 | if (result == null) result = caseQMLDeclaration(genericQMLProfile); |
| 112 | if (result == null) result = caseEntity(genericQMLProfile); |
| 113 | if (result == null) result = caseIdentifier(genericQMLProfile); |
| 114 | if (result == null) result = caseNamedElement(genericQMLProfile); |
| 115 | if (result == null) result = defaultCase(theEObject); |
| 116 | return result; |
| 117 | } |
| 118 | case QMLProfilePackage.REQUIREMENT: { |
| 119 | Requirement requirement = (Requirement)theEObject; |
| 120 | T result = caseRequirement(requirement); |
| 121 | if (result == null) result = caseIdentifier(requirement); |
| 122 | if (result == null) result = defaultCase(theEObject); |
| 123 | return result; |
| 124 | } |
| 125 | case QMLProfilePackage.REFINED_QML_PROFILE: { |
| 126 | RefinedQMLProfile refinedQMLProfile = (RefinedQMLProfile)theEObject; |
| 127 | T result = caseRefinedQMLProfile(refinedQMLProfile); |
| 128 | if (result == null) result = caseGenericQMLProfile(refinedQMLProfile); |
| 129 | if (result == null) result = caseQMLDeclaration(refinedQMLProfile); |
| 130 | if (result == null) result = caseEntity(refinedQMLProfile); |
| 131 | if (result == null) result = caseIdentifier(refinedQMLProfile); |
| 132 | if (result == null) result = caseNamedElement(refinedQMLProfile); |
| 133 | if (result == null) result = defaultCase(theEObject); |
| 134 | return result; |
| 135 | } |
| 136 | case QMLProfilePackage.USAGE_SCENARIO_REQUIREMENT: { |
| 137 | UsageScenarioRequirement usageScenarioRequirement = (UsageScenarioRequirement)theEObject; |
| 138 | T result = caseUsageScenarioRequirement(usageScenarioRequirement); |
| 139 | if (result == null) result = caseRequirement(usageScenarioRequirement); |
| 140 | if (result == null) result = caseIdentifier(usageScenarioRequirement); |
| 141 | if (result == null) result = defaultCase(theEObject); |
| 142 | return result; |
| 143 | } |
| 144 | case QMLProfilePackage.ENTRY_LEVEL_SYSTEM_CALL_REQUIREMENT: { |
| 145 | EntryLevelSystemCallRequirement entryLevelSystemCallRequirement = (EntryLevelSystemCallRequirement)theEObject; |
| 146 | T result = caseEntryLevelSystemCallRequirement(entryLevelSystemCallRequirement); |
| 147 | if (result == null) result = caseRequirement(entryLevelSystemCallRequirement); |
| 148 | if (result == null) result = caseIdentifier(entryLevelSystemCallRequirement); |
| 149 | if (result == null) result = defaultCase(theEObject); |
| 150 | return result; |
| 151 | } |
| 152 | default: return defaultCase(theEObject); |
| 153 | } |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * Returns the result of interpreting the object as an instance of '<em>Simple QML Profile</em>'. |
| 158 | * <!-- begin-user-doc --> |
| 159 | * This implementation returns null; |
| 160 | * returning a non-null result will terminate the switch. |
| 161 | * <!-- end-user-doc --> |
| 162 | * @param object the target of the switch. |
| 163 | * @return the result of interpreting the object as an instance of '<em>Simple QML Profile</em>'. |
| 164 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 165 | * @generated |
| 166 | */ |
| 167 | public T caseSimpleQMLProfile(SimpleQMLProfile object) { |
| 168 | return null; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * Returns the result of interpreting the object as an instance of '<em>Generic QML Profile</em>'. |
| 173 | * <!-- begin-user-doc --> |
| 174 | * This implementation returns null; |
| 175 | * returning a non-null result will terminate the switch. |
| 176 | * <!-- end-user-doc --> |
| 177 | * @param object the target of the switch. |
| 178 | * @return the result of interpreting the object as an instance of '<em>Generic QML Profile</em>'. |
| 179 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 180 | * @generated |
| 181 | */ |
| 182 | public T caseGenericQMLProfile(GenericQMLProfile object) { |
| 183 | return null; |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * Returns the result of interpreting the object as an instance of '<em>Requirement</em>'. |
| 188 | * <!-- begin-user-doc --> |
| 189 | * This implementation returns null; |
| 190 | * returning a non-null result will terminate the switch. |
| 191 | * <!-- end-user-doc --> |
| 192 | * @param object the target of the switch. |
| 193 | * @return the result of interpreting the object as an instance of '<em>Requirement</em>'. |
| 194 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 195 | * @generated |
| 196 | */ |
| 197 | public T caseRequirement(Requirement object) { |
| 198 | return null; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * Returns the result of interpreting the object as an instance of '<em>Refined QML Profile</em>'. |
| 203 | * <!-- begin-user-doc --> |
| 204 | * This implementation returns null; |
| 205 | * returning a non-null result will terminate the switch. |
| 206 | * <!-- end-user-doc --> |
| 207 | * @param object the target of the switch. |
| 208 | * @return the result of interpreting the object as an instance of '<em>Refined QML Profile</em>'. |
| 209 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 210 | * @generated |
| 211 | */ |
| 212 | public T caseRefinedQMLProfile(RefinedQMLProfile object) { |
| 213 | return null; |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * Returns the result of interpreting the object as an instance of '<em>Usage Scenario Requirement</em>'. |
| 218 | * <!-- begin-user-doc --> |
| 219 | * This implementation returns null; |
| 220 | * returning a non-null result will terminate the switch. |
| 221 | * <!-- end-user-doc --> |
| 222 | * @param object the target of the switch. |
| 223 | * @return the result of interpreting the object as an instance of '<em>Usage Scenario Requirement</em>'. |
| 224 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 225 | * @generated |
| 226 | */ |
| 227 | public T caseUsageScenarioRequirement(UsageScenarioRequirement object) { |
| 228 | return null; |
| 229 | } |
| 230 | |
| 231 | /** |
| 232 | * Returns the result of interpreting the object as an instance of '<em>Entry Level System Call Requirement</em>'. |
| 233 | * <!-- begin-user-doc --> |
| 234 | * This implementation returns null; |
| 235 | * returning a non-null result will terminate the switch. |
| 236 | * <!-- end-user-doc --> |
| 237 | * @param object the target of the switch. |
| 238 | * @return the result of interpreting the object as an instance of '<em>Entry Level System Call Requirement</em>'. |
| 239 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 240 | * @generated |
| 241 | */ |
| 242 | public T caseEntryLevelSystemCallRequirement(EntryLevelSystemCallRequirement object) { |
| 243 | return null; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 248 | * <!-- begin-user-doc --> |
| 249 | * This implementation returns null; |
| 250 | * returning a non-null result will terminate the switch. |
| 251 | * <!-- end-user-doc --> |
| 252 | * @param object the target of the switch. |
| 253 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 254 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 255 | * @generated |
| 256 | */ |
| 257 | public T caseIdentifier(Identifier object) { |
| 258 | return null; |
| 259 | } |
| 260 | |
| 261 | /** |
| 262 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 263 | * <!-- begin-user-doc --> |
| 264 | * This implementation returns null; |
| 265 | * returning a non-null result will terminate the switch. |
| 266 | * <!-- end-user-doc --> |
| 267 | * @param object the target of the switch. |
| 268 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 269 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 270 | * @generated |
| 271 | */ |
| 272 | public T caseNamedElement(NamedElement object) { |
| 273 | return null; |
| 274 | } |
| 275 | |
| 276 | /** |
| 277 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 278 | * <!-- begin-user-doc --> |
| 279 | * This implementation returns null; |
| 280 | * returning a non-null result will terminate the switch. |
| 281 | * <!-- end-user-doc --> |
| 282 | * @param object the target of the switch. |
| 283 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 284 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 285 | * @generated |
| 286 | */ |
| 287 | public T caseEntity(Entity object) { |
| 288 | return null; |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * Returns the result of interpreting the object as an instance of '<em>QML Declaration</em>'. |
| 293 | * <!-- begin-user-doc --> |
| 294 | * This implementation returns null; |
| 295 | * returning a non-null result will terminate the switch. |
| 296 | * <!-- end-user-doc --> |
| 297 | * @param object the target of the switch. |
| 298 | * @return the result of interpreting the object as an instance of '<em>QML Declaration</em>'. |
| 299 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 300 | * @generated |
| 301 | */ |
| 302 | public T caseQMLDeclaration(QMLDeclaration object) { |
| 303 | return null; |
| 304 | } |
| 305 | |
| 306 | /** |
| 307 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 308 | * <!-- begin-user-doc --> |
| 309 | * This implementation returns null; |
| 310 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 311 | * <!-- end-user-doc --> |
| 312 | * @param object the target of the switch. |
| 313 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 314 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 315 | * @generated |
| 316 | */ |
| 317 | public T defaultCase(EObject object) { |
| 318 | return null; |
| 319 | } |
| 320 | |
| 321 | } //QMLProfileSwitch |