1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.reliability.impl; |
7 | |
8 | import java.util.Map; |
9 | |
10 | import org.eclipse.emf.common.notify.Notification; |
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.ecore.EClass; |
16 | import org.eclipse.emf.ecore.InternalEObject; |
17 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
18 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
19 | import org.eclipse.emf.ecore.util.EObjectValidator; |
20 | import org.eclipse.emf.ecore.util.EcoreUtil; |
21 | import org.eclipse.ocl.ParserException; |
22 | import org.eclipse.ocl.ecore.Constraint; |
23 | import org.eclipse.ocl.ecore.OCL; |
24 | |
25 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.Qos_reliabilityPackage; |
26 | import de.uka.ipd.sdq.pcm.qosannotations.qos_reliability.SpecifiedReliabilityAnnotation; |
27 | import de.uka.ipd.sdq.pcm.reliability.ExternalFailureOccurrenceDescription; |
28 | import de.uka.ipd.sdq.pcm.reliability.FailureType; |
29 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
30 | import de.uka.ipd.sdq.pcm.reliability.util.ReliabilityValidator; |
31 | |
32 | /** |
33 | * <!-- begin-user-doc --> |
34 | * An implementation of the model object '<em><b>External Failure Occurrence Description</b></em>'. |
35 | * <!-- end-user-doc --> |
36 | * <p> |
37 | * The following features are implemented: |
38 | * <ul> |
39 | * <li>{@link de.uka.ipd.sdq.pcm.reliability.impl.ExternalFailureOccurrenceDescriptionImpl#getSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription <em>Specified Reliability Annotation External Failure Occurrence Description</em>}</li> |
40 | * <li>{@link de.uka.ipd.sdq.pcm.reliability.impl.ExternalFailureOccurrenceDescriptionImpl#getFailureType__ExternalFailureOccurrenceDescription <em>Failure Type External Failure Occurrence Description</em>}</li> |
41 | * </ul> |
42 | * </p> |
43 | * |
44 | * @generated |
45 | */ |
46 | public class ExternalFailureOccurrenceDescriptionImpl extends FailureOccurrenceDescriptionImpl implements ExternalFailureOccurrenceDescription { |
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 #getFailureType__ExternalFailureOccurrenceDescription() <em>Failure Type External Failure Occurrence Description</em>}' reference. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @see #getFailureType__ExternalFailureOccurrenceDescription() |
59 | * @generated |
60 | * @ordered |
61 | */ |
62 | protected FailureType failureType__ExternalFailureOccurrenceDescription; |
63 | |
64 | /** |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @generated |
68 | */ |
69 | protected ExternalFailureOccurrenceDescriptionImpl() { |
70 | super(); |
71 | } |
72 | |
73 | /** |
74 | * <!-- begin-user-doc --> |
75 | * <!-- end-user-doc --> |
76 | * @generated |
77 | */ |
78 | @Override |
79 | protected EClass eStaticClass() { |
80 | return ReliabilityPackage.Literals.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION; |
81 | } |
82 | |
83 | /** |
84 | * <!-- begin-user-doc --> |
85 | * <!-- end-user-doc --> |
86 | * @generated |
87 | */ |
88 | public SpecifiedReliabilityAnnotation getSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription() { |
89 | if (eContainerFeatureID() != ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION) return null; |
90 | return (SpecifiedReliabilityAnnotation)eContainer(); |
91 | } |
92 | |
93 | /** |
94 | * <!-- begin-user-doc --> |
95 | * <!-- end-user-doc --> |
96 | * @generated |
97 | */ |
98 | public NotificationChain basicSetSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription(SpecifiedReliabilityAnnotation newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription, NotificationChain msgs) { |
99 | msgs = eBasicSetContainer((InternalEObject)newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription, ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION, msgs); |
100 | return msgs; |
101 | } |
102 | |
103 | /** |
104 | * <!-- begin-user-doc --> |
105 | * <!-- end-user-doc --> |
106 | * @generated |
107 | */ |
108 | public void setSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription(SpecifiedReliabilityAnnotation newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription) { |
109 | if (newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription != eInternalContainer() || (eContainerFeatureID() != ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION && newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription != null)) { |
110 | if (EcoreUtil.isAncestor(this, newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription)) |
111 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
112 | NotificationChain msgs = null; |
113 | if (eInternalContainer() != null) |
114 | msgs = eBasicRemoveFromContainer(msgs); |
115 | if (newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription != null) |
116 | msgs = ((InternalEObject)newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription).eInverseAdd(this, Qos_reliabilityPackage.SPECIFIED_RELIABILITY_ANNOTATION__EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTIONS_SPECIFIED_RELIABILITY_ANNOTATION, SpecifiedReliabilityAnnotation.class, msgs); |
117 | msgs = basicSetSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription(newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription, msgs); |
118 | if (msgs != null) msgs.dispatch(); |
119 | } |
120 | else if (eNotificationRequired()) |
121 | eNotify(new ENotificationImpl(this, Notification.SET, ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION, newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription, newSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription)); |
122 | } |
123 | |
124 | /** |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @generated |
128 | */ |
129 | public FailureType getFailureType__ExternalFailureOccurrenceDescription() { |
130 | if (failureType__ExternalFailureOccurrenceDescription != null && failureType__ExternalFailureOccurrenceDescription.eIsProxy()) { |
131 | InternalEObject oldFailureType__ExternalFailureOccurrenceDescription = (InternalEObject)failureType__ExternalFailureOccurrenceDescription; |
132 | failureType__ExternalFailureOccurrenceDescription = (FailureType)eResolveProxy(oldFailureType__ExternalFailureOccurrenceDescription); |
133 | if (failureType__ExternalFailureOccurrenceDescription != oldFailureType__ExternalFailureOccurrenceDescription) { |
134 | if (eNotificationRequired()) |
135 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_TYPE_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION, oldFailureType__ExternalFailureOccurrenceDescription, failureType__ExternalFailureOccurrenceDescription)); |
136 | } |
137 | } |
138 | return failureType__ExternalFailureOccurrenceDescription; |
139 | } |
140 | |
141 | /** |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @generated |
145 | */ |
146 | public FailureType basicGetFailureType__ExternalFailureOccurrenceDescription() { |
147 | return failureType__ExternalFailureOccurrenceDescription; |
148 | } |
149 | |
150 | /** |
151 | * <!-- begin-user-doc --> |
152 | * <!-- end-user-doc --> |
153 | * @generated |
154 | */ |
155 | public void setFailureType__ExternalFailureOccurrenceDescription(FailureType newFailureType__ExternalFailureOccurrenceDescription) { |
156 | FailureType oldFailureType__ExternalFailureOccurrenceDescription = failureType__ExternalFailureOccurrenceDescription; |
157 | failureType__ExternalFailureOccurrenceDescription = newFailureType__ExternalFailureOccurrenceDescription; |
158 | if (eNotificationRequired()) |
159 | eNotify(new ENotificationImpl(this, Notification.SET, ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_TYPE_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION, oldFailureType__ExternalFailureOccurrenceDescription, failureType__ExternalFailureOccurrenceDescription)); |
160 | } |
161 | |
162 | /** |
163 | * The cached OCL expression body for the '{@link #NoResourceTimeoutFailureAllowedForExternalFailureOccurrenceDescription(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>No Resource Timeout Failure Allowed For External Failure Occurrence Description</em>}' operation. |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @see #NoResourceTimeoutFailureAllowedForExternalFailureOccurrenceDescription(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
167 | * @generated |
168 | * @ordered |
169 | */ |
170 | protected static final String NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "not self.failureType__ExternalFailureOccurrenceDescription.oclIsTypeOf(ResourceTimeoutFailureType)"; |
171 | |
172 | /** |
173 | * The cached OCL invariant for the '{@link #NoResourceTimeoutFailureAllowedForExternalFailureOccurrenceDescription(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>No Resource Timeout Failure Allowed For External Failure Occurrence Description</em>}' invariant operation. |
174 | * <!-- begin-user-doc --> |
175 | * <!-- end-user-doc --> |
176 | * @see #NoResourceTimeoutFailureAllowedForExternalFailureOccurrenceDescription(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
177 | * @generated |
178 | * @ordered |
179 | */ |
180 | protected static Constraint NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
181 | |
182 | /** |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | public boolean NoResourceTimeoutFailureAllowedForExternalFailureOccurrenceDescription(DiagnosticChain diagnostics, Map<Object, Object> context) { |
188 | if (NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
189 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
190 | helper.setContext(ReliabilityPackage.Literals.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION); |
191 | try { |
192 | NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
193 | } |
194 | catch (ParserException pe) { |
195 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
196 | } |
197 | } |
198 | if (!EOCL_ENV.createQuery(NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
199 | if (diagnostics != null) { |
200 | diagnostics.add |
201 | (new BasicDiagnostic |
202 | (Diagnostic.ERROR, |
203 | ReliabilityValidator.DIAGNOSTIC_SOURCE, |
204 | ReliabilityValidator.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__NO_RESOURCE_TIMEOUT_FAILURE_ALLOWED_FOR_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION, |
205 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "NoResourceTimeoutFailureAllowedForExternalFailureOccurrenceDescription", EObjectValidator.getObjectLabel(this, context) }), |
206 | new Object [] { this })); |
207 | } |
208 | return false; |
209 | } |
210 | return true; |
211 | } |
212 | |
213 | /** |
214 | * <!-- begin-user-doc --> |
215 | * <!-- end-user-doc --> |
216 | * @generated |
217 | */ |
218 | @Override |
219 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
220 | switch (featureID) { |
221 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
222 | if (eInternalContainer() != null) |
223 | msgs = eBasicRemoveFromContainer(msgs); |
224 | return basicSetSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription((SpecifiedReliabilityAnnotation)otherEnd, msgs); |
225 | } |
226 | return super.eInverseAdd(otherEnd, featureID, msgs); |
227 | } |
228 | |
229 | /** |
230 | * <!-- begin-user-doc --> |
231 | * <!-- end-user-doc --> |
232 | * @generated |
233 | */ |
234 | @Override |
235 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
236 | switch (featureID) { |
237 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
238 | return basicSetSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription(null, msgs); |
239 | } |
240 | return super.eInverseRemove(otherEnd, featureID, msgs); |
241 | } |
242 | |
243 | /** |
244 | * <!-- begin-user-doc --> |
245 | * <!-- end-user-doc --> |
246 | * @generated |
247 | */ |
248 | @Override |
249 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
250 | switch (eContainerFeatureID()) { |
251 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
252 | return eInternalContainer().eInverseRemove(this, Qos_reliabilityPackage.SPECIFIED_RELIABILITY_ANNOTATION__EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTIONS_SPECIFIED_RELIABILITY_ANNOTATION, SpecifiedReliabilityAnnotation.class, msgs); |
253 | } |
254 | return super.eBasicRemoveFromContainerFeature(msgs); |
255 | } |
256 | |
257 | /** |
258 | * <!-- begin-user-doc --> |
259 | * <!-- end-user-doc --> |
260 | * @generated |
261 | */ |
262 | @Override |
263 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
264 | switch (featureID) { |
265 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
266 | return getSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription(); |
267 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_TYPE_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
268 | if (resolve) return getFailureType__ExternalFailureOccurrenceDescription(); |
269 | return basicGetFailureType__ExternalFailureOccurrenceDescription(); |
270 | } |
271 | return super.eGet(featureID, resolve, coreType); |
272 | } |
273 | |
274 | /** |
275 | * <!-- begin-user-doc --> |
276 | * <!-- end-user-doc --> |
277 | * @generated |
278 | */ |
279 | @Override |
280 | public void eSet(int featureID, Object newValue) { |
281 | switch (featureID) { |
282 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
283 | setSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription((SpecifiedReliabilityAnnotation)newValue); |
284 | return; |
285 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_TYPE_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
286 | setFailureType__ExternalFailureOccurrenceDescription((FailureType)newValue); |
287 | return; |
288 | } |
289 | super.eSet(featureID, newValue); |
290 | } |
291 | |
292 | /** |
293 | * <!-- begin-user-doc --> |
294 | * <!-- end-user-doc --> |
295 | * @generated |
296 | */ |
297 | @Override |
298 | public void eUnset(int featureID) { |
299 | switch (featureID) { |
300 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
301 | setSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription((SpecifiedReliabilityAnnotation)null); |
302 | return; |
303 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_TYPE_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
304 | setFailureType__ExternalFailureOccurrenceDescription((FailureType)null); |
305 | return; |
306 | } |
307 | super.eUnset(featureID); |
308 | } |
309 | |
310 | /** |
311 | * <!-- begin-user-doc --> |
312 | * <!-- end-user-doc --> |
313 | * @generated |
314 | */ |
315 | @Override |
316 | public boolean eIsSet(int featureID) { |
317 | switch (featureID) { |
318 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__SPECIFIED_RELIABILITY_ANNOTATION_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
319 | return getSpecifiedReliabilityAnnotation__ExternalFailureOccurrenceDescription() != null; |
320 | case ReliabilityPackage.EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION__FAILURE_TYPE_EXTERNAL_FAILURE_OCCURRENCE_DESCRIPTION: |
321 | return failureType__ExternalFailureOccurrenceDescription != null; |
322 | } |
323 | return super.eIsSet(featureID); |
324 | } |
325 | |
326 | } //ExternalFailureOccurrenceDescriptionImpl |