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.Precision; |
10 | import de.fzi.se.quality.qualityannotation.QualityAnnotationPackage; |
11 | import de.fzi.se.quality.qualityannotation.REPrecision; |
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>RE Precision</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.REPrecisionImpl#getDefaultPrecisionNumberOfCalls <em>Default Precision Number Of Calls</em>}</li> |
33 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.REPrecisionImpl#getDefaultPrecisionCallParameter <em>Default Precision Call Parameter</em>}</li> |
34 | * <li>{@link de.fzi.se.quality.qualityannotation.impl.REPrecisionImpl#getRequiredElement <em>Required Element</em>}</li> |
35 | * </ul> |
36 | * </p> |
37 | * |
38 | * @generated |
39 | */ |
40 | public class REPrecisionImpl extends EObjectImpl implements REPrecision { |
41 | /** |
42 | * The cached value of the '{@link #getDefaultPrecisionNumberOfCalls() <em>Default Precision Number Of Calls</em>}' containment reference. |
43 | * <!-- begin-user-doc --> |
44 | * <!-- end-user-doc --> |
45 | * @see #getDefaultPrecisionNumberOfCalls() |
46 | * @generated |
47 | * @ordered |
48 | */ |
49 | protected Precision defaultPrecisionNumberOfCalls; |
50 | |
51 | /** |
52 | * The cached value of the '{@link #getDefaultPrecisionCallParameter() <em>Default Precision Call Parameter</em>}' containment reference. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @see #getDefaultPrecisionCallParameter() |
56 | * @generated |
57 | * @ordered |
58 | */ |
59 | protected Precision defaultPrecisionCallParameter; |
60 | |
61 | /** |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | protected REPrecisionImpl() { |
67 | super(); |
68 | } |
69 | |
70 | /** |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | @Override |
76 | protected EClass eStaticClass() { |
77 | return QualityAnnotationPackage.Literals.RE_PRECISION; |
78 | } |
79 | |
80 | /** |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | public Precision getDefaultPrecisionNumberOfCalls() { |
86 | return defaultPrecisionNumberOfCalls; |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | public NotificationChain basicSetDefaultPrecisionNumberOfCalls(Precision newDefaultPrecisionNumberOfCalls, NotificationChain msgs) { |
95 | Precision oldDefaultPrecisionNumberOfCalls = defaultPrecisionNumberOfCalls; |
96 | defaultPrecisionNumberOfCalls = newDefaultPrecisionNumberOfCalls; |
97 | if (eNotificationRequired()) { |
98 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS, oldDefaultPrecisionNumberOfCalls, newDefaultPrecisionNumberOfCalls); |
99 | if (msgs == null) msgs = notification; else msgs.add(notification); |
100 | } |
101 | return msgs; |
102 | } |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | public void setDefaultPrecisionNumberOfCalls(Precision newDefaultPrecisionNumberOfCalls) { |
110 | if (newDefaultPrecisionNumberOfCalls != defaultPrecisionNumberOfCalls) { |
111 | NotificationChain msgs = null; |
112 | if (defaultPrecisionNumberOfCalls != null) |
113 | msgs = ((InternalEObject)defaultPrecisionNumberOfCalls).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS, null, msgs); |
114 | if (newDefaultPrecisionNumberOfCalls != null) |
115 | msgs = ((InternalEObject)newDefaultPrecisionNumberOfCalls).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS, null, msgs); |
116 | msgs = basicSetDefaultPrecisionNumberOfCalls(newDefaultPrecisionNumberOfCalls, msgs); |
117 | if (msgs != null) msgs.dispatch(); |
118 | } |
119 | else if (eNotificationRequired()) |
120 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS, newDefaultPrecisionNumberOfCalls, newDefaultPrecisionNumberOfCalls)); |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | public Precision getDefaultPrecisionCallParameter() { |
129 | return defaultPrecisionCallParameter; |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | public NotificationChain basicSetDefaultPrecisionCallParameter(Precision newDefaultPrecisionCallParameter, NotificationChain msgs) { |
138 | Precision oldDefaultPrecisionCallParameter = defaultPrecisionCallParameter; |
139 | defaultPrecisionCallParameter = newDefaultPrecisionCallParameter; |
140 | if (eNotificationRequired()) { |
141 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER, oldDefaultPrecisionCallParameter, newDefaultPrecisionCallParameter); |
142 | if (msgs == null) msgs = notification; else msgs.add(notification); |
143 | } |
144 | return msgs; |
145 | } |
146 | |
147 | /** |
148 | * <!-- begin-user-doc --> |
149 | * <!-- end-user-doc --> |
150 | * @generated |
151 | */ |
152 | public void setDefaultPrecisionCallParameter(Precision newDefaultPrecisionCallParameter) { |
153 | if (newDefaultPrecisionCallParameter != defaultPrecisionCallParameter) { |
154 | NotificationChain msgs = null; |
155 | if (defaultPrecisionCallParameter != null) |
156 | msgs = ((InternalEObject)defaultPrecisionCallParameter).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER, null, msgs); |
157 | if (newDefaultPrecisionCallParameter != null) |
158 | msgs = ((InternalEObject)newDefaultPrecisionCallParameter).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER, null, msgs); |
159 | msgs = basicSetDefaultPrecisionCallParameter(newDefaultPrecisionCallParameter, msgs); |
160 | if (msgs != null) msgs.dispatch(); |
161 | } |
162 | else if (eNotificationRequired()) |
163 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER, newDefaultPrecisionCallParameter, newDefaultPrecisionCallParameter)); |
164 | } |
165 | |
166 | /** |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | public RequiredElement getRequiredElement() { |
172 | if (eContainerFeatureID() != QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT) return null; |
173 | return (RequiredElement)eContainer(); |
174 | } |
175 | |
176 | /** |
177 | * <!-- begin-user-doc --> |
178 | * <!-- end-user-doc --> |
179 | * @generated |
180 | */ |
181 | public NotificationChain basicSetRequiredElement(RequiredElement newRequiredElement, NotificationChain msgs) { |
182 | msgs = eBasicSetContainer((InternalEObject)newRequiredElement, QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT, msgs); |
183 | return msgs; |
184 | } |
185 | |
186 | /** |
187 | * <!-- begin-user-doc --> |
188 | * <!-- end-user-doc --> |
189 | * @generated |
190 | */ |
191 | public void setRequiredElement(RequiredElement newRequiredElement) { |
192 | if (newRequiredElement != eInternalContainer() || (eContainerFeatureID() != QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT && newRequiredElement != null)) { |
193 | if (EcoreUtil.isAncestor(this, newRequiredElement)) |
194 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
195 | NotificationChain msgs = null; |
196 | if (eInternalContainer() != null) |
197 | msgs = eBasicRemoveFromContainer(msgs); |
198 | if (newRequiredElement != null) |
199 | msgs = ((InternalEObject)newRequiredElement).eInverseAdd(this, QualityAnnotationPackage.REQUIRED_ELEMENT__PRECISION, RequiredElement.class, msgs); |
200 | msgs = basicSetRequiredElement(newRequiredElement, msgs); |
201 | if (msgs != null) msgs.dispatch(); |
202 | } |
203 | else if (eNotificationRequired()) |
204 | eNotify(new ENotificationImpl(this, Notification.SET, QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT, newRequiredElement, newRequiredElement)); |
205 | } |
206 | |
207 | /** |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | @Override |
213 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
214 | switch (featureID) { |
215 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
216 | if (eInternalContainer() != null) |
217 | msgs = eBasicRemoveFromContainer(msgs); |
218 | return basicSetRequiredElement((RequiredElement)otherEnd, msgs); |
219 | } |
220 | return super.eInverseAdd(otherEnd, featureID, msgs); |
221 | } |
222 | |
223 | /** |
224 | * <!-- begin-user-doc --> |
225 | * <!-- end-user-doc --> |
226 | * @generated |
227 | */ |
228 | @Override |
229 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
230 | switch (featureID) { |
231 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS: |
232 | return basicSetDefaultPrecisionNumberOfCalls(null, msgs); |
233 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER: |
234 | return basicSetDefaultPrecisionCallParameter(null, msgs); |
235 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
236 | return basicSetRequiredElement(null, msgs); |
237 | } |
238 | return super.eInverseRemove(otherEnd, featureID, msgs); |
239 | } |
240 | |
241 | /** |
242 | * <!-- begin-user-doc --> |
243 | * <!-- end-user-doc --> |
244 | * @generated |
245 | */ |
246 | @Override |
247 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
248 | switch (eContainerFeatureID()) { |
249 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
250 | return eInternalContainer().eInverseRemove(this, QualityAnnotationPackage.REQUIRED_ELEMENT__PRECISION, RequiredElement.class, msgs); |
251 | } |
252 | return super.eBasicRemoveFromContainerFeature(msgs); |
253 | } |
254 | |
255 | /** |
256 | * <!-- begin-user-doc --> |
257 | * <!-- end-user-doc --> |
258 | * @generated |
259 | */ |
260 | @Override |
261 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
262 | switch (featureID) { |
263 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS: |
264 | return getDefaultPrecisionNumberOfCalls(); |
265 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER: |
266 | return getDefaultPrecisionCallParameter(); |
267 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
268 | return getRequiredElement(); |
269 | } |
270 | return super.eGet(featureID, resolve, coreType); |
271 | } |
272 | |
273 | /** |
274 | * <!-- begin-user-doc --> |
275 | * <!-- end-user-doc --> |
276 | * @generated |
277 | */ |
278 | @Override |
279 | public void eSet(int featureID, Object newValue) { |
280 | switch (featureID) { |
281 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS: |
282 | setDefaultPrecisionNumberOfCalls((Precision)newValue); |
283 | return; |
284 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER: |
285 | setDefaultPrecisionCallParameter((Precision)newValue); |
286 | return; |
287 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
288 | setRequiredElement((RequiredElement)newValue); |
289 | return; |
290 | } |
291 | super.eSet(featureID, newValue); |
292 | } |
293 | |
294 | /** |
295 | * <!-- begin-user-doc --> |
296 | * <!-- end-user-doc --> |
297 | * @generated |
298 | */ |
299 | @Override |
300 | public void eUnset(int featureID) { |
301 | switch (featureID) { |
302 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS: |
303 | setDefaultPrecisionNumberOfCalls((Precision)null); |
304 | return; |
305 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER: |
306 | setDefaultPrecisionCallParameter((Precision)null); |
307 | return; |
308 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
309 | setRequiredElement((RequiredElement)null); |
310 | return; |
311 | } |
312 | super.eUnset(featureID); |
313 | } |
314 | |
315 | /** |
316 | * <!-- begin-user-doc --> |
317 | * <!-- end-user-doc --> |
318 | * @generated |
319 | */ |
320 | @Override |
321 | public boolean eIsSet(int featureID) { |
322 | switch (featureID) { |
323 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_NUMBER_OF_CALLS: |
324 | return defaultPrecisionNumberOfCalls != null; |
325 | case QualityAnnotationPackage.RE_PRECISION__DEFAULT_PRECISION_CALL_PARAMETER: |
326 | return defaultPrecisionCallParameter != null; |
327 | case QualityAnnotationPackage.RE_PRECISION__REQUIRED_ELEMENT: |
328 | return getRequiredElement() != null; |
329 | } |
330 | return super.eIsSet(featureID); |
331 | } |
332 | |
333 | } //REPrecisionImpl |