| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.designdecision.GDoF.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.*; |
| 10 | |
| 11 | import java.util.List; |
| 12 | |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | import org.eclipse.emf.ecore.EObject; |
| 15 | |
| 16 | /** |
| 17 | * <!-- begin-user-doc --> |
| 18 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 19 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 20 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 21 | * starting with the actual class of the object |
| 22 | * and proceeding up the inheritance hierarchy |
| 23 | * until a non-null result is returned, |
| 24 | * which is the result of the switch. |
| 25 | * <!-- end-user-doc --> |
| 26 | * @see de.uka.ipd.sdq.pcm.designdecision.GDoF.GDoFPackage |
| 27 | * @generated |
| 28 | */ |
| 29 | public class GDoFSwitch<T> { |
| 30 | /** |
| 31 | * The cached model package |
| 32 | * <!-- begin-user-doc --> |
| 33 | * <!-- end-user-doc --> |
| 34 | * @generated |
| 35 | */ |
| 36 | protected static GDoFPackage modelPackage; |
| 37 | |
| 38 | /** |
| 39 | * Creates an instance of the switch. |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @generated |
| 43 | */ |
| 44 | public GDoFSwitch() { |
| 45 | if (modelPackage == null) { |
| 46 | modelPackage = GDoFPackage.eINSTANCE; |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 52 | * <!-- begin-user-doc --> |
| 53 | * <!-- end-user-doc --> |
| 54 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 55 | * @generated |
| 56 | */ |
| 57 | public T doSwitch(EObject theEObject) { |
| 58 | return doSwitch(theEObject.eClass(), theEObject); |
| 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 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 69 | if (theEClass.eContainer() == modelPackage) { |
| 70 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 71 | } |
| 72 | else { |
| 73 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 74 | return |
| 75 | eSuperTypes.isEmpty() ? |
| 76 | defaultCase(theEObject) : |
| 77 | doSwitch(eSuperTypes.get(0), theEObject); |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 83 | * <!-- begin-user-doc --> |
| 84 | * <!-- end-user-doc --> |
| 85 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 86 | * @generated |
| 87 | */ |
| 88 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 89 | switch (classifierID) { |
| 90 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION: { |
| 91 | ChangeableElementDescription changeableElementDescription = (ChangeableElementDescription)theEObject; |
| 92 | T result = caseChangeableElementDescription(changeableElementDescription); |
| 93 | if (result == null) result = defaultCase(theEObject); |
| 94 | return result; |
| 95 | } |
| 96 | case GDoFPackage.VALUE_RULE: { |
| 97 | ValueRule valueRule = (ValueRule)theEObject; |
| 98 | T result = caseValueRule(valueRule); |
| 99 | if (result == null) result = caseOCLRule(valueRule); |
| 100 | if (result == null) result = defaultCase(theEObject); |
| 101 | return result; |
| 102 | } |
| 103 | case GDoFPackage.OCL_RULE: { |
| 104 | OCLRule oclRule = (OCLRule)theEObject; |
| 105 | T result = caseOCLRule(oclRule); |
| 106 | if (result == null) result = defaultCase(theEObject); |
| 107 | return result; |
| 108 | } |
| 109 | case GDoFPackage.HELPER_OCL_DEFINITION: { |
| 110 | HelperOCLDefinition helperOCLDefinition = (HelperOCLDefinition)theEObject; |
| 111 | T result = caseHelperOCLDefinition(helperOCLDefinition); |
| 112 | if (result == null) result = caseOCLRule(helperOCLDefinition); |
| 113 | if (result == null) result = caseStaticContextRule(helperOCLDefinition); |
| 114 | if (result == null) result = defaultCase(theEObject); |
| 115 | return result; |
| 116 | } |
| 117 | case GDoFPackage.STATIC_CONTEXT_RULE: { |
| 118 | StaticContextRule staticContextRule = (StaticContextRule)theEObject; |
| 119 | T result = caseStaticContextRule(staticContextRule); |
| 120 | if (result == null) result = defaultCase(theEObject); |
| 121 | return result; |
| 122 | } |
| 123 | case GDoFPackage.SELECTION_RULE: { |
| 124 | SelectionRule selectionRule = (SelectionRule)theEObject; |
| 125 | T result = caseSelectionRule(selectionRule); |
| 126 | if (result == null) result = caseOCLRule(selectionRule); |
| 127 | if (result == null) result = defaultCase(theEObject); |
| 128 | return result; |
| 129 | } |
| 130 | case GDoFPackage.DO_FREPOSITORY: { |
| 131 | DoFRepository doFRepository = (DoFRepository)theEObject; |
| 132 | T result = caseDoFRepository(doFRepository); |
| 133 | if (result == null) result = defaultCase(theEObject); |
| 134 | return result; |
| 135 | } |
| 136 | case GDoFPackage.INSTANCE_SELECTION_RULE: { |
| 137 | InstanceSelectionRule instanceSelectionRule = (InstanceSelectionRule)theEObject; |
| 138 | T result = caseInstanceSelectionRule(instanceSelectionRule); |
| 139 | if (result == null) result = caseSelectionRule(instanceSelectionRule); |
| 140 | if (result == null) result = caseOCLRule(instanceSelectionRule); |
| 141 | if (result == null) result = defaultCase(theEObject); |
| 142 | return result; |
| 143 | } |
| 144 | case GDoFPackage.STATIC_SELECTION_RULE: { |
| 145 | StaticSelectionRule staticSelectionRule = (StaticSelectionRule)theEObject; |
| 146 | T result = caseStaticSelectionRule(staticSelectionRule); |
| 147 | if (result == null) result = caseSelectionRule(staticSelectionRule); |
| 148 | if (result == null) result = caseStaticContextRule(staticSelectionRule); |
| 149 | if (result == null) result = caseOCLRule(staticSelectionRule); |
| 150 | if (result == null) result = defaultCase(theEObject); |
| 151 | return result; |
| 152 | } |
| 153 | case GDoFPackage.DEGREE_OF_FREEDOM: { |
| 154 | DegreeOfFreedom degreeOfFreedom = (DegreeOfFreedom)theEObject; |
| 155 | T result = caseDegreeOfFreedom(degreeOfFreedom); |
| 156 | if (result == null) result = defaultCase(theEObject); |
| 157 | return result; |
| 158 | } |
| 159 | default: return defaultCase(theEObject); |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * Returns the result of interpreting the object as an instance of '<em>Changeable Element Description</em>'. |
| 165 | * <!-- begin-user-doc --> |
| 166 | * This implementation returns null; |
| 167 | * returning a non-null result will terminate the switch. |
| 168 | * <!-- end-user-doc --> |
| 169 | * @param object the target of the switch. |
| 170 | * @return the result of interpreting the object as an instance of '<em>Changeable Element Description</em>'. |
| 171 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 172 | * @generated |
| 173 | */ |
| 174 | public T caseChangeableElementDescription(ChangeableElementDescription object) { |
| 175 | return null; |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * Returns the result of interpreting the object as an instance of '<em>Value Rule</em>'. |
| 180 | * <!-- begin-user-doc --> |
| 181 | * This implementation returns null; |
| 182 | * returning a non-null result will terminate the switch. |
| 183 | * <!-- end-user-doc --> |
| 184 | * @param object the target of the switch. |
| 185 | * @return the result of interpreting the object as an instance of '<em>Value Rule</em>'. |
| 186 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 187 | * @generated |
| 188 | */ |
| 189 | public T caseValueRule(ValueRule object) { |
| 190 | return null; |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * Returns the result of interpreting the object as an instance of '<em>OCL Rule</em>'. |
| 195 | * <!-- begin-user-doc --> |
| 196 | * This implementation returns null; |
| 197 | * returning a non-null result will terminate the switch. |
| 198 | * <!-- end-user-doc --> |
| 199 | * @param object the target of the switch. |
| 200 | * @return the result of interpreting the object as an instance of '<em>OCL Rule</em>'. |
| 201 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 202 | * @generated |
| 203 | */ |
| 204 | public T caseOCLRule(OCLRule object) { |
| 205 | return null; |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * Returns the result of interpreting the object as an instance of '<em>Helper OCL Definition</em>'. |
| 210 | * <!-- begin-user-doc --> |
| 211 | * This implementation returns null; |
| 212 | * returning a non-null result will terminate the switch. |
| 213 | * <!-- end-user-doc --> |
| 214 | * @param object the target of the switch. |
| 215 | * @return the result of interpreting the object as an instance of '<em>Helper OCL Definition</em>'. |
| 216 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 217 | * @generated |
| 218 | */ |
| 219 | public T caseHelperOCLDefinition(HelperOCLDefinition object) { |
| 220 | return null; |
| 221 | } |
| 222 | |
| 223 | /** |
| 224 | * Returns the result of interpreting the object as an instance of '<em>Static Context Rule</em>'. |
| 225 | * <!-- begin-user-doc --> |
| 226 | * This implementation returns null; |
| 227 | * returning a non-null result will terminate the switch. |
| 228 | * <!-- end-user-doc --> |
| 229 | * @param object the target of the switch. |
| 230 | * @return the result of interpreting the object as an instance of '<em>Static Context Rule</em>'. |
| 231 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 232 | * @generated |
| 233 | */ |
| 234 | public T caseStaticContextRule(StaticContextRule object) { |
| 235 | return null; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Returns the result of interpreting the object as an instance of '<em>Selection Rule</em>'. |
| 240 | * <!-- begin-user-doc --> |
| 241 | * This implementation returns null; |
| 242 | * returning a non-null result will terminate the switch. |
| 243 | * <!-- end-user-doc --> |
| 244 | * @param object the target of the switch. |
| 245 | * @return the result of interpreting the object as an instance of '<em>Selection Rule</em>'. |
| 246 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 247 | * @generated |
| 248 | */ |
| 249 | public T caseSelectionRule(SelectionRule object) { |
| 250 | return null; |
| 251 | } |
| 252 | |
| 253 | /** |
| 254 | * Returns the result of interpreting the object as an instance of '<em>Do FRepository</em>'. |
| 255 | * <!-- begin-user-doc --> |
| 256 | * This implementation returns null; |
| 257 | * returning a non-null result will terminate the switch. |
| 258 | * <!-- end-user-doc --> |
| 259 | * @param object the target of the switch. |
| 260 | * @return the result of interpreting the object as an instance of '<em>Do FRepository</em>'. |
| 261 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 262 | * @generated |
| 263 | */ |
| 264 | public T caseDoFRepository(DoFRepository object) { |
| 265 | return null; |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * Returns the result of interpreting the object as an instance of '<em>Instance Selection Rule</em>'. |
| 270 | * <!-- begin-user-doc --> |
| 271 | * This implementation returns null; |
| 272 | * returning a non-null result will terminate the switch. |
| 273 | * <!-- end-user-doc --> |
| 274 | * @param object the target of the switch. |
| 275 | * @return the result of interpreting the object as an instance of '<em>Instance Selection Rule</em>'. |
| 276 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 277 | * @generated |
| 278 | */ |
| 279 | public T caseInstanceSelectionRule(InstanceSelectionRule object) { |
| 280 | return null; |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * Returns the result of interpreting the object as an instance of '<em>Static Selection Rule</em>'. |
| 285 | * <!-- begin-user-doc --> |
| 286 | * This implementation returns null; |
| 287 | * returning a non-null result will terminate the switch. |
| 288 | * <!-- end-user-doc --> |
| 289 | * @param object the target of the switch. |
| 290 | * @return the result of interpreting the object as an instance of '<em>Static Selection Rule</em>'. |
| 291 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 292 | * @generated |
| 293 | */ |
| 294 | public T caseStaticSelectionRule(StaticSelectionRule object) { |
| 295 | return null; |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * Returns the result of interpreting the object as an instance of '<em>Degree Of Freedom</em>'. |
| 300 | * <!-- begin-user-doc --> |
| 301 | * This implementation returns null; |
| 302 | * returning a non-null result will terminate the switch. |
| 303 | * <!-- end-user-doc --> |
| 304 | * @param object the target of the switch. |
| 305 | * @return the result of interpreting the object as an instance of '<em>Degree Of Freedom</em>'. |
| 306 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 307 | * @generated |
| 308 | */ |
| 309 | public T caseDegreeOfFreedom(DegreeOfFreedom object) { |
| 310 | return null; |
| 311 | } |
| 312 | |
| 313 | /** |
| 314 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 315 | * <!-- begin-user-doc --> |
| 316 | * This implementation returns null; |
| 317 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 318 | * <!-- end-user-doc --> |
| 319 | * @param object the target of the switch. |
| 320 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 321 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 322 | * @generated |
| 323 | */ |
| 324 | public T defaultCase(EObject object) { |
| 325 | return null; |
| 326 | } |
| 327 | |
| 328 | } //GDoFSwitch |