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.ocl.ParserException; |
21 | import org.eclipse.ocl.ecore.Constraint; |
22 | import org.eclipse.ocl.ecore.OCL; |
23 | |
24 | import de.uka.ipd.sdq.pcm.reliability.HardwareInducedFailureType; |
25 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
26 | import de.uka.ipd.sdq.pcm.reliability.util.ReliabilityValidator; |
27 | import de.uka.ipd.sdq.pcm.resourcetype.ProcessingResourceType; |
28 | import de.uka.ipd.sdq.pcm.resourcetype.ResourcetypePackage; |
29 | |
30 | /** |
31 | * <!-- begin-user-doc --> |
32 | * An implementation of the model object '<em><b>Hardware Induced Failure Type</b></em>'. |
33 | * <!-- end-user-doc --> |
34 | * <p> |
35 | * The following features are implemented: |
36 | * <ul> |
37 | * <li>{@link de.uka.ipd.sdq.pcm.reliability.impl.HardwareInducedFailureTypeImpl#getProcessingResourceType__HardwareInducedFailureType <em>Processing Resource Type Hardware Induced Failure Type</em>}</li> |
38 | * </ul> |
39 | * </p> |
40 | * |
41 | * @generated |
42 | */ |
43 | public class HardwareInducedFailureTypeImpl extends FailureTypeImpl implements HardwareInducedFailureType { |
44 | /** |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @generated |
48 | */ |
49 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
50 | |
51 | /** |
52 | * The cached value of the '{@link #getProcessingResourceType__HardwareInducedFailureType() <em>Processing Resource Type Hardware Induced Failure Type</em>}' reference. |
53 | * <!-- begin-user-doc --> |
54 | * <!-- end-user-doc --> |
55 | * @see #getProcessingResourceType__HardwareInducedFailureType() |
56 | * @generated |
57 | * @ordered |
58 | */ |
59 | protected ProcessingResourceType processingResourceType__HardwareInducedFailureType; |
60 | |
61 | /** |
62 | * <!-- begin-user-doc --> |
63 | * <!-- end-user-doc --> |
64 | * @generated |
65 | */ |
66 | protected HardwareInducedFailureTypeImpl() { |
67 | super(); |
68 | } |
69 | |
70 | /** |
71 | * <!-- begin-user-doc --> |
72 | * <!-- end-user-doc --> |
73 | * @generated |
74 | */ |
75 | @Override |
76 | protected EClass eStaticClass() { |
77 | return ReliabilityPackage.Literals.HARDWARE_INDUCED_FAILURE_TYPE; |
78 | } |
79 | |
80 | /** |
81 | * <!-- begin-user-doc --> |
82 | * <!-- end-user-doc --> |
83 | * @generated |
84 | */ |
85 | public ProcessingResourceType getProcessingResourceType__HardwareInducedFailureType() { |
86 | if (processingResourceType__HardwareInducedFailureType != null && processingResourceType__HardwareInducedFailureType.eIsProxy()) { |
87 | InternalEObject oldProcessingResourceType__HardwareInducedFailureType = (InternalEObject)processingResourceType__HardwareInducedFailureType; |
88 | processingResourceType__HardwareInducedFailureType = (ProcessingResourceType)eResolveProxy(oldProcessingResourceType__HardwareInducedFailureType); |
89 | if (processingResourceType__HardwareInducedFailureType != oldProcessingResourceType__HardwareInducedFailureType) { |
90 | if (eNotificationRequired()) |
91 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE, oldProcessingResourceType__HardwareInducedFailureType, processingResourceType__HardwareInducedFailureType)); |
92 | } |
93 | } |
94 | return processingResourceType__HardwareInducedFailureType; |
95 | } |
96 | |
97 | /** |
98 | * <!-- begin-user-doc --> |
99 | * <!-- end-user-doc --> |
100 | * @generated |
101 | */ |
102 | public ProcessingResourceType basicGetProcessingResourceType__HardwareInducedFailureType() { |
103 | return processingResourceType__HardwareInducedFailureType; |
104 | } |
105 | |
106 | /** |
107 | * <!-- begin-user-doc --> |
108 | * <!-- end-user-doc --> |
109 | * @generated |
110 | */ |
111 | public NotificationChain basicSetProcessingResourceType__HardwareInducedFailureType(ProcessingResourceType newProcessingResourceType__HardwareInducedFailureType, NotificationChain msgs) { |
112 | ProcessingResourceType oldProcessingResourceType__HardwareInducedFailureType = processingResourceType__HardwareInducedFailureType; |
113 | processingResourceType__HardwareInducedFailureType = newProcessingResourceType__HardwareInducedFailureType; |
114 | if (eNotificationRequired()) { |
115 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE, oldProcessingResourceType__HardwareInducedFailureType, newProcessingResourceType__HardwareInducedFailureType); |
116 | if (msgs == null) msgs = notification; else msgs.add(notification); |
117 | } |
118 | return msgs; |
119 | } |
120 | |
121 | /** |
122 | * <!-- begin-user-doc --> |
123 | * <!-- end-user-doc --> |
124 | * @generated |
125 | */ |
126 | public void setProcessingResourceType__HardwareInducedFailureType(ProcessingResourceType newProcessingResourceType__HardwareInducedFailureType) { |
127 | if (newProcessingResourceType__HardwareInducedFailureType != processingResourceType__HardwareInducedFailureType) { |
128 | NotificationChain msgs = null; |
129 | if (processingResourceType__HardwareInducedFailureType != null) |
130 | msgs = ((InternalEObject)processingResourceType__HardwareInducedFailureType).eInverseRemove(this, ResourcetypePackage.PROCESSING_RESOURCE_TYPE__HARDWARE_INDUCED_FAILURE_TYPE_PROCESSING_RESOURCE_TYPE, ProcessingResourceType.class, msgs); |
131 | if (newProcessingResourceType__HardwareInducedFailureType != null) |
132 | msgs = ((InternalEObject)newProcessingResourceType__HardwareInducedFailureType).eInverseAdd(this, ResourcetypePackage.PROCESSING_RESOURCE_TYPE__HARDWARE_INDUCED_FAILURE_TYPE_PROCESSING_RESOURCE_TYPE, ProcessingResourceType.class, msgs); |
133 | msgs = basicSetProcessingResourceType__HardwareInducedFailureType(newProcessingResourceType__HardwareInducedFailureType, msgs); |
134 | if (msgs != null) msgs.dispatch(); |
135 | } |
136 | else if (eNotificationRequired()) |
137 | eNotify(new ENotificationImpl(this, Notification.SET, ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE, newProcessingResourceType__HardwareInducedFailureType, newProcessingResourceType__HardwareInducedFailureType)); |
138 | } |
139 | |
140 | /** |
141 | * The cached OCL expression body for the '{@link #HardwareInducedFailureTypeHasProcessingResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Hardware Induced Failure Type Has Processing Resource Type</em>}' operation. |
142 | * <!-- begin-user-doc --> |
143 | * <!-- end-user-doc --> |
144 | * @see #HardwareInducedFailureTypeHasProcessingResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
145 | * @generated |
146 | * @ordered |
147 | */ |
148 | protected static final String HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "( self.processingResourceType__HardwareInducedFailureType <> null ) and ( not ( self.processingResourceType__HardwareInducedFailureType.oclIsTypeOf( pcm::resourcetype::CommunicationLinkResourceType ) ) )"; |
149 | |
150 | /** |
151 | * The cached OCL invariant for the '{@link #HardwareInducedFailureTypeHasProcessingResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Hardware Induced Failure Type Has Processing Resource Type</em>}' invariant operation. |
152 | * <!-- begin-user-doc --> |
153 | * <!-- end-user-doc --> |
154 | * @see #HardwareInducedFailureTypeHasProcessingResourceType(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
155 | * @generated |
156 | * @ordered |
157 | */ |
158 | protected static Constraint HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
159 | |
160 | /** |
161 | * <!-- begin-user-doc --> |
162 | * <!-- end-user-doc --> |
163 | * @generated |
164 | */ |
165 | public boolean HardwareInducedFailureTypeHasProcessingResourceType(DiagnosticChain diagnostics, Map<Object, Object> context) { |
166 | if (HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
167 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
168 | helper.setContext(ReliabilityPackage.Literals.HARDWARE_INDUCED_FAILURE_TYPE); |
169 | try { |
170 | HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
171 | } |
172 | catch (ParserException pe) { |
173 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
174 | } |
175 | } |
176 | if (!EOCL_ENV.createQuery(HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
177 | if (diagnostics != null) { |
178 | diagnostics.add |
179 | (new BasicDiagnostic |
180 | (Diagnostic.ERROR, |
181 | ReliabilityValidator.DIAGNOSTIC_SOURCE, |
182 | ReliabilityValidator.HARDWARE_INDUCED_FAILURE_TYPE__HARDWARE_INDUCED_FAILURE_TYPE_HAS_PROCESSING_RESOURCE_TYPE, |
183 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "HardwareInducedFailureTypeHasProcessingResourceType", EObjectValidator.getObjectLabel(this, context) }), |
184 | new Object [] { this })); |
185 | } |
186 | return false; |
187 | } |
188 | return true; |
189 | } |
190 | |
191 | /** |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | @Override |
197 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
198 | switch (featureID) { |
199 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE: |
200 | if (processingResourceType__HardwareInducedFailureType != null) |
201 | msgs = ((InternalEObject)processingResourceType__HardwareInducedFailureType).eInverseRemove(this, ResourcetypePackage.PROCESSING_RESOURCE_TYPE__HARDWARE_INDUCED_FAILURE_TYPE_PROCESSING_RESOURCE_TYPE, ProcessingResourceType.class, msgs); |
202 | return basicSetProcessingResourceType__HardwareInducedFailureType((ProcessingResourceType)otherEnd, msgs); |
203 | } |
204 | return super.eInverseAdd(otherEnd, featureID, msgs); |
205 | } |
206 | |
207 | /** |
208 | * <!-- begin-user-doc --> |
209 | * <!-- end-user-doc --> |
210 | * @generated |
211 | */ |
212 | @Override |
213 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
214 | switch (featureID) { |
215 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE: |
216 | return basicSetProcessingResourceType__HardwareInducedFailureType(null, msgs); |
217 | } |
218 | return super.eInverseRemove(otherEnd, featureID, msgs); |
219 | } |
220 | |
221 | /** |
222 | * <!-- begin-user-doc --> |
223 | * <!-- end-user-doc --> |
224 | * @generated |
225 | */ |
226 | @Override |
227 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
228 | switch (featureID) { |
229 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE: |
230 | if (resolve) return getProcessingResourceType__HardwareInducedFailureType(); |
231 | return basicGetProcessingResourceType__HardwareInducedFailureType(); |
232 | } |
233 | return super.eGet(featureID, resolve, coreType); |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | @Override |
242 | public void eSet(int featureID, Object newValue) { |
243 | switch (featureID) { |
244 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE: |
245 | setProcessingResourceType__HardwareInducedFailureType((ProcessingResourceType)newValue); |
246 | return; |
247 | } |
248 | super.eSet(featureID, newValue); |
249 | } |
250 | |
251 | /** |
252 | * <!-- begin-user-doc --> |
253 | * <!-- end-user-doc --> |
254 | * @generated |
255 | */ |
256 | @Override |
257 | public void eUnset(int featureID) { |
258 | switch (featureID) { |
259 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE: |
260 | setProcessingResourceType__HardwareInducedFailureType((ProcessingResourceType)null); |
261 | return; |
262 | } |
263 | super.eUnset(featureID); |
264 | } |
265 | |
266 | /** |
267 | * <!-- begin-user-doc --> |
268 | * <!-- end-user-doc --> |
269 | * @generated |
270 | */ |
271 | @Override |
272 | public boolean eIsSet(int featureID) { |
273 | switch (featureID) { |
274 | case ReliabilityPackage.HARDWARE_INDUCED_FAILURE_TYPE__PROCESSING_RESOURCE_TYPE_HARDWARE_INDUCED_FAILURE_TYPE: |
275 | return processingResourceType__HardwareInducedFailureType != null; |
276 | } |
277 | return super.eIsSet(featureID); |
278 | } |
279 | |
280 | /** |
281 | * The cached environment for evaluating OCL expressions. |
282 | * <!-- begin-user-doc --> |
283 | * <!-- end-user-doc --> |
284 | * @generated |
285 | * @ordered |
286 | */ |
287 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
288 | |
289 | } //HardwareInducedFailureTypeImpl |