| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.featureconfig.util; |
| 8 | |
| 9 | import de.uka.ipd.sdq.featureconfig.*; |
| 10 | import java.util.List; |
| 11 | |
| 12 | import org.eclipse.emf.ecore.EClass; |
| 13 | import org.eclipse.emf.ecore.EObject; |
| 14 | |
| 15 | import de.uka.ipd.sdq.featureconfig.AttributeValue; |
| 16 | import de.uka.ipd.sdq.featureconfig.ConfigNode; |
| 17 | import de.uka.ipd.sdq.featureconfig.Configuration; |
| 18 | import de.uka.ipd.sdq.featureconfig.DoubleAttributeValue; |
| 19 | import de.uka.ipd.sdq.featureconfig.FeatureConfig; |
| 20 | import de.uka.ipd.sdq.featureconfig.IntegerAttributeValue; |
| 21 | import de.uka.ipd.sdq.featureconfig.featureconfigPackage; |
| 22 | import de.uka.ipd.sdq.featuremodel.NamedElement; |
| 23 | import de.uka.ipd.sdq.identifier.Identifier; |
| 24 | |
| 25 | /** |
| 26 | * <!-- begin-user-doc --> |
| 27 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 28 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 29 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 30 | * starting with the actual class of the object |
| 31 | * and proceeding up the inheritance hierarchy |
| 32 | * until a non-null result is returned, |
| 33 | * which is the result of the switch. |
| 34 | * <!-- end-user-doc --> |
| 35 | * @see de.uka.ipd.sdq.featureconfig.featureconfigPackage |
| 36 | * @generated |
| 37 | */ |
| 38 | public class featureconfigSwitch<T> { |
| 39 | /** |
| 40 | * The cached model package |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @generated |
| 44 | */ |
| 45 | protected static featureconfigPackage modelPackage; |
| 46 | |
| 47 | /** |
| 48 | * Creates an instance of the switch. |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @generated |
| 52 | */ |
| 53 | public featureconfigSwitch() { |
| 54 | if (modelPackage == null) { |
| 55 | modelPackage = featureconfigPackage.eINSTANCE; |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 64 | * @generated |
| 65 | */ |
| 66 | public T doSwitch(EObject theEObject) { |
| 67 | return doSwitch(theEObject.eClass(), theEObject); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 75 | * @generated |
| 76 | */ |
| 77 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 78 | if (theEClass.eContainer() == modelPackage) { |
| 79 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 80 | } |
| 81 | else { |
| 82 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 83 | return |
| 84 | eSuperTypes.isEmpty() ? |
| 85 | defaultCase(theEObject) : |
| 86 | doSwitch(eSuperTypes.get(0), theEObject); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 92 | * <!-- begin-user-doc --> |
| 93 | * <!-- end-user-doc --> |
| 94 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 95 | * @generated |
| 96 | */ |
| 97 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 98 | switch (classifierID) { |
| 99 | case featureconfigPackage.CONFIG_NODE: { |
| 100 | ConfigNode configNode = (ConfigNode)theEObject; |
| 101 | T result = caseConfigNode(configNode); |
| 102 | if (result == null) result = defaultCase(theEObject); |
| 103 | return result; |
| 104 | } |
| 105 | case featureconfigPackage.ATTRIBUTE_VALUE: { |
| 106 | AttributeValue attributeValue = (AttributeValue)theEObject; |
| 107 | T result = caseAttributeValue(attributeValue); |
| 108 | if (result == null) result = caseNamedElement(attributeValue); |
| 109 | if (result == null) result = caseIdentifier(attributeValue); |
| 110 | if (result == null) result = defaultCase(theEObject); |
| 111 | return result; |
| 112 | } |
| 113 | case featureconfigPackage.FEATURE_CONFIG: { |
| 114 | FeatureConfig featureConfig = (FeatureConfig)theEObject; |
| 115 | T result = caseFeatureConfig(featureConfig); |
| 116 | if (result == null) result = defaultCase(theEObject); |
| 117 | return result; |
| 118 | } |
| 119 | case featureconfigPackage.CONFIGURATION: { |
| 120 | Configuration configuration = (Configuration)theEObject; |
| 121 | T result = caseConfiguration(configuration); |
| 122 | if (result == null) result = defaultCase(theEObject); |
| 123 | return result; |
| 124 | } |
| 125 | case featureconfigPackage.INTEGER_ATTRIBUTE_VALUE: { |
| 126 | IntegerAttributeValue integerAttributeValue = (IntegerAttributeValue)theEObject; |
| 127 | T result = caseIntegerAttributeValue(integerAttributeValue); |
| 128 | if (result == null) result = caseAttributeValue(integerAttributeValue); |
| 129 | if (result == null) result = caseNamedElement(integerAttributeValue); |
| 130 | if (result == null) result = caseIdentifier(integerAttributeValue); |
| 131 | if (result == null) result = defaultCase(theEObject); |
| 132 | return result; |
| 133 | } |
| 134 | case featureconfigPackage.DOUBLE_ATTRIBUTE_VALUE: { |
| 135 | DoubleAttributeValue doubleAttributeValue = (DoubleAttributeValue)theEObject; |
| 136 | T result = caseDoubleAttributeValue(doubleAttributeValue); |
| 137 | if (result == null) result = caseAttributeValue(doubleAttributeValue); |
| 138 | if (result == null) result = caseNamedElement(doubleAttributeValue); |
| 139 | if (result == null) result = caseIdentifier(doubleAttributeValue); |
| 140 | if (result == null) result = defaultCase(theEObject); |
| 141 | return result; |
| 142 | } |
| 143 | case featureconfigPackage.STRING_ATTRIBUTE_VALUE: { |
| 144 | StringAttributeValue stringAttributeValue = (StringAttributeValue)theEObject; |
| 145 | T result = caseStringAttributeValue(stringAttributeValue); |
| 146 | if (result == null) result = caseAttributeValue(stringAttributeValue); |
| 147 | if (result == null) result = caseNamedElement(stringAttributeValue); |
| 148 | if (result == null) result = caseIdentifier(stringAttributeValue); |
| 149 | if (result == null) result = defaultCase(theEObject); |
| 150 | return result; |
| 151 | } |
| 152 | case featureconfigPackage.EXTERNAL_OBJECT_ATTRIBUTE_VALUE: { |
| 153 | ExternalObjectAttributeValue externalObjectAttributeValue = (ExternalObjectAttributeValue)theEObject; |
| 154 | T result = caseExternalObjectAttributeValue(externalObjectAttributeValue); |
| 155 | if (result == null) result = caseAttributeValue(externalObjectAttributeValue); |
| 156 | if (result == null) result = caseNamedElement(externalObjectAttributeValue); |
| 157 | if (result == null) result = caseIdentifier(externalObjectAttributeValue); |
| 158 | if (result == null) result = defaultCase(theEObject); |
| 159 | return result; |
| 160 | } |
| 161 | default: return defaultCase(theEObject); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * Returns the result of interpreting the object as an instance of '<em>Config Node</em>'. |
| 167 | * <!-- begin-user-doc --> |
| 168 | * This implementation returns null; |
| 169 | * returning a non-null result will terminate the switch. |
| 170 | * <!-- end-user-doc --> |
| 171 | * @param object the target of the switch. |
| 172 | * @return the result of interpreting the object as an instance of '<em>Config Node</em>'. |
| 173 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 174 | * @generated |
| 175 | */ |
| 176 | public T caseConfigNode(ConfigNode object) { |
| 177 | return null; |
| 178 | } |
| 179 | |
| 180 | /** |
| 181 | * Returns the result of interpreting the object as an instance of '<em>Attribute Value</em>'. |
| 182 | * <!-- begin-user-doc --> |
| 183 | * This implementation returns null; |
| 184 | * returning a non-null result will terminate the switch. |
| 185 | * <!-- end-user-doc --> |
| 186 | * @param object the target of the switch. |
| 187 | * @return the result of interpreting the object as an instance of '<em>Attribute Value</em>'. |
| 188 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 189 | * @generated |
| 190 | */ |
| 191 | public T caseAttributeValue(AttributeValue object) { |
| 192 | return null; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Returns the result of interpreting the object as an instance of '<em>Feature Config</em>'. |
| 197 | * <!-- begin-user-doc --> |
| 198 | * This implementation returns null; |
| 199 | * returning a non-null result will terminate the switch. |
| 200 | * <!-- end-user-doc --> |
| 201 | * @param object the target of the switch. |
| 202 | * @return the result of interpreting the object as an instance of '<em>Feature Config</em>'. |
| 203 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 204 | * @generated |
| 205 | */ |
| 206 | public T caseFeatureConfig(FeatureConfig object) { |
| 207 | return null; |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * Returns the result of interpreting the object as an instance of '<em>Configuration</em>'. |
| 212 | * <!-- begin-user-doc --> |
| 213 | * This implementation returns null; |
| 214 | * returning a non-null result will terminate the switch. |
| 215 | * <!-- end-user-doc --> |
| 216 | * @param object the target of the switch. |
| 217 | * @return the result of interpreting the object as an instance of '<em>Configuration</em>'. |
| 218 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 219 | * @generated |
| 220 | */ |
| 221 | public T caseConfiguration(Configuration object) { |
| 222 | return null; |
| 223 | } |
| 224 | |
| 225 | /** |
| 226 | * Returns the result of interpreting the object as an instance of '<em>Integer Attribute Value</em>'. |
| 227 | * <!-- begin-user-doc --> |
| 228 | * This implementation returns null; |
| 229 | * returning a non-null result will terminate the switch. |
| 230 | * <!-- end-user-doc --> |
| 231 | * @param object the target of the switch. |
| 232 | * @return the result of interpreting the object as an instance of '<em>Integer Attribute Value</em>'. |
| 233 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 234 | * @generated |
| 235 | */ |
| 236 | public T caseIntegerAttributeValue(IntegerAttributeValue object) { |
| 237 | return null; |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * Returns the result of interpreting the object as an instance of '<em>Double Attribute Value</em>'. |
| 242 | * <!-- begin-user-doc --> |
| 243 | * This implementation returns null; |
| 244 | * returning a non-null result will terminate the switch. |
| 245 | * <!-- end-user-doc --> |
| 246 | * @param object the target of the switch. |
| 247 | * @return the result of interpreting the object as an instance of '<em>Double Attribute Value</em>'. |
| 248 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 249 | * @generated |
| 250 | */ |
| 251 | public T caseDoubleAttributeValue(DoubleAttributeValue object) { |
| 252 | return null; |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * Returns the result of interpreting the object as an instance of '<em>String Attribute Value</em>'. |
| 257 | * <!-- begin-user-doc --> |
| 258 | * This implementation returns null; |
| 259 | * returning a non-null result will terminate the switch. |
| 260 | * <!-- end-user-doc --> |
| 261 | * @param object the target of the switch. |
| 262 | * @return the result of interpreting the object as an instance of '<em>String Attribute Value</em>'. |
| 263 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 264 | * @generated |
| 265 | */ |
| 266 | public T caseStringAttributeValue(StringAttributeValue object) { |
| 267 | return null; |
| 268 | } |
| 269 | |
| 270 | /** |
| 271 | * Returns the result of interpreting the object as an instance of '<em>External Object Attribute Value</em>'. |
| 272 | * <!-- begin-user-doc --> |
| 273 | * This implementation returns null; |
| 274 | * returning a non-null result will terminate the switch. |
| 275 | * <!-- end-user-doc --> |
| 276 | * @param object the target of the switch. |
| 277 | * @return the result of interpreting the object as an instance of '<em>External Object Attribute Value</em>'. |
| 278 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 279 | * @generated |
| 280 | */ |
| 281 | public T caseExternalObjectAttributeValue(ExternalObjectAttributeValue object) { |
| 282 | return null; |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 287 | * <!-- begin-user-doc --> |
| 288 | * This implementation returns null; |
| 289 | * returning a non-null result will terminate the switch. |
| 290 | * <!-- end-user-doc --> |
| 291 | * @param object the target of the switch. |
| 292 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 293 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 294 | * @generated |
| 295 | */ |
| 296 | public T caseIdentifier(Identifier object) { |
| 297 | return null; |
| 298 | } |
| 299 | |
| 300 | /** |
| 301 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 302 | * <!-- begin-user-doc --> |
| 303 | * This implementation returns null; |
| 304 | * returning a non-null result will terminate the switch. |
| 305 | * <!-- end-user-doc --> |
| 306 | * @param object the target of the switch. |
| 307 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 308 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 309 | * @generated |
| 310 | */ |
| 311 | public T caseNamedElement(NamedElement object) { |
| 312 | return null; |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 317 | * <!-- begin-user-doc --> |
| 318 | * This implementation returns null; |
| 319 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 320 | * <!-- end-user-doc --> |
| 321 | * @param object the target of the switch. |
| 322 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 323 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 324 | * @generated |
| 325 | */ |
| 326 | public T defaultCase(EObject object) { |
| 327 | return null; |
| 328 | } |
| 329 | |
| 330 | } //featureconfigSwitch |