1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.qosannotations.impl; |
7 | |
8 | import java.util.Collection; |
9 | import java.util.Map; |
10 | |
11 | import org.eclipse.emf.common.notify.Notification; |
12 | import org.eclipse.emf.common.notify.NotificationChain; |
13 | import org.eclipse.emf.common.util.BasicDiagnostic; |
14 | import org.eclipse.emf.common.util.Diagnostic; |
15 | import org.eclipse.emf.common.util.DiagnosticChain; |
16 | import org.eclipse.emf.common.util.EList; |
17 | import org.eclipse.emf.ecore.EClass; |
18 | import org.eclipse.emf.ecore.InternalEObject; |
19 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
20 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
21 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
22 | import org.eclipse.emf.ecore.util.EObjectValidator; |
23 | import org.eclipse.emf.ecore.util.EcoreUtil; |
24 | import org.eclipse.emf.ecore.util.InternalEList; |
25 | import org.eclipse.ocl.ParserException; |
26 | import org.eclipse.ocl.ecore.Constraint; |
27 | import org.eclipse.ocl.ecore.OCL; |
28 | |
29 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
30 | import de.uka.ipd.sdq.pcm.qosannotations.QoSAnnotations; |
31 | import de.uka.ipd.sdq.pcm.qosannotations.QosannotationsPackage; |
32 | import de.uka.ipd.sdq.pcm.qosannotations.SpecifiedOutputParameterAbstraction; |
33 | import de.uka.ipd.sdq.pcm.qosannotations.SpecifiedQoSAnnotation; |
34 | import de.uka.ipd.sdq.pcm.qosannotations.util.QosannotationsValidator; |
35 | import de.uka.ipd.sdq.pcm.system.SystemPackage; |
36 | |
37 | /** |
38 | * <!-- begin-user-doc --> |
39 | * An implementation of the model object '<em><b>Qo SAnnotations</b></em>'. |
40 | * <!-- end-user-doc --> |
41 | * <p> |
42 | * The following features are implemented: |
43 | * <ul> |
44 | * <li>{@link de.uka.ipd.sdq.pcm.qosannotations.impl.QoSAnnotationsImpl#getSpecifiedOutputParameterAbstractions_QoSAnnotations <em>Specified Output Parameter Abstractions Qo SAnnotations</em>}</li> |
45 | * <li>{@link de.uka.ipd.sdq.pcm.qosannotations.impl.QoSAnnotationsImpl#getSystem_QoSAnnotations <em>System Qo SAnnotations</em>}</li> |
46 | * <li>{@link de.uka.ipd.sdq.pcm.qosannotations.impl.QoSAnnotationsImpl#getSpecifiedQoSAnnotations_QoSAnnotations <em>Specified Qo SAnnotations Qo SAnnotations</em>}</li> |
47 | * </ul> |
48 | * </p> |
49 | * |
50 | * @generated |
51 | */ |
52 | public class QoSAnnotationsImpl extends EntityImpl implements QoSAnnotations { |
53 | /** |
54 | * <!-- begin-user-doc --> |
55 | * <!-- end-user-doc --> |
56 | * @generated |
57 | */ |
58 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
59 | |
60 | /** |
61 | * The cached value of the '{@link #getSpecifiedOutputParameterAbstractions_QoSAnnotations() <em>Specified Output Parameter Abstractions Qo SAnnotations</em>}' containment reference list. |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @see #getSpecifiedOutputParameterAbstractions_QoSAnnotations() |
65 | * @generated |
66 | * @ordered |
67 | */ |
68 | protected EList<SpecifiedOutputParameterAbstraction> specifiedOutputParameterAbstractions_QoSAnnotations; |
69 | |
70 | /** |
71 | * The cached value of the '{@link #getSpecifiedQoSAnnotations_QoSAnnotations() <em>Specified Qo SAnnotations Qo SAnnotations</em>}' containment reference list. |
72 | * <!-- begin-user-doc --> |
73 | * <!-- end-user-doc --> |
74 | * @see #getSpecifiedQoSAnnotations_QoSAnnotations() |
75 | * @generated |
76 | * @ordered |
77 | */ |
78 | protected EList<SpecifiedQoSAnnotation> specifiedQoSAnnotations_QoSAnnotations; |
79 | |
80 | /** |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | protected QoSAnnotationsImpl() { |
86 | super(); |
87 | } |
88 | |
89 | /** |
90 | * <!-- begin-user-doc --> |
91 | * <!-- end-user-doc --> |
92 | * @generated |
93 | */ |
94 | @Override |
95 | protected EClass eStaticClass() { |
96 | return QosannotationsPackage.Literals.QO_SANNOTATIONS; |
97 | } |
98 | |
99 | /** |
100 | * <!-- begin-user-doc --> |
101 | * <!-- end-user-doc --> |
102 | * @generated |
103 | */ |
104 | public EList<SpecifiedOutputParameterAbstraction> getSpecifiedOutputParameterAbstractions_QoSAnnotations() { |
105 | if (specifiedOutputParameterAbstractions_QoSAnnotations == null) { |
106 | specifiedOutputParameterAbstractions_QoSAnnotations = new EObjectContainmentWithInverseEList<SpecifiedOutputParameterAbstraction>(SpecifiedOutputParameterAbstraction.class, this, QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS, QosannotationsPackage.SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION__QOS_ANNOTATIONS_SPECIFIED_OUTPUT_PARAMETER_ABSTRACTION); |
107 | } |
108 | return specifiedOutputParameterAbstractions_QoSAnnotations; |
109 | } |
110 | |
111 | /** |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | public de.uka.ipd.sdq.pcm.system.System getSystem_QoSAnnotations() { |
117 | if (eContainerFeatureID() != QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS) return null; |
118 | return (de.uka.ipd.sdq.pcm.system.System)eContainer(); |
119 | } |
120 | |
121 | /** |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | public NotificationChain basicSetSystem_QoSAnnotations(de.uka.ipd.sdq.pcm.system.System newSystem_QoSAnnotations, NotificationChain msgs) { |
127 | msgs = eBasicSetContainer((InternalEObject)newSystem_QoSAnnotations, QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS, msgs); |
128 | return msgs; |
129 | } |
130 | |
131 | /** |
132 | * <!-- begin-user-doc --> |
133 | * <!-- end-user-doc --> |
134 | * @generated |
135 | */ |
136 | public void setSystem_QoSAnnotations(de.uka.ipd.sdq.pcm.system.System newSystem_QoSAnnotations) { |
137 | if (newSystem_QoSAnnotations != eInternalContainer() || (eContainerFeatureID() != QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS && newSystem_QoSAnnotations != null)) { |
138 | if (EcoreUtil.isAncestor(this, newSystem_QoSAnnotations)) |
139 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
140 | NotificationChain msgs = null; |
141 | if (eInternalContainer() != null) |
142 | msgs = eBasicRemoveFromContainer(msgs); |
143 | if (newSystem_QoSAnnotations != null) |
144 | msgs = ((InternalEObject)newSystem_QoSAnnotations).eInverseAdd(this, SystemPackage.SYSTEM__QOS_ANNOTATIONS_SYSTEM, de.uka.ipd.sdq.pcm.system.System.class, msgs); |
145 | msgs = basicSetSystem_QoSAnnotations(newSystem_QoSAnnotations, msgs); |
146 | if (msgs != null) msgs.dispatch(); |
147 | } |
148 | else if (eNotificationRequired()) |
149 | eNotify(new ENotificationImpl(this, Notification.SET, QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS, newSystem_QoSAnnotations, newSystem_QoSAnnotations)); |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | public EList<SpecifiedQoSAnnotation> getSpecifiedQoSAnnotations_QoSAnnotations() { |
158 | if (specifiedQoSAnnotations_QoSAnnotations == null) { |
159 | specifiedQoSAnnotations_QoSAnnotations = new EObjectContainmentWithInverseEList<SpecifiedQoSAnnotation>(SpecifiedQoSAnnotation.class, this, QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS, QosannotationsPackage.SPECIFIED_QO_SANNOTATION__QOS_ANNOTATIONS_SPECIFIED_QO_SANNOTATION); |
160 | } |
161 | return specifiedQoSAnnotations_QoSAnnotations; |
162 | } |
163 | |
164 | /** |
165 | * The cached OCL expression body for the '{@link #MultipleReliabilityAnnotationsPerExternalCallNotAllowed(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Multiple Reliability Annotations Per External Call Not Allowed</em>}' operation. |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @see #MultipleReliabilityAnnotationsPerExternalCallNotAllowed(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
169 | * @generated |
170 | * @ordered |
171 | */ |
172 | protected static final String MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "self.specifiedQoSAnnotations_QoSAnnotations->select(oclIsTypeOf(pcm::qosannotations::qos_reliability::SpecifiedReliabilityAnnotation))->forAll( x, y | ( x<>y ) implies ( ( x.role_SpecifiedQoSAnnotation <> y.role_SpecifiedQoSAnnotation ) or ( x.signature_SpecifiedQoSAnnation <> y.signature_SpecifiedQoSAnnation ) ) )"; |
173 | |
174 | /** |
175 | * The cached OCL invariant for the '{@link #MultipleReliabilityAnnotationsPerExternalCallNotAllowed(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Multiple Reliability Annotations Per External Call Not Allowed</em>}' invariant operation. |
176 | * <!-- begin-user-doc --> |
177 | * <!-- end-user-doc --> |
178 | * @see #MultipleReliabilityAnnotationsPerExternalCallNotAllowed(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
179 | * @generated |
180 | * @ordered |
181 | */ |
182 | protected static Constraint MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
183 | |
184 | /** |
185 | * <!-- begin-user-doc --> |
186 | * <!-- end-user-doc --> |
187 | * @generated |
188 | */ |
189 | public boolean MultipleReliabilityAnnotationsPerExternalCallNotAllowed(DiagnosticChain diagnostics, Map<Object, Object> context) { |
190 | if (MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
191 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
192 | helper.setContext(QosannotationsPackage.Literals.QO_SANNOTATIONS); |
193 | try { |
194 | MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
195 | } |
196 | catch (ParserException pe) { |
197 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
198 | } |
199 | } |
200 | if (!EOCL_ENV.createQuery(MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
201 | if (diagnostics != null) { |
202 | diagnostics.add |
203 | (new BasicDiagnostic |
204 | (Diagnostic.ERROR, |
205 | QosannotationsValidator.DIAGNOSTIC_SOURCE, |
206 | QosannotationsValidator.QO_SANNOTATIONS__MULTIPLE_RELIABILITY_ANNOTATIONS_PER_EXTERNAL_CALL_NOT_ALLOWED, |
207 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "MultipleReliabilityAnnotationsPerExternalCallNotAllowed", EObjectValidator.getObjectLabel(this, context) }), |
208 | new Object [] { this })); |
209 | } |
210 | return false; |
211 | } |
212 | return true; |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | @SuppressWarnings("unchecked") |
221 | @Override |
222 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
223 | switch (featureID) { |
224 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS: |
225 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getSpecifiedOutputParameterAbstractions_QoSAnnotations()).basicAdd(otherEnd, msgs); |
226 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
227 | if (eInternalContainer() != null) |
228 | msgs = eBasicRemoveFromContainer(msgs); |
229 | return basicSetSystem_QoSAnnotations((de.uka.ipd.sdq.pcm.system.System)otherEnd, msgs); |
230 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS: |
231 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getSpecifiedQoSAnnotations_QoSAnnotations()).basicAdd(otherEnd, msgs); |
232 | } |
233 | return super.eInverseAdd(otherEnd, featureID, msgs); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | @Override |
242 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
243 | switch (featureID) { |
244 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS: |
245 | return ((InternalEList<?>)getSpecifiedOutputParameterAbstractions_QoSAnnotations()).basicRemove(otherEnd, msgs); |
246 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
247 | return basicSetSystem_QoSAnnotations(null, msgs); |
248 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS: |
249 | return ((InternalEList<?>)getSpecifiedQoSAnnotations_QoSAnnotations()).basicRemove(otherEnd, msgs); |
250 | } |
251 | return super.eInverseRemove(otherEnd, featureID, msgs); |
252 | } |
253 | |
254 | /** |
255 | * <!-- begin-user-doc --> |
256 | * <!-- end-user-doc --> |
257 | * @generated |
258 | */ |
259 | @Override |
260 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
261 | switch (eContainerFeatureID()) { |
262 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
263 | return eInternalContainer().eInverseRemove(this, SystemPackage.SYSTEM__QOS_ANNOTATIONS_SYSTEM, de.uka.ipd.sdq.pcm.system.System.class, msgs); |
264 | } |
265 | return super.eBasicRemoveFromContainerFeature(msgs); |
266 | } |
267 | |
268 | /** |
269 | * <!-- begin-user-doc --> |
270 | * <!-- end-user-doc --> |
271 | * @generated |
272 | */ |
273 | @Override |
274 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
275 | switch (featureID) { |
276 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS: |
277 | return getSpecifiedOutputParameterAbstractions_QoSAnnotations(); |
278 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
279 | return getSystem_QoSAnnotations(); |
280 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS: |
281 | return getSpecifiedQoSAnnotations_QoSAnnotations(); |
282 | } |
283 | return super.eGet(featureID, resolve, coreType); |
284 | } |
285 | |
286 | /** |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | @SuppressWarnings("unchecked") |
292 | @Override |
293 | public void eSet(int featureID, Object newValue) { |
294 | switch (featureID) { |
295 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS: |
296 | getSpecifiedOutputParameterAbstractions_QoSAnnotations().clear(); |
297 | getSpecifiedOutputParameterAbstractions_QoSAnnotations().addAll((Collection<? extends SpecifiedOutputParameterAbstraction>)newValue); |
298 | return; |
299 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
300 | setSystem_QoSAnnotations((de.uka.ipd.sdq.pcm.system.System)newValue); |
301 | return; |
302 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS: |
303 | getSpecifiedQoSAnnotations_QoSAnnotations().clear(); |
304 | getSpecifiedQoSAnnotations_QoSAnnotations().addAll((Collection<? extends SpecifiedQoSAnnotation>)newValue); |
305 | return; |
306 | } |
307 | super.eSet(featureID, newValue); |
308 | } |
309 | |
310 | /** |
311 | * <!-- begin-user-doc --> |
312 | * <!-- end-user-doc --> |
313 | * @generated |
314 | */ |
315 | @Override |
316 | public void eUnset(int featureID) { |
317 | switch (featureID) { |
318 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS: |
319 | getSpecifiedOutputParameterAbstractions_QoSAnnotations().clear(); |
320 | return; |
321 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
322 | setSystem_QoSAnnotations((de.uka.ipd.sdq.pcm.system.System)null); |
323 | return; |
324 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS: |
325 | getSpecifiedQoSAnnotations_QoSAnnotations().clear(); |
326 | return; |
327 | } |
328 | super.eUnset(featureID); |
329 | } |
330 | |
331 | /** |
332 | * <!-- begin-user-doc --> |
333 | * <!-- end-user-doc --> |
334 | * @generated |
335 | */ |
336 | @Override |
337 | public boolean eIsSet(int featureID) { |
338 | switch (featureID) { |
339 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_OUTPUT_PARAMETER_ABSTRACTIONS_QO_SANNOTATIONS: |
340 | return specifiedOutputParameterAbstractions_QoSAnnotations != null && !specifiedOutputParameterAbstractions_QoSAnnotations.isEmpty(); |
341 | case QosannotationsPackage.QO_SANNOTATIONS__SYSTEM_QO_SANNOTATIONS: |
342 | return getSystem_QoSAnnotations() != null; |
343 | case QosannotationsPackage.QO_SANNOTATIONS__SPECIFIED_QO_SANNOTATIONS_QO_SANNOTATIONS: |
344 | return specifiedQoSAnnotations_QoSAnnotations != null && !specifiedQoSAnnotations_QoSAnnotations.isEmpty(); |
345 | } |
346 | return super.eIsSet(featureID); |
347 | } |
348 | |
349 | /** |
350 | * The cached environment for evaluating OCL expressions. |
351 | * <!-- begin-user-doc --> |
352 | * <!-- end-user-doc --> |
353 | * @generated |
354 | * @ordered |
355 | */ |
356 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
357 | |
358 | } //QoSAnnotationsImpl |