1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package de.fzi.se.quality.qualityannotation.impl; |
8 | |
9 | import de.fzi.se.quality.parameters.ParameterReference; |
10 | import de.fzi.se.quality.parameters.ParametersPackage; |
11 | |
12 | import de.fzi.se.quality.qualityannotation.CallParameterDeviation; |
13 | import de.fzi.se.quality.qualityannotation.InternalStateInfluenceAnalysisAggregation; |
14 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
15 | |
16 | import java.util.Collection; |
17 | |
18 | import org.eclipse.emf.common.notify.Notification; |
19 | import org.eclipse.emf.common.notify.NotificationChain; |
20 | |
21 | import org.eclipse.emf.common.util.EList; |
22 | |
23 | import org.eclipse.emf.ecore.EClass; |
24 | import org.eclipse.emf.ecore.InternalEObject; |
25 | |
26 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
27 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
28 | |
29 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
30 | import org.eclipse.emf.ecore.util.EcoreUtil; |
31 | import org.eclipse.emf.ecore.util.InternalEList; |
32 | |
33 | /** |
34 | * <!-- begin-user-doc --> |
35 | * An implementation of the model object '<em><b>Call Parameter Deviation</b></em>'. |
36 | * <!-- end-user-doc --> |
37 | * <p> |
38 | * The following features are implemented: |
39 | * <ul> |
40 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.CallParameterDeviationImpl#getParameterReference <em>Parameter Reference</em>}</li> |
41 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.CallParameterDeviationImpl#getInternalStateInfluenceAnalysisAggregation <em>Internal State Influence Analysis Aggregation</em>}</li> |
42 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.CallParameterDeviationImpl#getMaximum <em>Maximum</em>}</li> |
43 | * </ul> |
44 | * </p> |
45 | * |
46 | * @generated |
47 | */ |
48 | public class CallParameterDeviationImpl extends EObjectImpl implements CallParameterDeviation { |
49 | /** |
50 | * The cached value of the '{@link #getParameterReference() <em>Parameter Reference</em>}' containment reference list. |
51 | * <!-- begin-user-doc --> |
52 | * <!-- end-user-doc --> |
53 | * @see #getParameterReference() |
54 | * @generated |
55 | * @ordered |
56 | */ |
57 | protected EList<ParameterReference> parameterReference; |
58 | |
59 | /** |
60 | * The default value of the '{@link #getMaximum() <em>Maximum</em>}' attribute. |
61 | * <!-- begin-user-doc --> |
62 | * <!-- end-user-doc --> |
63 | * @see #getMaximum() |
64 | * @generated |
65 | * @ordered |
66 | */ |
67 | protected static final double MAXIMUM_EDEFAULT = 0.0; |
68 | |
69 | /** |
70 | * The cached value of the '{@link #getMaximum() <em>Maximum</em>}' attribute. |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @see #getMaximum() |
74 | * @generated |
75 | * @ordered |
76 | */ |
77 | protected double maximum = MAXIMUM_EDEFAULT; |
78 | |
79 | /** |
80 | * <!-- begin-user-doc --> |
81 | * <!-- end-user-doc --> |
82 | * @generated |
83 | */ |
84 | protected CallParameterDeviationImpl() { |
85 | super(); |
86 | } |
87 | |
88 | /** |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @generated |
92 | */ |
93 | @Override |
94 | protected EClass eStaticClass() { |
95 | return QualityAnnotationPackage.Literals.CALL_PARAMETER_DEVIATION; |
96 | } |
97 | |
98 | /** |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @generated |
102 | */ |
103 | public EList<ParameterReference> getParameterReference() { |
104 | if (parameterReference == null) { |
105 | parameterReference = new EObjectContainmentWithInverseEList<ParameterReference>(ParameterReference.class, this, QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE, ParametersPackage.PARAMETER_REFERENCE__CALL_PARAMETER_DEVIATION); |
106 | } |
107 | return parameterReference; |
108 | } |
109 | |
110 | /** |
111 | * <!-- begin-user-doc --> |
112 | * <!-- end-user-doc --> |
113 | * @generated |
114 | */ |
115 | public InternalStateInfluenceAnalysisAggregation getInternalStateInfluenceAnalysisAggregation() { |
116 | if (eContainerFeatureID() != QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION) return null; |
117 | return (InternalStateInfluenceAnalysisAggregation)eContainer(); |
118 | } |
119 | |
120 | /** |
121 | * <!-- begin-user-doc --> |
122 | * <!-- end-user-doc --> |
123 | * @generated |
124 | */ |
125 | public NotificationChain basicSetInternalStateInfluenceAnalysisAggregation(InternalStateInfluenceAnalysisAggregation newInternalStateInfluenceAnalysisAggregation, NotificationChain msgs) { |
126 | msgs = eBasicSetContainer((InternalEObject)newInternalStateInfluenceAnalysisAggregation, QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION, msgs); |
127 | return msgs; |
128 | } |
129 | |
130 | /** |
131 | * <!-- begin-user-doc --> |
132 | * <!-- end-user-doc --> |
133 | * @generated |
134 | */ |
135 | public void setInternalStateInfluenceAnalysisAggregation(InternalStateInfluenceAnalysisAggregation newInternalStateInfluenceAnalysisAggregation) { |
136 | if (newInternalStateInfluenceAnalysisAggregation != eInternalContainer() || (eContainerFeatureID() != QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION && newInternalStateInfluenceAnalysisAggregation != null)) { |
137 | if (EcoreUtil.isAncestor(this, newInternalStateInfluenceAnalysisAggregation)) |
138 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
139 | NotificationChain msgs = null; |
140 | if (eInternalContainer() != null) |
141 | msgs = eBasicRemoveFromContainer(msgs); |
142 | if (newInternalStateInfluenceAnalysisAggregation != null) |
143 | msgs = ((InternalEObject)newInternalStateInfluenceAnalysisAggregation).eInverseAdd(this, QualityAnnotationPackage.INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION__CALL_PARAMETER_DEVIATION, InternalStateInfluenceAnalysisAggregation.class, msgs); |
144 | msgs = basicSetInternalStateInfluenceAnalysisAggregation(newInternalStateInfluenceAnalysisAggregation, msgs); |
145 | if (msgs != null) msgs.dispatch(); |
146 | } |
147 | else if (eNotificationRequired()) |
148 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION, newInternalStateInfluenceAnalysisAggregation, newInternalStateInfluenceAnalysisAggregation)); |
149 | } |
150 | |
151 | /** |
152 | * <!-- begin-user-doc --> |
153 | * <!-- end-user-doc --> |
154 | * @generated |
155 | */ |
156 | public double getMaximum() { |
157 | return maximum; |
158 | } |
159 | |
160 | /** |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | public void setMaximum(double newMaximum) { |
166 | double oldMaximum = maximum; |
167 | maximum = newMaximum; |
168 | if (eNotificationRequired()) |
169 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__MAXIMUM, oldMaximum, maximum)); |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @SuppressWarnings("unchecked") |
178 | @Override |
179 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
180 | switch (featureID) { |
181 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
182 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getParameterReference()).basicAdd(otherEnd, msgs); |
183 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
184 | if (eInternalContainer() != null) |
185 | msgs = eBasicRemoveFromContainer(msgs); |
186 | return basicSetInternalStateInfluenceAnalysisAggregation((InternalStateInfluenceAnalysisAggregation)otherEnd, msgs); |
187 | } |
188 | return super.eInverseAdd(otherEnd, featureID, msgs); |
189 | } |
190 | |
191 | /** |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | @Override |
197 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
198 | switch (featureID) { |
199 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
200 | return ((InternalEList<?>)getParameterReference()).basicRemove(otherEnd, msgs); |
201 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
202 | return basicSetInternalStateInfluenceAnalysisAggregation(null, msgs); |
203 | } |
204 | return super.eInverseRemove(otherEnd, featureID, msgs); |
205 | } |
206 | |
207 | /** |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | @Override |
213 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
214 | switch (eContainerFeatureID()) { |
215 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
216 | return eInternalContainer().eInverseRemove(this, QualityAnnotationPackage.INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION__CALL_PARAMETER_DEVIATION, InternalStateInfluenceAnalysisAggregation.class, msgs); |
217 | } |
218 | return super.eBasicRemoveFromContainerFeature(msgs); |
219 | } |
220 | |
221 | /** |
222 | * <!-- begin-user-doc --> |
223 | * <!-- end-user-doc --> |
224 | * @generated |
225 | */ |
226 | @Override |
227 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
228 | switch (featureID) { |
229 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
230 | return getParameterReference(); |
231 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
232 | return getInternalStateInfluenceAnalysisAggregation(); |
233 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__MAXIMUM: |
234 | return getMaximum(); |
235 | } |
236 | return super.eGet(featureID, resolve, coreType); |
237 | } |
238 | |
239 | /** |
240 | * <!-- begin-user-doc --> |
241 | * <!-- end-user-doc --> |
242 | * @generated |
243 | */ |
244 | @SuppressWarnings("unchecked") |
245 | @Override |
246 | public void eSet(int featureID, Object newValue) { |
247 | switch (featureID) { |
248 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
249 | getParameterReference().clear(); |
250 | getParameterReference().addAll((Collection<? extends ParameterReference>)newValue); |
251 | return; |
252 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
253 | setInternalStateInfluenceAnalysisAggregation((InternalStateInfluenceAnalysisAggregation)newValue); |
254 | return; |
255 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__MAXIMUM: |
256 | setMaximum((Double)newValue); |
257 | return; |
258 | } |
259 | super.eSet(featureID, newValue); |
260 | } |
261 | |
262 | /** |
263 | * <!-- begin-user-doc --> |
264 | * <!-- end-user-doc --> |
265 | * @generated |
266 | */ |
267 | @Override |
268 | public void eUnset(int featureID) { |
269 | switch (featureID) { |
270 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
271 | getParameterReference().clear(); |
272 | return; |
273 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
274 | setInternalStateInfluenceAnalysisAggregation((InternalStateInfluenceAnalysisAggregation)null); |
275 | return; |
276 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__MAXIMUM: |
277 | setMaximum(MAXIMUM_EDEFAULT); |
278 | return; |
279 | } |
280 | super.eUnset(featureID); |
281 | } |
282 | |
283 | /** |
284 | * <!-- begin-user-doc --> |
285 | * <!-- end-user-doc --> |
286 | * @generated |
287 | */ |
288 | @Override |
289 | public boolean eIsSet(int featureID) { |
290 | switch (featureID) { |
291 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__PARAMETER_REFERENCE: |
292 | return parameterReference != null && !parameterReference.isEmpty(); |
293 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__INTERNAL_STATE_INFLUENCE_ANALYSIS_AGGREGATION: |
294 | return getInternalStateInfluenceAnalysisAggregation() != null; |
295 | case QualityAnnotationPackage.CALL_PARAMETER_DEVIATION__MAXIMUM: |
296 | return maximum != MAXIMUM_EDEFAULT; |
297 | } |
298 | return super.eIsSet(featureID); |
299 | } |
300 | |
301 | /** |
302 | * <!-- begin-user-doc --> |
303 | * <!-- end-user-doc --> |
304 | * @generated |
305 | */ |
306 | @Override |
307 | public String toString() { |
308 | if (eIsProxy()) return super.toString(); |
309 | |
310 | StringBuffer result = new StringBuffer(super.toString()); |
311 | result.append(" (maximum: "); |
312 | result.append(maximum); |
313 | result.append(')'); |
314 | return result.toString(); |
315 | } |
316 | |
317 | } //CallParameterDeviationImpl |