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