1 17 package org.eclipse.emf.ecore.sdo.util; 18 19 import org.eclipse.emf.ecore.EClass; 20 import org.eclipse.emf.ecore.EObject; 21 import org.eclipse.emf.ecore.change.ChangeDescription; 22 import org.eclipse.emf.ecore.change.FeatureChange; 23 import org.eclipse.emf.ecore.sdo.*; 24 25 import org.eclipse.emf.ecore.xml.type.AnyType; 26 import org.eclipse.emf.ecore.xml.type.SimpleAnyType; 27 28 import commonj.sdo.ChangeSummary; 29 import commonj.sdo.DataGraph; 30 import commonj.sdo.DataObject; 31 import commonj.sdo.Property; 32 import commonj.sdo.Sequence; 33 import commonj.sdo.Type; 34 35 import java.util.List ; 36 37 50 public class SDOSwitch { 51 57 protected static SDOPackage modelPackage; 58 59 65 public SDOSwitch() 66 { 67 if (modelPackage == null) 68 { 69 modelPackage = SDOPackage.eINSTANCE; 70 } 71 } 72 73 80 public Object doSwitch(EObject theEObject) 81 { 82 return doSwitch(theEObject.eClass(), theEObject); 83 } 84 85 92 protected Object doSwitch(EClass theEClass, EObject theEObject) 93 { 94 if (theEClass.eContainer() == modelPackage) 95 { 96 return doSwitch(theEClass.getClassifierID(), theEObject); 97 } 98 else 99 { 100 List eSuperTypes = theEClass.getESuperTypes(); 101 return 102 eSuperTypes.isEmpty() ? 103 defaultCase(theEObject) : 104 doSwitch((EClass)eSuperTypes.get(0), theEObject); 105 } 106 } 107 108 115 protected Object doSwitch(int classifierID, EObject theEObject) 116 { 117 switch (classifierID) 118 { 119 case SDOPackage.ECHANGE_SUMMARY: 120 { 121 EChangeSummary eChangeSummary = (EChangeSummary)theEObject; 122 Object result = caseEChangeSummary(eChangeSummary); 123 if (result == null) result = caseChangeDescription(eChangeSummary); 124 if (result == null) result = caseChangeSummary(eChangeSummary); 125 if (result == null) result = defaultCase(theEObject); 126 return result; 127 } 128 case SDOPackage.ECHANGE_SUMMARY_SETTING: 129 { 130 EChangeSummarySetting eChangeSummarySetting = (EChangeSummarySetting)theEObject; 131 Object result = caseEChangeSummarySetting(eChangeSummarySetting); 132 if (result == null) result = caseFeatureChange(eChangeSummarySetting); 133 if (result == null) result = caseChangeSummarySetting(eChangeSummarySetting); 134 if (result == null) result = defaultCase(theEObject); 135 return result; 136 } 137 case SDOPackage.EDATA_GRAPH: 138 { 139 EDataGraph eDataGraph = (EDataGraph)theEObject; 140 Object result = caseEDataGraph(eDataGraph); 141 if (result == null) result = caseDataGraph(eDataGraph); 142 if (result == null) result = defaultCase(theEObject); 143 return result; 144 } 145 case SDOPackage.EDATA_OBJECT: 146 { 147 EDataObject eDataObject = (EDataObject)theEObject; 148 Object result = caseEDataObject(eDataObject); 149 if (result == null) result = caseDataObject(eDataObject); 150 if (result == null) result = defaultCase(theEObject); 151 return result; 152 } 153 case SDOPackage.EPROPERTY: 154 { 155 EProperty eProperty = (EProperty)theEObject; 156 Object result = caseEProperty(eProperty); 157 if (result == null) result = caseProperty(eProperty); 158 if (result == null) result = defaultCase(theEObject); 159 return result; 160 } 161 case SDOPackage.ETYPE: 162 { 163 EType eType = (EType)theEObject; 164 Object result = caseEType(eType); 165 if (result == null) result = caseType(eType); 166 if (result == null) result = defaultCase(theEObject); 167 return result; 168 } 169 case SDOPackage.INTERNAL_EDATA_OBJECT: 170 { 171 InternalEDataObject internalEDataObject = (InternalEDataObject)theEObject; 172 Object result = caseInternalEDataObject(internalEDataObject); 173 if (result == null) result = caseEDataObject(internalEDataObject); 174 if (result == null) result = caseDataObject(internalEDataObject); 175 if (result == null) result = defaultCase(theEObject); 176 return result; 177 } 178 case SDOPackage.EDATA_OBJECT_ANY_TYPE: 179 { 180 EDataObjectAnyType eDataObjectAnyType = (EDataObjectAnyType)theEObject; 181 Object result = caseEDataObjectAnyType(eDataObjectAnyType); 182 if (result == null) result = caseAnyType(eDataObjectAnyType); 183 if (result == null) result = caseEDataObject(eDataObjectAnyType); 184 if (result == null) result = caseDataObject(eDataObjectAnyType); 185 if (result == null) result = defaultCase(theEObject); 186 return result; 187 } 188 case SDOPackage.EDATA_OBJECT_SIMPLE_ANY_TYPE: 189 { 190 EDataObjectSimpleAnyType eDataObjectSimpleAnyType = (EDataObjectSimpleAnyType)theEObject; 191 Object result = caseEDataObjectSimpleAnyType(eDataObjectSimpleAnyType); 192 if (result == null) result = caseSimpleAnyType(eDataObjectSimpleAnyType); 193 if (result == null) result = caseEDataObjectAnyType(eDataObjectSimpleAnyType); 194 if (result == null) result = caseAnyType(eDataObjectSimpleAnyType); 195 if (result == null) result = caseEDataObject(eDataObjectSimpleAnyType); 196 if (result == null) result = caseDataObject(eDataObjectSimpleAnyType); 197 if (result == null) result = defaultCase(theEObject); 198 return result; 199 } 200 default: return defaultCase(theEObject); 201 } 202 } 203 204 215 public Object caseEDataObject(EDataObject object) 216 { 217 return null; 218 } 219 220 231 public Object caseEDataGraph(EDataGraph object) 232 { 233 return null; 234 } 235 236 247 public Object caseEChangeSummary(EChangeSummary object) 248 { 249 return null; 250 } 251 252 263 public Object caseEProperty(EProperty object) 264 { 265 return null; 266 } 267 268 279 public Object caseDataObject(DataObject object) 280 { 281 return null; 282 } 283 284 295 public Object caseESequence(ESequence object) 296 { 297 return null; 298 } 299 300 311 public Object caseDataGraph(DataGraph object) 312 { 313 return null; 314 } 315 316 327 public Object caseChangeSummary(ChangeSummary object) 328 { 329 return null; 330 } 331 332 343 public Object caseEType(EType object) 344 { 345 return null; 346 } 347 348 359 public Object caseType(Type object) 360 { 361 return null; 362 } 363 364 375 public Object caseProperty(Property object) 376 { 377 return null; 378 } 379 380 391 public Object caseSequence(Sequence object) 392 { 393 return null; 394 } 395 396 407 public Object caseEChangeSummarySetting(EChangeSummarySetting object) 408 { 409 return null; 410 } 411 412 423 public Object caseInternalEDataObject(InternalEDataObject object) 424 { 425 return null; 426 } 427 428 439 public Object caseEDataObjectAnyType(EDataObjectAnyType object) 440 { 441 return null; 442 } 443 444 455 public Object caseEDataObjectSimpleAnyType(EDataObjectSimpleAnyType object) 456 { 457 return null; 458 } 459 460 471 public Object caseChangeDescription(ChangeDescription object) 472 { 473 return null; 474 } 475 476 487 public Object caseFeatureChange(FeatureChange object) 488 { 489 return null; 490 } 491 492 503 public Object caseAnyType(AnyType object) 504 { 505 return null; 506 } 507 508 519 public Object caseSimpleAnyType(SimpleAnyType object) 520 { 521 return null; 522 } 523 524 535 public Object caseChangeSummarySetting(ChangeSummary.Setting object) 536 { 537 return null; 538 } 539 540 551 public Object defaultCase(EObject object) 552 { 553 return null; 554 } 555 556 } | Popular Tags |