1 | /** |
2 | * Copyright 2006, SDQ Group, University Karlsruhe (TH) |
3 | * |
4 | * $Id$ |
5 | */ |
6 | package de.uka.ipd.sdq.context.aggregatedUsageContext.impl; |
7 | |
8 | import org.eclipse.emf.common.notify.Notification; |
9 | import org.eclipse.emf.common.notify.NotificationChain; |
10 | import org.eclipse.emf.ecore.EClass; |
11 | import org.eclipse.emf.ecore.InternalEObject; |
12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
13 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
14 | |
15 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedCommunication; |
16 | import de.uka.ipd.sdq.context.aggregatedUsageContext.AggregatedUsageContextPackage; |
17 | import de.uka.ipd.sdq.context.aggregatedUsageContext.ServiceExecutionContext; |
18 | import de.uka.ipd.sdq.pcm.resourceenvironment.CommunicationLinkResourceSpecification; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model object '<em><b>Aggregated Communication</b></em>'. |
23 | * <!-- end-user-doc --> |
24 | * <p> |
25 | * The following features are implemented: |
26 | * <ul> |
27 | * <li>{@link de.uka.ipd.sdq.context.aggregatedUsageContext.impl.AggregatedCommunicationImpl#getAverageMessageSize <em>Average Message Size</em>}</li> |
28 | * <li>{@link de.uka.ipd.sdq.context.aggregatedUsageContext.impl.AggregatedCommunicationImpl#getAverageMessageFrequency <em>Average Message Frequency</em>}</li> |
29 | * <li>{@link de.uka.ipd.sdq.context.aggregatedUsageContext.impl.AggregatedCommunicationImpl#getReceiver_AggregatedCommunication <em>Receiver Aggregated Communication</em>}</li> |
30 | * <li>{@link de.uka.ipd.sdq.context.aggregatedUsageContext.impl.AggregatedCommunicationImpl#getUsedCommunicationLinkResourceSpecification_AggregatedCommunication <em>Used Communication Link Resource Specification Aggregated Communication</em>}</li> |
31 | * </ul> |
32 | * </p> |
33 | * |
34 | * @generated |
35 | */ |
36 | public class AggregatedCommunicationImpl extends EObjectImpl implements AggregatedCommunication { |
37 | /** |
38 | * <!-- begin-user-doc --> |
39 | * <!-- end-user-doc --> |
40 | * @generated |
41 | */ |
42 | public static final String copyright = "Copyright 2006, SDQ Group, University Karlsruhe (TH)"; |
43 | |
44 | /** |
45 | * The default value of the '{@link #getAverageMessageSize() <em>Average Message Size</em>}' attribute. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @see #getAverageMessageSize() |
49 | * @generated |
50 | * @ordered |
51 | */ |
52 | protected static final double AVERAGE_MESSAGE_SIZE_EDEFAULT = 0.0; |
53 | |
54 | /** |
55 | * The cached value of the '{@link #getAverageMessageSize() <em>Average Message Size</em>}' attribute. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @see #getAverageMessageSize() |
59 | * @generated |
60 | * @ordered |
61 | */ |
62 | protected double averageMessageSize = AVERAGE_MESSAGE_SIZE_EDEFAULT; |
63 | |
64 | /** |
65 | * The default value of the '{@link #getAverageMessageFrequency() <em>Average Message Frequency</em>}' attribute. |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @see #getAverageMessageFrequency() |
69 | * @generated |
70 | * @ordered |
71 | */ |
72 | protected static final double AVERAGE_MESSAGE_FREQUENCY_EDEFAULT = 0.0; |
73 | |
74 | /** |
75 | * The cached value of the '{@link #getAverageMessageFrequency() <em>Average Message Frequency</em>}' attribute. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @see #getAverageMessageFrequency() |
79 | * @generated |
80 | * @ordered |
81 | */ |
82 | protected double averageMessageFrequency = AVERAGE_MESSAGE_FREQUENCY_EDEFAULT; |
83 | |
84 | /** |
85 | * The cached value of the '{@link #getReceiver_AggregatedCommunication() <em>Receiver Aggregated Communication</em>}' reference. |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @see #getReceiver_AggregatedCommunication() |
89 | * @generated |
90 | * @ordered |
91 | */ |
92 | protected ServiceExecutionContext receiver_AggregatedCommunication; |
93 | |
94 | /** |
95 | * The cached value of the '{@link #getUsedCommunicationLinkResourceSpecification_AggregatedCommunication() <em>Used Communication Link Resource Specification Aggregated Communication</em>}' reference. |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @see #getUsedCommunicationLinkResourceSpecification_AggregatedCommunication() |
99 | * @generated |
100 | * @ordered |
101 | */ |
102 | protected CommunicationLinkResourceSpecification usedCommunicationLinkResourceSpecification_AggregatedCommunication; |
103 | |
104 | /** |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @generated |
108 | */ |
109 | protected AggregatedCommunicationImpl() { |
110 | super(); |
111 | } |
112 | |
113 | /** |
114 | * <!-- begin-user-doc --> |
115 | * <!-- end-user-doc --> |
116 | * @generated |
117 | */ |
118 | @Override |
119 | protected EClass eStaticClass() { |
120 | return AggregatedUsageContextPackage.Literals.AGGREGATED_COMMUNICATION; |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | public double getAverageMessageSize() { |
129 | return averageMessageSize; |
130 | } |
131 | |
132 | /** |
133 | * <!-- begin-user-doc --> |
134 | * <!-- end-user-doc --> |
135 | * @generated |
136 | */ |
137 | public void setAverageMessageSize(double newAverageMessageSize) { |
138 | double oldAverageMessageSize = averageMessageSize; |
139 | averageMessageSize = newAverageMessageSize; |
140 | if (eNotificationRequired()) |
141 | eNotify(new ENotificationImpl(this, Notification.SET, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE, oldAverageMessageSize, averageMessageSize)); |
142 | } |
143 | |
144 | /** |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | public double getAverageMessageFrequency() { |
150 | return averageMessageFrequency; |
151 | } |
152 | |
153 | /** |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | public void setAverageMessageFrequency(double newAverageMessageFrequency) { |
159 | double oldAverageMessageFrequency = averageMessageFrequency; |
160 | averageMessageFrequency = newAverageMessageFrequency; |
161 | if (eNotificationRequired()) |
162 | eNotify(new ENotificationImpl(this, Notification.SET, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY, oldAverageMessageFrequency, averageMessageFrequency)); |
163 | } |
164 | |
165 | /** |
166 | * <!-- begin-user-doc --> |
167 | * <!-- end-user-doc --> |
168 | * @generated |
169 | */ |
170 | public ServiceExecutionContext getReceiver_AggregatedCommunication() { |
171 | if (receiver_AggregatedCommunication != null && receiver_AggregatedCommunication.eIsProxy()) { |
172 | InternalEObject oldReceiver_AggregatedCommunication = (InternalEObject)receiver_AggregatedCommunication; |
173 | receiver_AggregatedCommunication = (ServiceExecutionContext)eResolveProxy(oldReceiver_AggregatedCommunication); |
174 | if (receiver_AggregatedCommunication != oldReceiver_AggregatedCommunication) { |
175 | if (eNotificationRequired()) |
176 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION, oldReceiver_AggregatedCommunication, receiver_AggregatedCommunication)); |
177 | } |
178 | } |
179 | return receiver_AggregatedCommunication; |
180 | } |
181 | |
182 | /** |
183 | * <!-- begin-user-doc --> |
184 | * <!-- end-user-doc --> |
185 | * @generated |
186 | */ |
187 | public ServiceExecutionContext basicGetReceiver_AggregatedCommunication() { |
188 | return receiver_AggregatedCommunication; |
189 | } |
190 | |
191 | /** |
192 | * <!-- begin-user-doc --> |
193 | * <!-- end-user-doc --> |
194 | * @generated |
195 | */ |
196 | public NotificationChain basicSetReceiver_AggregatedCommunication(ServiceExecutionContext newReceiver_AggregatedCommunication, NotificationChain msgs) { |
197 | ServiceExecutionContext oldReceiver_AggregatedCommunication = receiver_AggregatedCommunication; |
198 | receiver_AggregatedCommunication = newReceiver_AggregatedCommunication; |
199 | if (eNotificationRequired()) { |
200 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION, oldReceiver_AggregatedCommunication, newReceiver_AggregatedCommunication); |
201 | if (msgs == null) msgs = notification; else msgs.add(notification); |
202 | } |
203 | return msgs; |
204 | } |
205 | |
206 | /** |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | public void setReceiver_AggregatedCommunication(ServiceExecutionContext newReceiver_AggregatedCommunication) { |
212 | if (newReceiver_AggregatedCommunication != receiver_AggregatedCommunication) { |
213 | NotificationChain msgs = null; |
214 | if (receiver_AggregatedCommunication != null) |
215 | msgs = ((InternalEObject)receiver_AggregatedCommunication).eInverseRemove(this, AggregatedUsageContextPackage.SERVICE_EXECUTION_CONTEXT__RECEIVED_AGGREGATED_COMMUNICATION_AGGREGATED_COMMUNICATION, ServiceExecutionContext.class, msgs); |
216 | if (newReceiver_AggregatedCommunication != null) |
217 | msgs = ((InternalEObject)newReceiver_AggregatedCommunication).eInverseAdd(this, AggregatedUsageContextPackage.SERVICE_EXECUTION_CONTEXT__RECEIVED_AGGREGATED_COMMUNICATION_AGGREGATED_COMMUNICATION, ServiceExecutionContext.class, msgs); |
218 | msgs = basicSetReceiver_AggregatedCommunication(newReceiver_AggregatedCommunication, msgs); |
219 | if (msgs != null) msgs.dispatch(); |
220 | } |
221 | else if (eNotificationRequired()) |
222 | eNotify(new ENotificationImpl(this, Notification.SET, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION, newReceiver_AggregatedCommunication, newReceiver_AggregatedCommunication)); |
223 | } |
224 | |
225 | /** |
226 | * <!-- begin-user-doc --> |
227 | * <!-- end-user-doc --> |
228 | * @generated |
229 | */ |
230 | public CommunicationLinkResourceSpecification getUsedCommunicationLinkResourceSpecification_AggregatedCommunication() { |
231 | if (usedCommunicationLinkResourceSpecification_AggregatedCommunication != null && usedCommunicationLinkResourceSpecification_AggregatedCommunication.eIsProxy()) { |
232 | InternalEObject oldUsedCommunicationLinkResourceSpecification_AggregatedCommunication = (InternalEObject)usedCommunicationLinkResourceSpecification_AggregatedCommunication; |
233 | usedCommunicationLinkResourceSpecification_AggregatedCommunication = (CommunicationLinkResourceSpecification)eResolveProxy(oldUsedCommunicationLinkResourceSpecification_AggregatedCommunication); |
234 | if (usedCommunicationLinkResourceSpecification_AggregatedCommunication != oldUsedCommunicationLinkResourceSpecification_AggregatedCommunication) { |
235 | if (eNotificationRequired()) |
236 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION, oldUsedCommunicationLinkResourceSpecification_AggregatedCommunication, usedCommunicationLinkResourceSpecification_AggregatedCommunication)); |
237 | } |
238 | } |
239 | return usedCommunicationLinkResourceSpecification_AggregatedCommunication; |
240 | } |
241 | |
242 | /** |
243 | * <!-- begin-user-doc --> |
244 | * <!-- end-user-doc --> |
245 | * @generated |
246 | */ |
247 | public CommunicationLinkResourceSpecification basicGetUsedCommunicationLinkResourceSpecification_AggregatedCommunication() { |
248 | return usedCommunicationLinkResourceSpecification_AggregatedCommunication; |
249 | } |
250 | |
251 | /** |
252 | * <!-- begin-user-doc --> |
253 | * <!-- end-user-doc --> |
254 | * @generated |
255 | */ |
256 | public void setUsedCommunicationLinkResourceSpecification_AggregatedCommunication(CommunicationLinkResourceSpecification newUsedCommunicationLinkResourceSpecification_AggregatedCommunication) { |
257 | CommunicationLinkResourceSpecification oldUsedCommunicationLinkResourceSpecification_AggregatedCommunication = usedCommunicationLinkResourceSpecification_AggregatedCommunication; |
258 | usedCommunicationLinkResourceSpecification_AggregatedCommunication = newUsedCommunicationLinkResourceSpecification_AggregatedCommunication; |
259 | if (eNotificationRequired()) |
260 | eNotify(new ENotificationImpl(this, Notification.SET, AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION, oldUsedCommunicationLinkResourceSpecification_AggregatedCommunication, usedCommunicationLinkResourceSpecification_AggregatedCommunication)); |
261 | } |
262 | |
263 | /** |
264 | * <!-- begin-user-doc --> |
265 | * <!-- end-user-doc --> |
266 | * @generated |
267 | */ |
268 | @Override |
269 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
270 | switch (featureID) { |
271 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION: |
272 | if (receiver_AggregatedCommunication != null) |
273 | msgs = ((InternalEObject)receiver_AggregatedCommunication).eInverseRemove(this, AggregatedUsageContextPackage.SERVICE_EXECUTION_CONTEXT__RECEIVED_AGGREGATED_COMMUNICATION_AGGREGATED_COMMUNICATION, ServiceExecutionContext.class, msgs); |
274 | return basicSetReceiver_AggregatedCommunication((ServiceExecutionContext)otherEnd, msgs); |
275 | } |
276 | return super.eInverseAdd(otherEnd, featureID, msgs); |
277 | } |
278 | |
279 | /** |
280 | * <!-- begin-user-doc --> |
281 | * <!-- end-user-doc --> |
282 | * @generated |
283 | */ |
284 | @Override |
285 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
286 | switch (featureID) { |
287 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION: |
288 | return basicSetReceiver_AggregatedCommunication(null, msgs); |
289 | } |
290 | return super.eInverseRemove(otherEnd, featureID, msgs); |
291 | } |
292 | |
293 | /** |
294 | * <!-- begin-user-doc --> |
295 | * <!-- end-user-doc --> |
296 | * @generated |
297 | */ |
298 | @Override |
299 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
300 | switch (featureID) { |
301 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE: |
302 | return getAverageMessageSize(); |
303 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY: |
304 | return getAverageMessageFrequency(); |
305 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION: |
306 | if (resolve) return getReceiver_AggregatedCommunication(); |
307 | return basicGetReceiver_AggregatedCommunication(); |
308 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION: |
309 | if (resolve) return getUsedCommunicationLinkResourceSpecification_AggregatedCommunication(); |
310 | return basicGetUsedCommunicationLinkResourceSpecification_AggregatedCommunication(); |
311 | } |
312 | return super.eGet(featureID, resolve, coreType); |
313 | } |
314 | |
315 | /** |
316 | * <!-- begin-user-doc --> |
317 | * <!-- end-user-doc --> |
318 | * @generated |
319 | */ |
320 | @Override |
321 | public void eSet(int featureID, Object newValue) { |
322 | switch (featureID) { |
323 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE: |
324 | setAverageMessageSize((Double)newValue); |
325 | return; |
326 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY: |
327 | setAverageMessageFrequency((Double)newValue); |
328 | return; |
329 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION: |
330 | setReceiver_AggregatedCommunication((ServiceExecutionContext)newValue); |
331 | return; |
332 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION: |
333 | setUsedCommunicationLinkResourceSpecification_AggregatedCommunication((CommunicationLinkResourceSpecification)newValue); |
334 | return; |
335 | } |
336 | super.eSet(featureID, newValue); |
337 | } |
338 | |
339 | /** |
340 | * <!-- begin-user-doc --> |
341 | * <!-- end-user-doc --> |
342 | * @generated |
343 | */ |
344 | @Override |
345 | public void eUnset(int featureID) { |
346 | switch (featureID) { |
347 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE: |
348 | setAverageMessageSize(AVERAGE_MESSAGE_SIZE_EDEFAULT); |
349 | return; |
350 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY: |
351 | setAverageMessageFrequency(AVERAGE_MESSAGE_FREQUENCY_EDEFAULT); |
352 | return; |
353 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION: |
354 | setReceiver_AggregatedCommunication((ServiceExecutionContext)null); |
355 | return; |
356 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION: |
357 | setUsedCommunicationLinkResourceSpecification_AggregatedCommunication((CommunicationLinkResourceSpecification)null); |
358 | return; |
359 | } |
360 | super.eUnset(featureID); |
361 | } |
362 | |
363 | /** |
364 | * <!-- begin-user-doc --> |
365 | * <!-- end-user-doc --> |
366 | * @generated |
367 | */ |
368 | @Override |
369 | public boolean eIsSet(int featureID) { |
370 | switch (featureID) { |
371 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_SIZE: |
372 | return averageMessageSize != AVERAGE_MESSAGE_SIZE_EDEFAULT; |
373 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__AVERAGE_MESSAGE_FREQUENCY: |
374 | return averageMessageFrequency != AVERAGE_MESSAGE_FREQUENCY_EDEFAULT; |
375 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__RECEIVER_AGGREGATED_COMMUNICATION: |
376 | return receiver_AggregatedCommunication != null; |
377 | case AggregatedUsageContextPackage.AGGREGATED_COMMUNICATION__USED_COMMUNICATION_LINK_RESOURCE_SPECIFICATION_AGGREGATED_COMMUNICATION: |
378 | return usedCommunicationLinkResourceSpecification_AggregatedCommunication != null; |
379 | } |
380 | return super.eIsSet(featureID); |
381 | } |
382 | |
383 | /** |
384 | * <!-- begin-user-doc --> |
385 | * <!-- end-user-doc --> |
386 | * @generated |
387 | */ |
388 | @Override |
389 | public String toString() { |
390 | if (eIsProxy()) return super.toString(); |
391 | |
392 | StringBuffer result = new StringBuffer(super.toString()); |
393 | result.append(" (averageMessageSize: "); |
394 | result.append(averageMessageSize); |
395 | result.append(", averageMessageFrequency: "); |
396 | result.append(averageMessageFrequency); |
397 | result.append(')'); |
398 | return result.toString(); |
399 | } |
400 | |
401 | } //AggregatedCommunicationImpl |