1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package scheduler.configuration.impl; |
8 | |
9 | import de.uka.ipd.sdq.identifier.impl.IdentifierImpl; |
10 | |
11 | import org.eclipse.emf.common.notify.Notification; |
12 | import org.eclipse.emf.common.notify.NotificationChain; |
13 | |
14 | import org.eclipse.emf.ecore.EClass; |
15 | import org.eclipse.emf.ecore.InternalEObject; |
16 | |
17 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
18 | |
19 | import scheduler.configuration.ActiveResourceConfiguration; |
20 | import scheduler.configuration.ConfigurationPackage; |
21 | import scheduler.configuration.PassiveResourceConfiguration; |
22 | import scheduler.configuration.PassiveResourceType; |
23 | import scheduler.configuration.StaticPriorityBoost; |
24 | |
25 | /** |
26 | * <!-- begin-user-doc --> |
27 | * An implementation of the model object '<em><b>Passive Resource Configuration</b></em>'. |
28 | * <!-- end-user-doc --> |
29 | * <p> |
30 | * The following features are implemented: |
31 | * <ul> |
32 | * <li>{@link scheduler.configuration.impl.PassiveResourceConfigurationImpl#getStaticPriorityBoostConfiguration <em>Static Priority Boost Configuration</em>}</li> |
33 | * <li>{@link scheduler.configuration.impl.PassiveResourceConfigurationImpl#getCapacity <em>Capacity</em>}</li> |
34 | * <li>{@link scheduler.configuration.impl.PassiveResourceConfigurationImpl#getType <em>Type</em>}</li> |
35 | * <li>{@link scheduler.configuration.impl.PassiveResourceConfigurationImpl#getName <em>Name</em>}</li> |
36 | * <li>{@link scheduler.configuration.impl.PassiveResourceConfigurationImpl#getManagingResource <em>Managing Resource</em>}</li> |
37 | * <li>{@link scheduler.configuration.impl.PassiveResourceConfigurationImpl#getAcquisitionDemand <em>Acquisition Demand</em>}</li> |
38 | * </ul> |
39 | * </p> |
40 | * |
41 | * @generated |
42 | */ |
43 | public class PassiveResourceConfigurationImpl extends IdentifierImpl implements PassiveResourceConfiguration { |
44 | /** |
45 | * The cached value of the '{@link #getStaticPriorityBoostConfiguration() <em>Static Priority Boost Configuration</em>}' containment reference. |
46 | * <!-- begin-user-doc --> |
47 | * <!-- end-user-doc --> |
48 | * @see #getStaticPriorityBoostConfiguration() |
49 | * @generated |
50 | * @ordered |
51 | */ |
52 | protected StaticPriorityBoost staticPriorityBoostConfiguration; |
53 | |
54 | /** |
55 | * The default value of the '{@link #getCapacity() <em>Capacity</em>}' attribute. |
56 | * <!-- begin-user-doc --> |
57 | * <!-- end-user-doc --> |
58 | * @see #getCapacity() |
59 | * @generated |
60 | * @ordered |
61 | */ |
62 | protected static final int CAPACITY_EDEFAULT = 1; |
63 | |
64 | /** |
65 | * The cached value of the '{@link #getCapacity() <em>Capacity</em>}' attribute. |
66 | * <!-- begin-user-doc --> |
67 | * <!-- end-user-doc --> |
68 | * @see #getCapacity() |
69 | * @generated |
70 | * @ordered |
71 | */ |
72 | protected int capacity = CAPACITY_EDEFAULT; |
73 | |
74 | /** |
75 | * The default value of the '{@link #getType() <em>Type</em>}' attribute. |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @see #getType() |
79 | * @generated |
80 | * @ordered |
81 | */ |
82 | protected static final PassiveResourceType TYPE_EDEFAULT = PassiveResourceType.FAIR; |
83 | |
84 | /** |
85 | * The cached value of the '{@link #getType() <em>Type</em>}' attribute. |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @see #getType() |
89 | * @generated |
90 | * @ordered |
91 | */ |
92 | protected PassiveResourceType type = TYPE_EDEFAULT; |
93 | |
94 | /** |
95 | * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
96 | * <!-- begin-user-doc --> |
97 | * <!-- end-user-doc --> |
98 | * @see #getName() |
99 | * @generated |
100 | * @ordered |
101 | */ |
102 | protected static final String NAME_EDEFAULT = null; |
103 | |
104 | /** |
105 | * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
106 | * <!-- begin-user-doc --> |
107 | * <!-- end-user-doc --> |
108 | * @see #getName() |
109 | * @generated |
110 | * @ordered |
111 | */ |
112 | protected String name = NAME_EDEFAULT; |
113 | |
114 | /** |
115 | * The cached value of the '{@link #getManagingResource() <em>Managing Resource</em>}' reference. |
116 | * <!-- begin-user-doc --> |
117 | * <!-- end-user-doc --> |
118 | * @see #getManagingResource() |
119 | * @generated |
120 | * @ordered |
121 | */ |
122 | protected ActiveResourceConfiguration managingResource; |
123 | |
124 | /** |
125 | * The default value of the '{@link #getAcquisitionDemand() <em>Acquisition Demand</em>}' attribute. |
126 | * <!-- begin-user-doc --> |
127 | * <!-- end-user-doc --> |
128 | * @see #getAcquisitionDemand() |
129 | * @generated |
130 | * @ordered |
131 | */ |
132 | protected static final double ACQUISITION_DEMAND_EDEFAULT = 0.0; |
133 | |
134 | /** |
135 | * The cached value of the '{@link #getAcquisitionDemand() <em>Acquisition Demand</em>}' attribute. |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @see #getAcquisitionDemand() |
139 | * @generated |
140 | * @ordered |
141 | */ |
142 | protected double acquisitionDemand = ACQUISITION_DEMAND_EDEFAULT; |
143 | |
144 | /** |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @generated |
148 | */ |
149 | protected PassiveResourceConfigurationImpl() { |
150 | super(); |
151 | } |
152 | |
153 | /** |
154 | * <!-- begin-user-doc --> |
155 | * <!-- end-user-doc --> |
156 | * @generated |
157 | */ |
158 | @Override |
159 | protected EClass eStaticClass() { |
160 | return ConfigurationPackage.Literals.PASSIVE_RESOURCE_CONFIGURATION; |
161 | } |
162 | |
163 | /** |
164 | * <!-- begin-user-doc --> |
165 | * <!-- end-user-doc --> |
166 | * @generated |
167 | */ |
168 | public StaticPriorityBoost getStaticPriorityBoostConfiguration() { |
169 | return staticPriorityBoostConfiguration; |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | public NotificationChain basicSetStaticPriorityBoostConfiguration(StaticPriorityBoost newStaticPriorityBoostConfiguration, NotificationChain msgs) { |
178 | StaticPriorityBoost oldStaticPriorityBoostConfiguration = staticPriorityBoostConfiguration; |
179 | staticPriorityBoostConfiguration = newStaticPriorityBoostConfiguration; |
180 | if (eNotificationRequired()) { |
181 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION, oldStaticPriorityBoostConfiguration, newStaticPriorityBoostConfiguration); |
182 | if (msgs == null) msgs = notification; else msgs.add(notification); |
183 | } |
184 | return msgs; |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | public void setStaticPriorityBoostConfiguration(StaticPriorityBoost newStaticPriorityBoostConfiguration) { |
193 | if (newStaticPriorityBoostConfiguration != staticPriorityBoostConfiguration) { |
194 | NotificationChain msgs = null; |
195 | if (staticPriorityBoostConfiguration != null) |
196 | msgs = ((InternalEObject)staticPriorityBoostConfiguration).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION, null, msgs); |
197 | if (newStaticPriorityBoostConfiguration != null) |
198 | msgs = ((InternalEObject)newStaticPriorityBoostConfiguration).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION, null, msgs); |
199 | msgs = basicSetStaticPriorityBoostConfiguration(newStaticPriorityBoostConfiguration, msgs); |
200 | if (msgs != null) msgs.dispatch(); |
201 | } |
202 | else if (eNotificationRequired()) |
203 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION, newStaticPriorityBoostConfiguration, newStaticPriorityBoostConfiguration)); |
204 | } |
205 | |
206 | /** |
207 | * <!-- begin-user-doc --> |
208 | * <!-- end-user-doc --> |
209 | * @generated |
210 | */ |
211 | public int getCapacity() { |
212 | return capacity; |
213 | } |
214 | |
215 | /** |
216 | * <!-- begin-user-doc --> |
217 | * <!-- end-user-doc --> |
218 | * @generated |
219 | */ |
220 | public void setCapacity(int newCapacity) { |
221 | int oldCapacity = capacity; |
222 | capacity = newCapacity; |
223 | if (eNotificationRequired()) |
224 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__CAPACITY, oldCapacity, capacity)); |
225 | } |
226 | |
227 | /** |
228 | * <!-- begin-user-doc --> |
229 | * <!-- end-user-doc --> |
230 | * @generated |
231 | */ |
232 | public PassiveResourceType getType() { |
233 | return type; |
234 | } |
235 | |
236 | /** |
237 | * <!-- begin-user-doc --> |
238 | * <!-- end-user-doc --> |
239 | * @generated |
240 | */ |
241 | public void setType(PassiveResourceType newType) { |
242 | PassiveResourceType oldType = type; |
243 | type = newType == null ? TYPE_EDEFAULT : newType; |
244 | if (eNotificationRequired()) |
245 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__TYPE, oldType, type)); |
246 | } |
247 | |
248 | /** |
249 | * <!-- begin-user-doc --> |
250 | * <!-- end-user-doc --> |
251 | * @generated |
252 | */ |
253 | public String getName() { |
254 | return name; |
255 | } |
256 | |
257 | /** |
258 | * <!-- begin-user-doc --> |
259 | * <!-- end-user-doc --> |
260 | * @generated |
261 | */ |
262 | public void setName(String newName) { |
263 | String oldName = name; |
264 | name = newName; |
265 | if (eNotificationRequired()) |
266 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__NAME, oldName, name)); |
267 | } |
268 | |
269 | /** |
270 | * <!-- begin-user-doc --> |
271 | * <!-- end-user-doc --> |
272 | * @generated |
273 | */ |
274 | public ActiveResourceConfiguration getManagingResource() { |
275 | if (managingResource != null && managingResource.eIsProxy()) { |
276 | InternalEObject oldManagingResource = (InternalEObject)managingResource; |
277 | managingResource = (ActiveResourceConfiguration)eResolveProxy(oldManagingResource); |
278 | if (managingResource != oldManagingResource) { |
279 | if (eNotificationRequired()) |
280 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__MANAGING_RESOURCE, oldManagingResource, managingResource)); |
281 | } |
282 | } |
283 | return managingResource; |
284 | } |
285 | |
286 | /** |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | public ActiveResourceConfiguration basicGetManagingResource() { |
292 | return managingResource; |
293 | } |
294 | |
295 | /** |
296 | * <!-- begin-user-doc --> |
297 | * <!-- end-user-doc --> |
298 | * @generated |
299 | */ |
300 | public void setManagingResource(ActiveResourceConfiguration newManagingResource) { |
301 | ActiveResourceConfiguration oldManagingResource = managingResource; |
302 | managingResource = newManagingResource; |
303 | if (eNotificationRequired()) |
304 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__MANAGING_RESOURCE, oldManagingResource, managingResource)); |
305 | } |
306 | |
307 | /** |
308 | * <!-- begin-user-doc --> |
309 | * <!-- end-user-doc --> |
310 | * @generated |
311 | */ |
312 | public double getAcquisitionDemand() { |
313 | return acquisitionDemand; |
314 | } |
315 | |
316 | /** |
317 | * <!-- begin-user-doc --> |
318 | * <!-- end-user-doc --> |
319 | * @generated |
320 | */ |
321 | public void setAcquisitionDemand(double newAcquisitionDemand) { |
322 | double oldAcquisitionDemand = acquisitionDemand; |
323 | acquisitionDemand = newAcquisitionDemand; |
324 | if (eNotificationRequired()) |
325 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__ACQUISITION_DEMAND, oldAcquisitionDemand, acquisitionDemand)); |
326 | } |
327 | |
328 | /** |
329 | * <!-- begin-user-doc --> |
330 | * <!-- end-user-doc --> |
331 | * @generated |
332 | */ |
333 | @Override |
334 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
335 | switch (featureID) { |
336 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION: |
337 | return basicSetStaticPriorityBoostConfiguration(null, msgs); |
338 | } |
339 | return super.eInverseRemove(otherEnd, featureID, msgs); |
340 | } |
341 | |
342 | /** |
343 | * <!-- begin-user-doc --> |
344 | * <!-- end-user-doc --> |
345 | * @generated |
346 | */ |
347 | @Override |
348 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
349 | switch (featureID) { |
350 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION: |
351 | return getStaticPriorityBoostConfiguration(); |
352 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__CAPACITY: |
353 | return getCapacity(); |
354 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__TYPE: |
355 | return getType(); |
356 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__NAME: |
357 | return getName(); |
358 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__MANAGING_RESOURCE: |
359 | if (resolve) return getManagingResource(); |
360 | return basicGetManagingResource(); |
361 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__ACQUISITION_DEMAND: |
362 | return getAcquisitionDemand(); |
363 | } |
364 | return super.eGet(featureID, resolve, coreType); |
365 | } |
366 | |
367 | /** |
368 | * <!-- begin-user-doc --> |
369 | * <!-- end-user-doc --> |
370 | * @generated |
371 | */ |
372 | @Override |
373 | public void eSet(int featureID, Object newValue) { |
374 | switch (featureID) { |
375 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION: |
376 | setStaticPriorityBoostConfiguration((StaticPriorityBoost)newValue); |
377 | return; |
378 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__CAPACITY: |
379 | setCapacity((Integer)newValue); |
380 | return; |
381 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__TYPE: |
382 | setType((PassiveResourceType)newValue); |
383 | return; |
384 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__NAME: |
385 | setName((String)newValue); |
386 | return; |
387 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__MANAGING_RESOURCE: |
388 | setManagingResource((ActiveResourceConfiguration)newValue); |
389 | return; |
390 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__ACQUISITION_DEMAND: |
391 | setAcquisitionDemand((Double)newValue); |
392 | return; |
393 | } |
394 | super.eSet(featureID, newValue); |
395 | } |
396 | |
397 | /** |
398 | * <!-- begin-user-doc --> |
399 | * <!-- end-user-doc --> |
400 | * @generated |
401 | */ |
402 | @Override |
403 | public void eUnset(int featureID) { |
404 | switch (featureID) { |
405 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION: |
406 | setStaticPriorityBoostConfiguration((StaticPriorityBoost)null); |
407 | return; |
408 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__CAPACITY: |
409 | setCapacity(CAPACITY_EDEFAULT); |
410 | return; |
411 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__TYPE: |
412 | setType(TYPE_EDEFAULT); |
413 | return; |
414 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__NAME: |
415 | setName(NAME_EDEFAULT); |
416 | return; |
417 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__MANAGING_RESOURCE: |
418 | setManagingResource((ActiveResourceConfiguration)null); |
419 | return; |
420 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__ACQUISITION_DEMAND: |
421 | setAcquisitionDemand(ACQUISITION_DEMAND_EDEFAULT); |
422 | return; |
423 | } |
424 | super.eUnset(featureID); |
425 | } |
426 | |
427 | /** |
428 | * <!-- begin-user-doc --> |
429 | * <!-- end-user-doc --> |
430 | * @generated |
431 | */ |
432 | @Override |
433 | public boolean eIsSet(int featureID) { |
434 | switch (featureID) { |
435 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__STATIC_PRIORITY_BOOST_CONFIGURATION: |
436 | return staticPriorityBoostConfiguration != null; |
437 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__CAPACITY: |
438 | return capacity != CAPACITY_EDEFAULT; |
439 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__TYPE: |
440 | return type != TYPE_EDEFAULT; |
441 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__NAME: |
442 | return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
443 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__MANAGING_RESOURCE: |
444 | return managingResource != null; |
445 | case ConfigurationPackage.PASSIVE_RESOURCE_CONFIGURATION__ACQUISITION_DEMAND: |
446 | return acquisitionDemand != ACQUISITION_DEMAND_EDEFAULT; |
447 | } |
448 | return super.eIsSet(featureID); |
449 | } |
450 | |
451 | /** |
452 | * <!-- begin-user-doc --> |
453 | * <!-- end-user-doc --> |
454 | * @generated |
455 | */ |
456 | @Override |
457 | public String toString() { |
458 | if (eIsProxy()) return super.toString(); |
459 | |
460 | StringBuffer result = new StringBuffer(super.toString()); |
461 | result.append(" (capacity: "); |
462 | result.append(capacity); |
463 | result.append(", type: "); |
464 | result.append(type); |
465 | result.append(", name: "); |
466 | result.append(name); |
467 | result.append(", acquisitionDemand: "); |
468 | result.append(acquisitionDemand); |
469 | result.append(')'); |
470 | return result.toString(); |
471 | } |
472 | |
473 | } //PassiveResourceConfigurationImpl |