1 17 package org.eclipse.emf.ecore.change.util; 18 19 import java.util.List ; 20 import java.util.Map ; 21 22 import org.eclipse.emf.ecore.EClass; 23 import org.eclipse.emf.ecore.EObject; 24 import org.eclipse.emf.ecore.change.*; 25 26 27 40 public class ChangeSwitch { 41 47 protected static ChangePackage modelPackage; 48 49 55 public ChangeSwitch() 56 { 57 if (modelPackage == null) 58 { 59 modelPackage = ChangePackage.eINSTANCE; 60 } 61 } 62 63 70 public Object doSwitch(EObject theEObject) 71 { 72 return doSwitch(theEObject.eClass(), theEObject); 73 } 74 75 82 protected Object doSwitch(EClass theEClass, EObject theEObject) 83 { 84 if (theEClass.eContainer() == modelPackage) 85 { 86 return doSwitch(theEClass.getClassifierID(), theEObject); 87 } 88 else 89 { 90 List eSuperTypes = theEClass.getESuperTypes(); 91 return 92 eSuperTypes.isEmpty() ? 93 defaultCase(theEObject) : 94 doSwitch((EClass)eSuperTypes.get(0), theEObject); 95 } 96 } 97 98 105 protected Object doSwitch(int classifierID, EObject theEObject) 106 { 107 switch (classifierID) 108 { 109 case ChangePackage.CHANGE_DESCRIPTION: 110 { 111 ChangeDescription changeDescription = (ChangeDescription)theEObject; 112 Object result = caseChangeDescription(changeDescription); 113 if (result == null) result = defaultCase(theEObject); 114 return result; 115 } 116 case ChangePackage.EOBJECT_TO_CHANGES_MAP_ENTRY: 117 { 118 Map.Entry eObjectToChangesMapEntry = (Map.Entry )theEObject; 119 Object result = caseEObjectToChangesMapEntry(eObjectToChangesMapEntry); 120 if (result == null) result = defaultCase(theEObject); 121 return result; 122 } 123 case ChangePackage.FEATURE_CHANGE: 124 { 125 FeatureChange featureChange = (FeatureChange)theEObject; 126 Object result = caseFeatureChange(featureChange); 127 if (result == null) result = defaultCase(theEObject); 128 return result; 129 } 130 case ChangePackage.LIST_CHANGE: 131 { 132 ListChange listChange = (ListChange)theEObject; 133 Object result = caseListChange(listChange); 134 if (result == null) result = defaultCase(theEObject); 135 return result; 136 } 137 case ChangePackage.RESOURCE_CHANGE: 138 { 139 ResourceChange resourceChange = (ResourceChange)theEObject; 140 Object result = caseResourceChange(resourceChange); 141 if (result == null) result = defaultCase(theEObject); 142 return result; 143 } 144 case ChangePackage.FEATURE_MAP_ENTRY: 145 { 146 FeatureMapEntry featureMapEntry = (FeatureMapEntry)theEObject; 147 Object result = caseFeatureMapEntry(featureMapEntry); 148 if (result == null) result = defaultCase(theEObject); 149 return result; 150 } 151 default: return defaultCase(theEObject); 152 } 153 } 154 155 166 public Object caseChangeDescription(ChangeDescription object) 167 { 168 return null; 169 } 170 171 182 public Object caseEObjectToChangesMapEntry(Map.Entry object) 183 { 184 return null; 185 } 186 187 198 public Object caseFeatureChange(FeatureChange object) 199 { 200 return null; 201 } 202 203 214 public Object caseListChange(ListChange object) 215 { 216 return null; 217 } 218 219 230 public Object caseResourceChange(ResourceChange object) 231 { 232 return null; 233 } 234 235 246 public Object caseFeatureMapEntry(FeatureMapEntry object) 247 { 248 return null; 249 } 250 251 262 public Object defaultCase(EObject object) 263 { 264 return null; 265 } 266 267 } | Popular Tags |