1 17 package org.eclipse.emf.codegen.ecore.genmodel.util; 18 19 20 import java.util.List ; 21 22 import org.eclipse.emf.codegen.ecore.genmodel.*; 23 import org.eclipse.emf.ecore.EClass; 24 import org.eclipse.emf.ecore.EObject; 25 26 27 40 public class GenModelSwitch { 41 47 protected static GenModelPackage modelPackage; 48 49 55 public GenModelSwitch() 56 { 57 if (modelPackage == null) 58 { 59 modelPackage = GenModelPackage.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 GenModelPackage.GEN_MODEL: 110 { 111 GenModel genModel = (GenModel)theEObject; 112 Object result = caseGenModel(genModel); 113 if (result == null) result = caseGenBase(genModel); 114 if (result == null) result = defaultCase(theEObject); 115 return result; 116 } 117 case GenModelPackage.GEN_PACKAGE: 118 { 119 GenPackage genPackage = (GenPackage)theEObject; 120 Object result = caseGenPackage(genPackage); 121 if (result == null) result = caseGenBase(genPackage); 122 if (result == null) result = defaultCase(theEObject); 123 return result; 124 } 125 case GenModelPackage.GEN_CLASS: 126 { 127 GenClass genClass = (GenClass)theEObject; 128 Object result = caseGenClass(genClass); 129 if (result == null) result = caseGenClassifier(genClass); 130 if (result == null) result = caseGenBase(genClass); 131 if (result == null) result = defaultCase(theEObject); 132 return result; 133 } 134 case GenModelPackage.GEN_FEATURE: 135 { 136 GenFeature genFeature = (GenFeature)theEObject; 137 Object result = caseGenFeature(genFeature); 138 if (result == null) result = caseGenTypedElement(genFeature); 139 if (result == null) result = caseGenBase(genFeature); 140 if (result == null) result = defaultCase(theEObject); 141 return result; 142 } 143 case GenModelPackage.GEN_BASE: 144 { 145 GenBase genBase = (GenBase)theEObject; 146 Object result = caseGenBase(genBase); 147 if (result == null) result = defaultCase(theEObject); 148 return result; 149 } 150 case GenModelPackage.GEN_ENUM: 151 { 152 GenEnum genEnum = (GenEnum)theEObject; 153 Object result = caseGenEnum(genEnum); 154 if (result == null) result = caseGenDataType(genEnum); 155 if (result == null) result = caseGenClassifier(genEnum); 156 if (result == null) result = caseGenBase(genEnum); 157 if (result == null) result = defaultCase(theEObject); 158 return result; 159 } 160 case GenModelPackage.GEN_ENUM_LITERAL: 161 { 162 GenEnumLiteral genEnumLiteral = (GenEnumLiteral)theEObject; 163 Object result = caseGenEnumLiteral(genEnumLiteral); 164 if (result == null) result = caseGenBase(genEnumLiteral); 165 if (result == null) result = defaultCase(theEObject); 166 return result; 167 } 168 case GenModelPackage.GEN_CLASSIFIER: 169 { 170 GenClassifier genClassifier = (GenClassifier)theEObject; 171 Object result = caseGenClassifier(genClassifier); 172 if (result == null) result = caseGenBase(genClassifier); 173 if (result == null) result = defaultCase(theEObject); 174 return result; 175 } 176 case GenModelPackage.GEN_DATA_TYPE: 177 { 178 GenDataType genDataType = (GenDataType)theEObject; 179 Object result = caseGenDataType(genDataType); 180 if (result == null) result = caseGenClassifier(genDataType); 181 if (result == null) result = caseGenBase(genDataType); 182 if (result == null) result = defaultCase(theEObject); 183 return result; 184 } 185 case GenModelPackage.GEN_OPERATION: 186 { 187 GenOperation genOperation = (GenOperation)theEObject; 188 Object result = caseGenOperation(genOperation); 189 if (result == null) result = caseGenTypedElement(genOperation); 190 if (result == null) result = caseGenBase(genOperation); 191 if (result == null) result = defaultCase(theEObject); 192 return result; 193 } 194 case GenModelPackage.GEN_PARAMETER: 195 { 196 GenParameter genParameter = (GenParameter)theEObject; 197 Object result = caseGenParameter(genParameter); 198 if (result == null) result = caseGenTypedElement(genParameter); 199 if (result == null) result = caseGenBase(genParameter); 200 if (result == null) result = defaultCase(theEObject); 201 return result; 202 } 203 case GenModelPackage.GEN_TYPED_ELEMENT: 204 { 205 GenTypedElement genTypedElement = (GenTypedElement)theEObject; 206 Object result = caseGenTypedElement(genTypedElement); 207 if (result == null) result = caseGenBase(genTypedElement); 208 if (result == null) result = defaultCase(theEObject); 209 return result; 210 } 211 default: return defaultCase(theEObject); 212 } 213 } 214 215 226 public Object caseGenModel(GenModel object) 227 { 228 return null; 229 } 230 231 242 public Object caseGenPackage(GenPackage object) 243 { 244 return null; 245 } 246 247 258 public Object caseGenClass(GenClass object) 259 { 260 return null; 261 } 262 263 274 public Object caseGenFeature(GenFeature object) 275 { 276 return null; 277 } 278 279 290 public Object caseGenBase(GenBase object) 291 { 292 return null; 293 } 294 295 306 public Object caseGenEnum(GenEnum object) 307 { 308 return null; 309 } 310 311 322 public Object caseGenEnumLiteral(GenEnumLiteral object) 323 { 324 return null; 325 } 326 327 338 public Object caseGenClassifier(GenClassifier object) 339 { 340 return null; 341 } 342 343 354 public Object caseGenDataType(GenDataType object) 355 { 356 return null; 357 } 358 359 370 public Object caseGenOperation(GenOperation object) 371 { 372 return null; 373 } 374 375 386 public Object caseGenParameter(GenParameter object) 387 { 388 return null; 389 } 390 391 402 public Object caseGenTypedElement(GenTypedElement object) 403 { 404 return null; 405 } 406 407 418 public Object defaultCase(EObject object) 419 { 420 return null; 421 } 422 423 } | Popular Tags |