1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.uka.ipd.sdq.pcm.designdecision.QualityProperties.util; |
8 | |
9 | import de.uka.ipd.sdq.pcm.designdecision.QualityProperties.*; |
10 | |
11 | import java.util.List; |
12 | |
13 | import org.eclipse.emf.ecore.EClass; |
14 | import org.eclipse.emf.ecore.EObject; |
15 | |
16 | /** |
17 | * <!-- begin-user-doc --> |
18 | * The <b>Switch</b> for the model's inheritance hierarchy. |
19 | * It supports the call {@link #doSwitch(EObject) doSwitch(object)} |
20 | * to invoke the <code>caseXXX</code> method for each class of the model, |
21 | * starting with the actual class of the object |
22 | * and proceeding up the inheritance hierarchy |
23 | * until a non-null result is returned, |
24 | * which is the result of the switch. |
25 | * <!-- end-user-doc --> |
26 | * @see de.uka.ipd.sdq.pcm.designdecision.QualityProperties.QualityPropertiesPackage |
27 | * @generated |
28 | */ |
29 | public class QualityPropertiesSwitch<T> { |
30 | /** |
31 | * The cached model package |
32 | * <!-- begin-user-doc --> |
33 | * <!-- end-user-doc --> |
34 | * @generated |
35 | */ |
36 | protected static QualityPropertiesPackage modelPackage; |
37 | |
38 | /** |
39 | * Creates an instance of the switch. |
40 | * <!-- begin-user-doc --> |
41 | * <!-- end-user-doc --> |
42 | * @generated |
43 | */ |
44 | public QualityPropertiesSwitch() { |
45 | if (modelPackage == null) { |
46 | modelPackage = QualityPropertiesPackage.eINSTANCE; |
47 | } |
48 | } |
49 | |
50 | /** |
51 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
52 | * <!-- begin-user-doc --> |
53 | * <!-- end-user-doc --> |
54 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
55 | * @generated |
56 | */ |
57 | public T doSwitch(EObject theEObject) { |
58 | return doSwitch(theEObject.eClass(), theEObject); |
59 | } |
60 | |
61 | /** |
62 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
63 | * <!-- begin-user-doc --> |
64 | * <!-- end-user-doc --> |
65 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
66 | * @generated |
67 | */ |
68 | protected T doSwitch(EClass theEClass, EObject theEObject) { |
69 | if (theEClass.eContainer() == modelPackage) { |
70 | return doSwitch(theEClass.getClassifierID(), theEObject); |
71 | } |
72 | else { |
73 | List<EClass> eSuperTypes = theEClass.getESuperTypes(); |
74 | return |
75 | eSuperTypes.isEmpty() ? |
76 | defaultCase(theEObject) : |
77 | doSwitch(eSuperTypes.get(0), theEObject); |
78 | } |
79 | } |
80 | |
81 | /** |
82 | * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result. |
83 | * <!-- begin-user-doc --> |
84 | * <!-- end-user-doc --> |
85 | * @return the first non-null result returned by a <code>caseXXX</code> call. |
86 | * @generated |
87 | */ |
88 | protected T doSwitch(int classifierID, EObject theEObject) { |
89 | switch (classifierID) { |
90 | case QualityPropertiesPackage.NUMERIC_QUALITY_PROPERTY: { |
91 | NumericQualityProperty numericQualityProperty = (NumericQualityProperty)theEObject; |
92 | T result = caseNumericQualityProperty(numericQualityProperty); |
93 | if (result == null) result = caseQualityProperty(numericQualityProperty); |
94 | if (result == null) result = defaultCase(theEObject); |
95 | return result; |
96 | } |
97 | case QualityPropertiesPackage.CONFIDENCE_INTERVAL: { |
98 | ConfidenceInterval confidenceInterval = (ConfidenceInterval)theEObject; |
99 | T result = caseConfidenceInterval(confidenceInterval); |
100 | if (result == null) result = defaultCase(theEObject); |
101 | return result; |
102 | } |
103 | case QualityPropertiesPackage.ELEMENT_QUALITY_PROPERTY: { |
104 | ElementQualityProperty elementQualityProperty = (ElementQualityProperty)theEObject; |
105 | T result = caseElementQualityProperty(elementQualityProperty); |
106 | if (result == null) result = caseQualityProperty(elementQualityProperty); |
107 | if (result == null) result = defaultCase(theEObject); |
108 | return result; |
109 | } |
110 | case QualityPropertiesPackage.INTEGER_QUALITY_PROPERTY: { |
111 | IntegerQualityProperty integerQualityProperty = (IntegerQualityProperty)theEObject; |
112 | T result = caseIntegerQualityProperty(integerQualityProperty); |
113 | if (result == null) result = caseNumericQualityProperty(integerQualityProperty); |
114 | if (result == null) result = caseQualityProperty(integerQualityProperty); |
115 | if (result == null) result = defaultCase(theEObject); |
116 | return result; |
117 | } |
118 | case QualityPropertiesPackage.DOUBLE_QUALITY_PROPERTY: { |
119 | DoubleQualityProperty doubleQualityProperty = (DoubleQualityProperty)theEObject; |
120 | T result = caseDoubleQualityProperty(doubleQualityProperty); |
121 | if (result == null) result = caseNumericQualityProperty(doubleQualityProperty); |
122 | if (result == null) result = caseQualityProperty(doubleQualityProperty); |
123 | if (result == null) result = defaultCase(theEObject); |
124 | return result; |
125 | } |
126 | case QualityPropertiesPackage.QUALITY_PREDICTION: { |
127 | QualityPrediction qualityPrediction = (QualityPrediction)theEObject; |
128 | T result = caseQualityPrediction(qualityPrediction); |
129 | if (result == null) result = defaultCase(theEObject); |
130 | return result; |
131 | } |
132 | case QualityPropertiesPackage.QUALITY_PROPERTY: { |
133 | QualityProperty qualityProperty = (QualityProperty)theEObject; |
134 | T result = caseQualityProperty(qualityProperty); |
135 | if (result == null) result = defaultCase(theEObject); |
136 | return result; |
137 | } |
138 | default: return defaultCase(theEObject); |
139 | } |
140 | } |
141 | |
142 | /** |
143 | * Returns the result of interpreting the object as an instance of '<em>Numeric Quality Property</em>'. |
144 | * <!-- begin-user-doc --> |
145 | * This implementation returns null; |
146 | * returning a non-null result will terminate the switch. |
147 | * <!-- end-user-doc --> |
148 | * @param object the target of the switch. |
149 | * @return the result of interpreting the object as an instance of '<em>Numeric Quality Property</em>'. |
150 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
151 | * @generated |
152 | */ |
153 | public T caseNumericQualityProperty(NumericQualityProperty object) { |
154 | return null; |
155 | } |
156 | |
157 | /** |
158 | * Returns the result of interpreting the object as an instance of '<em>Confidence Interval</em>'. |
159 | * <!-- begin-user-doc --> |
160 | * This implementation returns null; |
161 | * returning a non-null result will terminate the switch. |
162 | * <!-- end-user-doc --> |
163 | * @param object the target of the switch. |
164 | * @return the result of interpreting the object as an instance of '<em>Confidence Interval</em>'. |
165 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
166 | * @generated |
167 | */ |
168 | public T caseConfidenceInterval(ConfidenceInterval object) { |
169 | return null; |
170 | } |
171 | |
172 | /** |
173 | * Returns the result of interpreting the object as an instance of '<em>Element Quality Property</em>'. |
174 | * <!-- begin-user-doc --> |
175 | * This implementation returns null; |
176 | * returning a non-null result will terminate the switch. |
177 | * <!-- end-user-doc --> |
178 | * @param object the target of the switch. |
179 | * @return the result of interpreting the object as an instance of '<em>Element Quality Property</em>'. |
180 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
181 | * @generated |
182 | */ |
183 | public T caseElementQualityProperty(ElementQualityProperty object) { |
184 | return null; |
185 | } |
186 | |
187 | /** |
188 | * Returns the result of interpreting the object as an instance of '<em>Integer Quality Property</em>'. |
189 | * <!-- begin-user-doc --> |
190 | * This implementation returns null; |
191 | * returning a non-null result will terminate the switch. |
192 | * <!-- end-user-doc --> |
193 | * @param object the target of the switch. |
194 | * @return the result of interpreting the object as an instance of '<em>Integer Quality Property</em>'. |
195 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
196 | * @generated |
197 | */ |
198 | public T caseIntegerQualityProperty(IntegerQualityProperty object) { |
199 | return null; |
200 | } |
201 | |
202 | /** |
203 | * Returns the result of interpreting the object as an instance of '<em>Double Quality Property</em>'. |
204 | * <!-- begin-user-doc --> |
205 | * This implementation returns null; |
206 | * returning a non-null result will terminate the switch. |
207 | * <!-- end-user-doc --> |
208 | * @param object the target of the switch. |
209 | * @return the result of interpreting the object as an instance of '<em>Double Quality Property</em>'. |
210 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
211 | * @generated |
212 | */ |
213 | public T caseDoubleQualityProperty(DoubleQualityProperty object) { |
214 | return null; |
215 | } |
216 | |
217 | /** |
218 | * Returns the result of interpreting the object as an instance of '<em>Quality Prediction</em>'. |
219 | * <!-- begin-user-doc --> |
220 | * This implementation returns null; |
221 | * returning a non-null result will terminate the switch. |
222 | * <!-- end-user-doc --> |
223 | * @param object the target of the switch. |
224 | * @return the result of interpreting the object as an instance of '<em>Quality Prediction</em>'. |
225 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
226 | * @generated |
227 | */ |
228 | public T caseQualityPrediction(QualityPrediction object) { |
229 | return null; |
230 | } |
231 | |
232 | /** |
233 | * Returns the result of interpreting the object as an instance of '<em>Quality Property</em>'. |
234 | * <!-- begin-user-doc --> |
235 | * This implementation returns null; |
236 | * returning a non-null result will terminate the switch. |
237 | * <!-- end-user-doc --> |
238 | * @param object the target of the switch. |
239 | * @return the result of interpreting the object as an instance of '<em>Quality Property</em>'. |
240 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject) |
241 | * @generated |
242 | */ |
243 | public T caseQualityProperty(QualityProperty object) { |
244 | return null; |
245 | } |
246 | |
247 | /** |
248 | * Returns the result of interpreting the object as an instance of '<em>EObject</em>'. |
249 | * <!-- begin-user-doc --> |
250 | * This implementation returns null; |
251 | * returning a non-null result will terminate the switch, but this is the last case anyway. |
252 | * <!-- end-user-doc --> |
253 | * @param object the target of the switch. |
254 | * @return the result of interpreting the object as an instance of '<em>EObject</em>'. |
255 | * @see #doSwitch(org.eclipse.emf.ecore.EObject) |
256 | * @generated |
257 | */ |
258 | public T defaultCase(EObject object) { |
259 | return null; |
260 | } |
261 | |
262 | } //QualityPropertiesSwitch |