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