| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.qosannotations.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.entity.Entity; |
| 15 | import de.uka.ipd.sdq.pcm.core.entity.NamedElement; |
| 16 | import de.uka.ipd.sdq.pcm.qosannotations.*; |
| 17 | import de.uka.ipd.sdq.pcm.qosannotations.QoSAnnotations; |
| 18 | import de.uka.ipd.sdq.pcm.qosannotations.QosannotationsPackage; |
| 19 | import de.uka.ipd.sdq.pcm.qosannotations.SpecifiedOutputParameterAbstraction; |
| 20 | import de.uka.ipd.sdq.pcm.qosannotations.SpecifiedQoSAnnotation; |
| 21 | |
| 22 | /** |
| 23 | * <!-- begin-user-doc --> |
| 24 | * The <b>Switch</b> for the model's inheritance hierarchy. |
| 25 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
| 26 | * to invoke the <code>caseXXX</code> method for each class of the model, |
| 27 | * starting with the actual class of the object |
| 28 | * and proceeding up the inheritance hierarchy |
| 29 | * until a non-null result is returned, |
| 30 | * which is the result of the switch. |
| 31 | * <!-- end-user-doc --> |
| 32 | * @see de.uka.ipd.sdq.pcm.qosannotations.QosannotationsPackage |
| 33 | * @generated |
| 34 | */ |
| 35 | public class QosannotationsSwitch<T> { |
| 36 | /** |
| 37 | * <!-- begin-user-doc --> |
| 38 | * <!-- end-user-doc --> |
| 39 | * @generated |
| 40 | */ |
| 41 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 42 | |
| 43 | /** |
| 44 | * The cached model package |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @generated |
| 48 | */ |
| 49 | protected static QosannotationsPackage modelPackage; |
| 50 | |
| 51 | /** |
| 52 | * Creates an instance of the switch. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @generated |
| 56 | */ |
| 57 | public QosannotationsSwitch() { |
| 58 | if (modelPackage == null) { |
| 59 | modelPackage = QosannotationsPackage.eINSTANCE; |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 65 | * <!-- begin-user-doc --> |
| 66 | * <!-- end-user-doc --> |
| 67 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 68 | * @generated |
| 69 | */ |
| 70 | public T doSwitch(EObject theEObject) { |
| 71 | return doSwitch(theEObject.eClass(), theEObject); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 76 | * <!-- begin-user-doc --> |
| 77 | * <!-- end-user-doc --> |
| 78 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 79 | * @generated |
| 80 | */ |
| 81 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
| 82 | if (theEClass.eContainer() == modelPackage) { |
| 83 | return doSwitch(theEClass.getClassifierID(), theEObject); |
| 84 | } |
| 85 | else { |
| 86 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
| 87 | return |
| 88 | eSuperTypes.isEmpty() ? |
| 89 | defaultCase(theEObject) : |
| 90 | doSwitch(eSuperTypes.get(0), theEObject); |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | /** |
| 95 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
| 99 | * @generated |
| 100 | */ |
| 101 | protected T doSwitch(int classifierID, EObject theEObject) { |
| 102 | switch (classifierID) { |
| 103 | case QosannotationsPackage.SPECIFIED_QO_SANNOTATION: { |
| 104 | SpecifiedQoSAnnotation specifiedQoSAnnotation = (SpecifiedQoSAnnotation)theEObject; |
| 105 | T result = caseSpecifiedQoSAnnotation(specifiedQoSAnnotation); |
| 106 | if (result == null) result = defaultCase(theEObject); |
| 107 | return result; |
| 108 | } |
| 109 | case QosannotationsPackage.QO_SANNOTATIONS: { |
| 110 | QoSAnnotations qoSAnnotations = (QoSAnnotations)theEObject; |
| 111 | T result = caseQoSAnnotations(qoSAnnotations); |
| 112 | if (result == null) result = caseEntity(qoSAnnotations); |
| 113 | if (result == null) result = caseIdentifier(qoSAnnotations); |
| 114 | if (result == null) result = caseNamedElement(qoSAnnotations); |
| 115 | if (result == null) result = defaultCase(theEObject); |
| 116 | return result; |
| 117 | } |
| 118 | case QosannotationsPackage.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION: { |
| 119 | SpecifiedOutputParameterAbstraction specifiedOutputParameterAbstraction = (SpecifiedOutputParameterAbstraction)theEObject; |
| 120 | T result = caseSpecifiedOutputParameterAbstraction(specifiedOutputParameterAbstraction); |
| 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>Specified Qo SAnnotation</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>Specified Qo SAnnotation</em>'. |
| 136 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 137 | * @generated |
| 138 | */ |
| 139 | public T caseSpecifiedQoSAnnotation(SpecifiedQoSAnnotation object) { |
| 140 | return null; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Returns the result of interpreting the object as an instance of '<em>Qo SAnnotations</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>Qo SAnnotations</em>'. |
| 151 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 152 | * @generated |
| 153 | */ |
| 154 | public T caseQoSAnnotations(QoSAnnotations object) { |
| 155 | return null; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * Returns the result of interpreting the object as an instance of '<em>Specified Output Parameter Abstraction</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>Specified Output Parameter Abstraction</em>'. |
| 166 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 167 | * @generated |
| 168 | */ |
| 169 | public T caseSpecifiedOutputParameterAbstraction(SpecifiedOutputParameterAbstraction object) { |
| 170 | return null; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Returns the result of interpreting the object as an instance of '<em>Identifier</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>Identifier</em>'. |
| 181 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 182 | * @generated |
| 183 | */ |
| 184 | public T caseIdentifier(Identifier object) { |
| 185 | return null; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * Returns the result of interpreting the object as an instance of '<em>Named Element</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>Named Element</em>'. |
| 196 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 197 | * @generated |
| 198 | */ |
| 199 | public T caseNamedElement(NamedElement object) { |
| 200 | return null; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * Returns the result of interpreting the object as an instance of '<em>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>Entity</em>'. |
| 211 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
| 212 | * @generated |
| 213 | */ |
| 214 | public T caseEntity(Entity object) { |
| 215 | return null; |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
| 220 | * <!-- begin-user-doc --> |
| 221 | * This implementation returns null; |
| 222 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
| 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>EObject</em>'. |
| 226 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
| 227 | * @generated |
| 228 | */ |
| 229 | public T defaultCase(EObject object) { |
| 230 | return null; |
| 231 | } |
| 232 | |
| 233 | } //QosannotationsSwitch |