| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.subsystem.util; |
| 7 | |
| 8 | import java.util.List; |
| 9 | |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.EObject; |
| 12 | |
| 13 | import de.uka.ipd.sdq.identifier.Identifier; |
| 14 | import de.uka.ipd.sdq.pcm.core.composition.ComposedStructure; |
| 15 | import de.uka.ipd.sdq.pcm.core.entity.ComposedProvidingRequiringEntity; |
| 16 | import de.uka.ipd.sdq.pcm.core.entity.Entity; |
| 17 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingEntity; |
| 18 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceProvidingRequiringEntity; |
| 19 | import de.uka.ipd.sdq.pcm.core.entity.InterfaceRequiringEntity; |
| 20 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
| 21 | import de.uka.ipd.sdq.pcm.core.entity.ResourceInterfaceRequiringEntity; |
| 22 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
| 23 | import de.uka.ipd.sdq.pcm.subsystem.*; |
| 24 | import de.uka.ipd.sdq.pcm.subsystem.SubSystem; |
| 25 | import de.uka.ipd.sdq.pcm.subsystem.SubsystemPackage; |
| 26 | |
| 27 | /** |
| 28 | * <!-- begin-user-doc --> |
| 29 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 30 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 31 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 32 | * starting with the actual class of the object |
| 33 | * and proceeding up the inheritance hierarchy |
| 34 | * until a non-null result is returned, |
| 35 | * which is the result of the switch. |
| 36 | * <!-- end-user-doc --> |
| 37 | * @see de.uka.ipd.sdq.pcm.subsystem.SubsystemPackage |
| 38 | * @generated |
| 39 | */ |
| 40 | public class SubsystemSwitch<T> { |
| 41 | /** |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @generated |
| 45 | */ |
| 46 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 47 | |
| 48 | /** |
| 49 | * The cached model package |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @generated |
| 53 | */ |
| 54 | protected static SubsystemPackage modelPackage; |
| 55 | |
| 56 | /** |
| 57 | * Creates an instance of the switch. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @generated |
| 61 | */ |
| 62 | public SubsystemSwitch() { |
| 63 | if (modelPackage == null) { |
| 64 | modelPackage = SubsystemPackage.eINSTANCE; |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 73 | * @generated |
| 74 | */ |
| 75 | public T doSwitch(EObject theEObject) { |
| 76 | return doSwitch(theEObject.eClass(), theEObject); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 84 | * @generated |
| 85 | */ |
| 86 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 87 | if (theEClass.eContainer() == modelPackage) { |
| 88 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 89 | } |
| 90 | else { |
| 91 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 92 | return |
| 93 | eSuperTypes.isEmpty() ? |
| 94 | defaultCase(theEObject) : |
| 95 | doSwitch(eSuperTypes.get(0), theEObject); |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 104 | * @generated |
| 105 | */ |
| 106 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 107 | switch (classifierID) { |
| 108 | case SubsystemPackage.SUB_SYSTEM: { |
| 109 | SubSystem subSystem = (SubSystem)theEObject; |
| 110 | T result = caseSubSystem(subSystem); |
| 111 | if (result == null) result = caseComposedProvidingRequiringEntity(subSystem); |
| 112 | if (result == null) result = caseRepositoryComponent(subSystem); |
| 113 | if (result == null) result = caseComposedStructure(subSystem); |
| 114 | if (result == null) result = caseInterfaceProvidingRequiringEntity(subSystem); |
| 115 | if (result == null) result = caseInterfaceProvidingEntity(subSystem); |
| 116 | if (result == null) result = caseInterfaceRequiringEntity(subSystem); |
| 117 | if (result == null) result = caseIdentifier(subSystem); |
| 118 | if (result == null) result = caseNamedElement(subSystem); |
| 119 | if (result == null) result = caseResourceInterfaceRequiringEntity(subSystem); |
| 120 | if (result == null) result = caseEntity(subSystem); |
| 121 | if (result == null) result = defaultCase(theEObject); |
| 122 | return result; |
| 123 | } |
| 124 | default: return defaultCase(theEObject); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Returns the result of interpreting the object as an instance of '<em>Sub System</em>'. |
| 130 | * <!-- begin-user-doc --> |
| 131 | * This implementation returns null; |
| 132 | * returning a non-null result will terminate the switch. |
| 133 | * <!-- end-user-doc --> |
| 134 | * @param object the target of the switch. |
| 135 | * @return the result of interpreting the object as an instance of '<em>Sub System</em>'. |
| 136 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 137 | * @generated |
| 138 | */ |
| 139 | public T caseSubSystem(SubSystem object) { |
| 140 | return null; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Returns the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 145 | * <!-- begin-user-doc --> |
| 146 | * This implementation returns null; |
| 147 | * returning a non-null result will terminate the switch. |
| 148 | * <!-- end-user-doc --> |
| 149 | * @param object the target of the switch. |
| 150 | * @return the result of interpreting the object as an instance of '<em>Identifier</em>'. |
| 151 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 152 | * @generated |
| 153 | */ |
| 154 | public T caseIdentifier(Identifier object) { |
| 155 | return null; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Returns the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 160 | * <!-- begin-user-doc --> |
| 161 | * This implementation returns null; |
| 162 | * returning a non-null result will terminate the switch. |
| 163 | * <!-- end-user-doc --> |
| 164 | * @param object the target of the switch. |
| 165 | * @return the result of interpreting the object as an instance of '<em>Named Element</em>'. |
| 166 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 167 | * @generated |
| 168 | */ |
| 169 | public T caseNamedElement(NamedElement object) { |
| 170 | return null; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Returns the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 175 | * <!-- begin-user-doc --> |
| 176 | * This implementation returns null; |
| 177 | * returning a non-null result will terminate the switch. |
| 178 | * <!-- end-user-doc --> |
| 179 | * @param object the target of the switch. |
| 180 | * @return the result of interpreting the object as an instance of '<em>Entity</em>'. |
| 181 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 182 | * @generated |
| 183 | */ |
| 184 | public T caseEntity(Entity object) { |
| 185 | return null; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Returns the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
| 190 | * <!-- begin-user-doc --> |
| 191 | * This implementation returns null; |
| 192 | * returning a non-null result will terminate the switch. |
| 193 | * <!-- end-user-doc --> |
| 194 | * @param object the target of the switch. |
| 195 | * @return the result of interpreting the object as an instance of '<em>Composed Structure</em>'. |
| 196 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 197 | * @generated |
| 198 | */ |
| 199 | public T caseComposedStructure(ComposedStructure object) { |
| 200 | return null; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
| 205 | * <!-- begin-user-doc --> |
| 206 | * This implementation returns null; |
| 207 | * returning a non-null result will terminate the switch. |
| 208 | * <!-- end-user-doc --> |
| 209 | * @param object the target of the switch. |
| 210 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Entity</em>'. |
| 211 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 212 | * @generated |
| 213 | */ |
| 214 | public T caseInterfaceProvidingEntity(InterfaceProvidingEntity object) { |
| 215 | return null; |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Returns the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
| 220 | * <!-- begin-user-doc --> |
| 221 | * This implementation returns null; |
| 222 | * returning a non-null result will terminate the switch. |
| 223 | * <!-- end-user-doc --> |
| 224 | * @param object the target of the switch. |
| 225 | * @return the result of interpreting the object as an instance of '<em>Interface Requiring Entity</em>'. |
| 226 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 227 | * @generated |
| 228 | */ |
| 229 | public T caseInterfaceRequiringEntity(InterfaceRequiringEntity object) { |
| 230 | return null; |
| 231 | } |
| 232 | |
| 233 | /** |
| 234 | * Returns the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
| 235 | * <!-- begin-user-doc --> |
| 236 | * This implementation returns null; |
| 237 | * returning a non-null result will terminate the switch. |
| 238 | * <!-- end-user-doc --> |
| 239 | * @param object the target of the switch. |
| 240 | * @return the result of interpreting the object as an instance of '<em>Resource Interface Requiring Entity</em>'. |
| 241 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 242 | * @generated |
| 243 | */ |
| 244 | public T caseResourceInterfaceRequiringEntity(ResourceInterfaceRequiringEntity object) { |
| 245 | return null; |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * Returns the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
| 250 | * <!-- begin-user-doc --> |
| 251 | * This implementation returns null; |
| 252 | * returning a non-null result will terminate the switch. |
| 253 | * <!-- end-user-doc --> |
| 254 | * @param object the target of the switch. |
| 255 | * @return the result of interpreting the object as an instance of '<em>Interface Providing Requiring Entity</em>'. |
| 256 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 257 | * @generated |
| 258 | */ |
| 259 | public T caseInterfaceProvidingRequiringEntity(InterfaceProvidingRequiringEntity object) { |
| 260 | return null; |
| 261 | } |
| 262 | |
| 263 | /** |
| 264 | * Returns the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
| 265 | * <!-- begin-user-doc --> |
| 266 | * This implementation returns null; |
| 267 | * returning a non-null result will terminate the switch. |
| 268 | * <!-- end-user-doc --> |
| 269 | * @param object the target of the switch. |
| 270 | * @return the result of interpreting the object as an instance of '<em>Composed Providing Requiring Entity</em>'. |
| 271 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 272 | * @generated |
| 273 | */ |
| 274 | public T caseComposedProvidingRequiringEntity(ComposedProvidingRequiringEntity object) { |
| 275 | return null; |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Returns the result of interpreting the object as an instance of '<em>Component</em>'. |
| 280 | * <!-- begin-user-doc --> |
| 281 | * This implementation returns null; |
| 282 | * returning a non-null result will terminate the switch. |
| 283 | * <!-- end-user-doc --> |
| 284 | * @param object the target of the switch. |
| 285 | * @return the result of interpreting the object as an instance of '<em>Component</em>'. |
| 286 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 287 | * @generated |
| 288 | */ |
| 289 | public T caseRepositoryComponent(RepositoryComponent object) { |
| 290 | return null; |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 295 | * <!-- begin-user-doc --> |
| 296 | * This implementation returns null; |
| 297 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 298 | * <!-- end-user-doc --> |
| 299 | * @param object the target of the switch. |
| 300 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 301 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 302 | * @generated |
| 303 | */ |
| 304 | public T defaultCase(EObject object) { |
| 305 | return null; |
| 306 | } |
| 307 | |
| 308 | } //SubsystemSwitch |