1 | /** |
2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.pcm.seff.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.impl.EObjectImpl; |
19 | import org.eclipse.emf.ecore.plugin.EcorePlugin; |
20 | import org.eclipse.emf.ecore.util.EObjectValidator; |
21 | import org.eclipse.emf.ecore.util.EcoreUtil; |
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.repository.BasicComponent; |
27 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
28 | import de.uka.ipd.sdq.pcm.repository.Signature; |
29 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
30 | import de.uka.ipd.sdq.pcm.seff.ServiceEffectSpecification; |
31 | import de.uka.ipd.sdq.pcm.seff.util.SeffValidator; |
32 | |
33 | /** |
34 | * <!-- begin-user-doc --> |
35 | * An implementation of the model object '<em><b>Service Effect Specification</b></em>'. |
36 | * <!-- end-user-doc --> |
37 | * <p> |
38 | * The following features are implemented: |
39 | * <ul> |
40 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ServiceEffectSpecificationImpl#getSeffTypeID <em>Seff Type ID</em>}</li> |
41 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ServiceEffectSpecificationImpl#getDescribedService__SEFF <em>Described Service SEFF</em>}</li> |
42 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ServiceEffectSpecificationImpl#getBasicComponent_ServiceEffectSpecification <em>Basic Component Service Effect Specification</em>}</li> |
43 | * </ul> |
44 | * </p> |
45 | * |
46 | * @generated |
47 | */ |
48 | public abstract class ServiceEffectSpecificationImpl extends EObjectImpl implements ServiceEffectSpecification { |
49 | /** |
50 | * <!-- begin-user-doc --> |
51 | * <!-- end-user-doc --> |
52 | * @generated |
53 | */ |
54 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
55 | |
56 | /** |
57 | * The default value of the '{@link #getSeffTypeID() <em>Seff Type ID</em>}' attribute. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @see #getSeffTypeID() |
61 | * @generated |
62 | * @ordered |
63 | */ |
64 | protected static final String SEFF_TYPE_ID_EDEFAULT = "1"; |
65 | |
66 | /** |
67 | * The cached value of the '{@link #getSeffTypeID() <em>Seff Type ID</em>}' attribute. |
68 | * <!-- begin-user-doc --> |
69 | * <!-- end-user-doc --> |
70 | * @see #getSeffTypeID() |
71 | * @generated |
72 | * @ordered |
73 | */ |
74 | protected String seffTypeID = SEFF_TYPE_ID_EDEFAULT; |
75 | |
76 | /** |
77 | * The cached value of the '{@link #getDescribedService__SEFF() <em>Described Service SEFF</em>}' reference. |
78 | * <!-- begin-user-doc --> |
79 | * <!-- end-user-doc --> |
80 | * @see #getDescribedService__SEFF() |
81 | * @generated |
82 | * @ordered |
83 | */ |
84 | protected Signature describedService__SEFF; |
85 | |
86 | /** |
87 | * <!-- begin-user-doc --> |
88 | * <!-- end-user-doc --> |
89 | * @generated |
90 | */ |
91 | protected ServiceEffectSpecificationImpl() { |
92 | super(); |
93 | } |
94 | |
95 | /** |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @generated |
99 | */ |
100 | @Override |
101 | protected EClass eStaticClass() { |
102 | return SeffPackage.Literals.SERVICE_EFFECT_SPECIFICATION; |
103 | } |
104 | |
105 | /** |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @generated |
109 | */ |
110 | public String getSeffTypeID() { |
111 | return seffTypeID; |
112 | } |
113 | |
114 | /** |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @generated |
118 | */ |
119 | public void setSeffTypeID(String newSeffTypeID) { |
120 | String oldSeffTypeID = seffTypeID; |
121 | seffTypeID = newSeffTypeID; |
122 | if (eNotificationRequired()) |
123 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.SERVICE_EFFECT_SPECIFICATION__SEFF_TYPE_ID, oldSeffTypeID, seffTypeID)); |
124 | } |
125 | |
126 | /** |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | public Signature getDescribedService__SEFF() { |
132 | if (describedService__SEFF != null && describedService__SEFF.eIsProxy()) { |
133 | InternalEObject oldDescribedService__SEFF = (InternalEObject)describedService__SEFF; |
134 | describedService__SEFF = (Signature)eResolveProxy(oldDescribedService__SEFF); |
135 | if (describedService__SEFF != oldDescribedService__SEFF) { |
136 | if (eNotificationRequired()) |
137 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, SeffPackage.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF, oldDescribedService__SEFF, describedService__SEFF)); |
138 | } |
139 | } |
140 | return describedService__SEFF; |
141 | } |
142 | |
143 | /** |
144 | * <!-- begin-user-doc --> |
145 | * <!-- end-user-doc --> |
146 | * @generated |
147 | */ |
148 | public Signature basicGetDescribedService__SEFF() { |
149 | return describedService__SEFF; |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | public void setDescribedService__SEFF(Signature newDescribedService__SEFF) { |
158 | Signature oldDescribedService__SEFF = describedService__SEFF; |
159 | describedService__SEFF = newDescribedService__SEFF; |
160 | if (eNotificationRequired()) |
161 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF, oldDescribedService__SEFF, describedService__SEFF)); |
162 | } |
163 | |
164 | /** |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @generated |
168 | */ |
169 | public BasicComponent getBasicComponent_ServiceEffectSpecification() { |
170 | if (eContainerFeatureID() != SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION) return null; |
171 | return (BasicComponent)eContainer(); |
172 | } |
173 | |
174 | /** |
175 | * <!-- begin-user-doc --> |
176 | * <!-- end-user-doc --> |
177 | * @generated |
178 | */ |
179 | public NotificationChain basicSetBasicComponent_ServiceEffectSpecification(BasicComponent newBasicComponent_ServiceEffectSpecification, NotificationChain msgs) { |
180 | msgs = eBasicSetContainer((InternalEObject)newBasicComponent_ServiceEffectSpecification, SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION, msgs); |
181 | return msgs; |
182 | } |
183 | |
184 | /** |
185 | * <!-- begin-user-doc --> |
186 | * <!-- end-user-doc --> |
187 | * @generated |
188 | */ |
189 | public void setBasicComponent_ServiceEffectSpecification(BasicComponent newBasicComponent_ServiceEffectSpecification) { |
190 | if (newBasicComponent_ServiceEffectSpecification != eInternalContainer() || (eContainerFeatureID() != SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION && newBasicComponent_ServiceEffectSpecification != null)) { |
191 | if (EcoreUtil.isAncestor(this, newBasicComponent_ServiceEffectSpecification)) |
192 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
193 | NotificationChain msgs = null; |
194 | if (eInternalContainer() != null) |
195 | msgs = eBasicRemoveFromContainer(msgs); |
196 | if (newBasicComponent_ServiceEffectSpecification != null) |
197 | msgs = ((InternalEObject)newBasicComponent_ServiceEffectSpecification).eInverseAdd(this, RepositoryPackage.BASIC_COMPONENT__SERVICE_EFFECT_SPECIFICATIONS_BASIC_COMPONENT, BasicComponent.class, msgs); |
198 | msgs = basicSetBasicComponent_ServiceEffectSpecification(newBasicComponent_ServiceEffectSpecification, msgs); |
199 | if (msgs != null) msgs.dispatch(); |
200 | } |
201 | else if (eNotificationRequired()) |
202 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION, newBasicComponent_ServiceEffectSpecification, newBasicComponent_ServiceEffectSpecification)); |
203 | } |
204 | |
205 | /** |
206 | * The cached OCL expression body for the '{@link #ReferencedSignatureMustBelongToInterfaceReferencedByProvidedRole(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Referenced Signature Must Belong To Interface Referenced By Provided Role</em>}' operation. |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @see #ReferencedSignatureMustBelongToInterfaceReferencedByProvidedRole(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
210 | * @generated |
211 | * @ordered |
212 | */ |
213 | protected static final String REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP = "if self.describedService__SEFF.oclIsKindOf(pcm::repository::OperationSignature) then\n"+" self.basicComponent_ServiceEffectSpecification.providedRoles_InterfaceProvidingEntity->exists(p | p.oclIsKindOf(pcm::repository::OperationProvidedRole) and (p.oclAsType(pcm::repository::OperationProvidedRole).providedInterface__OperationProvidedRole = self.describedService__SEFF.oclAsType(pcm::repository::OperationSignature).interface__OperationSignature))\n"+"else\n"+" if self.describedService__SEFF.oclIsKindOf(pcm::repository::EventType) then\n"+" self.basicComponent_ServiceEffectSpecification.providedRoles_InterfaceProvidingEntity->exists(p | p.oclIsKindOf(pcm::repository::SinkRole) and (p.oclAsType(pcm::repository::SinkRole).eventGroup__SinkRole = self.describedService__SEFF.oclAsType(pcm::repository::EventType).eventGroup__EventType))\n"+" else\n"+" true\n"+" endif\n"+"endif"; |
214 | |
215 | /** |
216 | * The cached OCL invariant for the '{@link #ReferencedSignatureMustBelongToInterfaceReferencedByProvidedRole(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) <em>Referenced Signature Must Belong To Interface Referenced By Provided Role</em>}' invariant operation. |
217 | * <!-- begin-user-doc --> |
218 | * <!-- end-user-doc --> |
219 | * @see #ReferencedSignatureMustBelongToInterfaceReferencedByProvidedRole(org.eclipse.emf.common.util.DiagnosticChain, java.util.Map) |
220 | * @generated |
221 | * @ordered |
222 | */ |
223 | protected static Constraint REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV; |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | public boolean ReferencedSignatureMustBelongToInterfaceReferencedByProvidedRole(DiagnosticChain diagnostics, Map<Object, Object> context) { |
231 | if (REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV == null) { |
232 | OCL.Helper helper = EOCL_ENV.createOCLHelper(); |
233 | helper.setContext(SeffPackage.Literals.SERVICE_EFFECT_SPECIFICATION); |
234 | try { |
235 | REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV = helper.createInvariant(REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE__DIAGNOSTIC_CHAIN_MAP__EOCL_EXP); |
236 | } |
237 | catch (ParserException pe) { |
238 | throw new UnsupportedOperationException(pe.getLocalizedMessage()); |
239 | } |
240 | } |
241 | if (!EOCL_ENV.createQuery(REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE__DIAGNOSTIC_CHAIN_MAP__EOCL_INV).check(this)) { |
242 | if (diagnostics != null) { |
243 | diagnostics.add |
244 | (new BasicDiagnostic |
245 | (Diagnostic.ERROR, |
246 | SeffValidator.DIAGNOSTIC_SOURCE, |
247 | SeffValidator.SERVICE_EFFECT_SPECIFICATION__REFERENCED_SIGNATURE_MUST_BELONG_TO_INTERFACE_REFERENCED_BY_PROVIDED_ROLE, |
248 | EcorePlugin.INSTANCE.getString("_UI_GenericInvariant_diagnostic", new Object[] { "ReferencedSignatureMustBelongToInterfaceReferencedByProvidedRole", EObjectValidator.getObjectLabel(this, context) }), |
249 | new Object [] { this })); |
250 | } |
251 | return false; |
252 | } |
253 | return true; |
254 | } |
255 | |
256 | /** |
257 | * <!-- begin-user-doc --> |
258 | * <!-- end-user-doc --> |
259 | * @generated |
260 | */ |
261 | @Override |
262 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
263 | switch (featureID) { |
264 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
265 | if (eInternalContainer() != null) |
266 | msgs = eBasicRemoveFromContainer(msgs); |
267 | return basicSetBasicComponent_ServiceEffectSpecification((BasicComponent)otherEnd, msgs); |
268 | } |
269 | return super.eInverseAdd(otherEnd, featureID, msgs); |
270 | } |
271 | |
272 | /** |
273 | * <!-- begin-user-doc --> |
274 | * <!-- end-user-doc --> |
275 | * @generated |
276 | */ |
277 | @Override |
278 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
279 | switch (featureID) { |
280 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
281 | return basicSetBasicComponent_ServiceEffectSpecification(null, msgs); |
282 | } |
283 | return super.eInverseRemove(otherEnd, featureID, msgs); |
284 | } |
285 | |
286 | /** |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | @Override |
292 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
293 | switch (eContainerFeatureID()) { |
294 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
295 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.BASIC_COMPONENT__SERVICE_EFFECT_SPECIFICATIONS_BASIC_COMPONENT, BasicComponent.class, msgs); |
296 | } |
297 | return super.eBasicRemoveFromContainerFeature(msgs); |
298 | } |
299 | |
300 | /** |
301 | * <!-- begin-user-doc --> |
302 | * <!-- end-user-doc --> |
303 | * @generated |
304 | */ |
305 | @Override |
306 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
307 | switch (featureID) { |
308 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__SEFF_TYPE_ID: |
309 | return getSeffTypeID(); |
310 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF: |
311 | if (resolve) return getDescribedService__SEFF(); |
312 | return basicGetDescribedService__SEFF(); |
313 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
314 | return getBasicComponent_ServiceEffectSpecification(); |
315 | } |
316 | return super.eGet(featureID, resolve, coreType); |
317 | } |
318 | |
319 | /** |
320 | * <!-- begin-user-doc --> |
321 | * <!-- end-user-doc --> |
322 | * @generated |
323 | */ |
324 | @Override |
325 | public void eSet(int featureID, Object newValue) { |
326 | switch (featureID) { |
327 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__SEFF_TYPE_ID: |
328 | setSeffTypeID((String)newValue); |
329 | return; |
330 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF: |
331 | setDescribedService__SEFF((Signature)newValue); |
332 | return; |
333 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
334 | setBasicComponent_ServiceEffectSpecification((BasicComponent)newValue); |
335 | return; |
336 | } |
337 | super.eSet(featureID, newValue); |
338 | } |
339 | |
340 | /** |
341 | * <!-- begin-user-doc --> |
342 | * <!-- end-user-doc --> |
343 | * @generated |
344 | */ |
345 | @Override |
346 | public void eUnset(int featureID) { |
347 | switch (featureID) { |
348 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__SEFF_TYPE_ID: |
349 | setSeffTypeID(SEFF_TYPE_ID_EDEFAULT); |
350 | return; |
351 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF: |
352 | setDescribedService__SEFF((Signature)null); |
353 | return; |
354 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
355 | setBasicComponent_ServiceEffectSpecification((BasicComponent)null); |
356 | return; |
357 | } |
358 | super.eUnset(featureID); |
359 | } |
360 | |
361 | /** |
362 | * <!-- begin-user-doc --> |
363 | * <!-- end-user-doc --> |
364 | * @generated |
365 | */ |
366 | @Override |
367 | public boolean eIsSet(int featureID) { |
368 | switch (featureID) { |
369 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__SEFF_TYPE_ID: |
370 | return SEFF_TYPE_ID_EDEFAULT == null ? seffTypeID != null : !SEFF_TYPE_ID_EDEFAULT.equals(seffTypeID); |
371 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__DESCRIBED_SERVICE_SEFF: |
372 | return describedService__SEFF != null; |
373 | case SeffPackage.SERVICE_EFFECT_SPECIFICATION__BASIC_COMPONENT_SERVICE_EFFECT_SPECIFICATION: |
374 | return getBasicComponent_ServiceEffectSpecification() != null; |
375 | } |
376 | return super.eIsSet(featureID); |
377 | } |
378 | |
379 | /** |
380 | * <!-- begin-user-doc --> |
381 | * <!-- end-user-doc --> |
382 | * @generated |
383 | */ |
384 | @Override |
385 | public String toString() { |
386 | if (eIsProxy()) return super.toString(); |
387 | |
388 | StringBuffer result = new StringBuffer(super.toString()); |
389 | result.append(" (seffTypeID: "); |
390 | result.append(seffTypeID); |
391 | result.append(')'); |
392 | return result.toString(); |
393 | } |
394 | |
395 | /** |
396 | * The cached environment for evaluating OCL expressions. |
397 | * <!-- begin-user-doc --> |
398 | * <!-- end-user-doc --> |
399 | * @generated |
400 | * @ordered |
401 | */ |
402 | protected static final OCL EOCL_ENV = OCL.newInstance(); |
403 | |
404 | } //ServiceEffectSpecificationImpl |