1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package scheduler.configuration.impl; |
8 | |
9 | import org.eclipse.emf.common.notify.Notification; |
10 | |
11 | import org.eclipse.emf.ecore.EClass; |
12 | |
13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
14 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
15 | |
16 | import scheduler.configuration.ConfigurationPackage; |
17 | import scheduler.configuration.InstanceToBalance; |
18 | import scheduler.configuration.LoadBalancing; |
19 | import scheduler.configuration.LoadBalancingType; |
20 | import scheduler.configuration.PreferredPriority; |
21 | import scheduler.configuration.PreferredWaitingTime; |
22 | |
23 | /** |
24 | * <!-- begin-user-doc --> |
25 | * An implementation of the model object '<em><b>Load Balancing</b></em>'. |
26 | * <!-- end-user-doc --> |
27 | * <p> |
28 | * The following features are implemented: |
29 | * <ul> |
30 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getBalancingType <em>Balancing Type</em>}</li> |
31 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getPreferredWaitingTime <em>Preferred Waiting Time</em>}</li> |
32 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getPreferredPriority <em>Preferred Priority</em>}</li> |
33 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getInstances <em>Instances</em>}</li> |
34 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getThreshold <em>Threshold</em>}</li> |
35 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getMaxIterations <em>Max Iterations</em>}</li> |
36 | * <li>{@link scheduler.configuration.impl.LoadBalancingImpl#getBalancingInterval <em>Balancing Interval</em>}</li> |
37 | * </ul> |
38 | * </p> |
39 | * |
40 | * @generated |
41 | */ |
42 | public class LoadBalancingImpl extends EObjectImpl implements LoadBalancing { |
43 | /** |
44 | * The default value of the '{@link #getBalancingType() <em>Balancing Type</em>}' attribute. |
45 | * <!-- begin-user-doc --> |
46 | * <!-- end-user-doc --> |
47 | * @see #getBalancingType() |
48 | * @generated |
49 | * @ordered |
50 | */ |
51 | protected static final LoadBalancingType BALANCING_TYPE_EDEFAULT = LoadBalancingType.IDLE_TO_ONE; |
52 | |
53 | /** |
54 | * The cached value of the '{@link #getBalancingType() <em>Balancing Type</em>}' attribute. |
55 | * <!-- begin-user-doc --> |
56 | * <!-- end-user-doc --> |
57 | * @see #getBalancingType() |
58 | * @generated |
59 | * @ordered |
60 | */ |
61 | protected LoadBalancingType balancingType = BALANCING_TYPE_EDEFAULT; |
62 | |
63 | /** |
64 | * The default value of the '{@link #getPreferredWaitingTime() <em>Preferred Waiting Time</em>}' attribute. |
65 | * <!-- begin-user-doc --> |
66 | * <!-- end-user-doc --> |
67 | * @see #getPreferredWaitingTime() |
68 | * @generated |
69 | * @ordered |
70 | */ |
71 | protected static final PreferredWaitingTime PREFERRED_WAITING_TIME_EDEFAULT = PreferredWaitingTime.LONG; |
72 | |
73 | /** |
74 | * The cached value of the '{@link #getPreferredWaitingTime() <em>Preferred Waiting Time</em>}' attribute. |
75 | * <!-- begin-user-doc --> |
76 | * <!-- end-user-doc --> |
77 | * @see #getPreferredWaitingTime() |
78 | * @generated |
79 | * @ordered |
80 | */ |
81 | protected PreferredWaitingTime preferredWaitingTime = PREFERRED_WAITING_TIME_EDEFAULT; |
82 | |
83 | /** |
84 | * The default value of the '{@link #getPreferredPriority() <em>Preferred Priority</em>}' attribute. |
85 | * <!-- begin-user-doc --> |
86 | * <!-- end-user-doc --> |
87 | * @see #getPreferredPriority() |
88 | * @generated |
89 | * @ordered |
90 | */ |
91 | protected static final PreferredPriority PREFERRED_PRIORITY_EDEFAULT = PreferredPriority.HIGHER; |
92 | |
93 | /** |
94 | * The cached value of the '{@link #getPreferredPriority() <em>Preferred Priority</em>}' attribute. |
95 | * <!-- begin-user-doc --> |
96 | * <!-- end-user-doc --> |
97 | * @see #getPreferredPriority() |
98 | * @generated |
99 | * @ordered |
100 | */ |
101 | protected PreferredPriority preferredPriority = PREFERRED_PRIORITY_EDEFAULT; |
102 | |
103 | /** |
104 | * The default value of the '{@link #getInstances() <em>Instances</em>}' attribute. |
105 | * <!-- begin-user-doc --> |
106 | * <!-- end-user-doc --> |
107 | * @see #getInstances() |
108 | * @generated |
109 | * @ordered |
110 | */ |
111 | protected static final InstanceToBalance INSTANCES_EDEFAULT = InstanceToBalance.CURRENT; |
112 | |
113 | /** |
114 | * The cached value of the '{@link #getInstances() <em>Instances</em>}' attribute. |
115 | * <!-- begin-user-doc --> |
116 | * <!-- end-user-doc --> |
117 | * @see #getInstances() |
118 | * @generated |
119 | * @ordered |
120 | */ |
121 | protected InstanceToBalance instances = INSTANCES_EDEFAULT; |
122 | |
123 | /** |
124 | * The default value of the '{@link #getThreshold() <em>Threshold</em>}' attribute. |
125 | * <!-- begin-user-doc --> |
126 | * <!-- end-user-doc --> |
127 | * @see #getThreshold() |
128 | * @generated |
129 | * @ordered |
130 | */ |
131 | protected static final double THRESHOLD_EDEFAULT = 0.0; |
132 | |
133 | /** |
134 | * The cached value of the '{@link #getThreshold() <em>Threshold</em>}' attribute. |
135 | * <!-- begin-user-doc --> |
136 | * <!-- end-user-doc --> |
137 | * @see #getThreshold() |
138 | * @generated |
139 | * @ordered |
140 | */ |
141 | protected double threshold = THRESHOLD_EDEFAULT; |
142 | |
143 | /** |
144 | * The default value of the '{@link #getMaxIterations() <em>Max Iterations</em>}' attribute. |
145 | * <!-- begin-user-doc --> |
146 | * <!-- end-user-doc --> |
147 | * @see #getMaxIterations() |
148 | * @generated |
149 | * @ordered |
150 | */ |
151 | protected static final int MAX_ITERATIONS_EDEFAULT = 0; |
152 | |
153 | /** |
154 | * The cached value of the '{@link #getMaxIterations() <em>Max Iterations</em>}' attribute. |
155 | * <!-- begin-user-doc --> |
156 | * <!-- end-user-doc --> |
157 | * @see #getMaxIterations() |
158 | * @generated |
159 | * @ordered |
160 | */ |
161 | protected int maxIterations = MAX_ITERATIONS_EDEFAULT; |
162 | |
163 | /** |
164 | * The default value of the '{@link #getBalancingInterval() <em>Balancing Interval</em>}' attribute. |
165 | * <!-- begin-user-doc --> |
166 | * <!-- end-user-doc --> |
167 | * @see #getBalancingInterval() |
168 | * @generated |
169 | * @ordered |
170 | */ |
171 | protected static final double BALANCING_INTERVAL_EDEFAULT = 0.0; |
172 | |
173 | /** |
174 | * The cached value of the '{@link #getBalancingInterval() <em>Balancing Interval</em>}' attribute. |
175 | * <!-- begin-user-doc --> |
176 | * <!-- end-user-doc --> |
177 | * @see #getBalancingInterval() |
178 | * @generated |
179 | * @ordered |
180 | */ |
181 | protected double balancingInterval = BALANCING_INTERVAL_EDEFAULT; |
182 | |
183 | /** |
184 | * <!-- begin-user-doc --> |
185 | * <!-- end-user-doc --> |
186 | * @generated |
187 | */ |
188 | protected LoadBalancingImpl() { |
189 | super(); |
190 | } |
191 | |
192 | /** |
193 | * <!-- begin-user-doc --> |
194 | * <!-- end-user-doc --> |
195 | * @generated |
196 | */ |
197 | @Override |
198 | protected EClass eStaticClass() { |
199 | return ConfigurationPackage.Literals.LOAD_BALANCING; |
200 | } |
201 | |
202 | /** |
203 | * <!-- begin-user-doc --> |
204 | * <!-- end-user-doc --> |
205 | * @generated |
206 | */ |
207 | public LoadBalancingType getBalancingType() { |
208 | return balancingType; |
209 | } |
210 | |
211 | /** |
212 | * <!-- begin-user-doc --> |
213 | * <!-- end-user-doc --> |
214 | * @generated |
215 | */ |
216 | public void setBalancingType(LoadBalancingType newBalancingType) { |
217 | LoadBalancingType oldBalancingType = balancingType; |
218 | balancingType = newBalancingType == null ? BALANCING_TYPE_EDEFAULT : newBalancingType; |
219 | if (eNotificationRequired()) |
220 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__BALANCING_TYPE, oldBalancingType, balancingType)); |
221 | } |
222 | |
223 | /** |
224 | * <!-- begin-user-doc --> |
225 | * <!-- end-user-doc --> |
226 | * @generated |
227 | */ |
228 | public PreferredWaitingTime getPreferredWaitingTime() { |
229 | return preferredWaitingTime; |
230 | } |
231 | |
232 | /** |
233 | * <!-- begin-user-doc --> |
234 | * <!-- end-user-doc --> |
235 | * @generated |
236 | */ |
237 | public void setPreferredWaitingTime(PreferredWaitingTime newPreferredWaitingTime) { |
238 | PreferredWaitingTime oldPreferredWaitingTime = preferredWaitingTime; |
239 | preferredWaitingTime = newPreferredWaitingTime == null ? PREFERRED_WAITING_TIME_EDEFAULT : newPreferredWaitingTime; |
240 | if (eNotificationRequired()) |
241 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__PREFERRED_WAITING_TIME, oldPreferredWaitingTime, preferredWaitingTime)); |
242 | } |
243 | |
244 | /** |
245 | * <!-- begin-user-doc --> |
246 | * <!-- end-user-doc --> |
247 | * @generated |
248 | */ |
249 | public PreferredPriority getPreferredPriority() { |
250 | return preferredPriority; |
251 | } |
252 | |
253 | /** |
254 | * <!-- begin-user-doc --> |
255 | * <!-- end-user-doc --> |
256 | * @generated |
257 | */ |
258 | public void setPreferredPriority(PreferredPriority newPreferredPriority) { |
259 | PreferredPriority oldPreferredPriority = preferredPriority; |
260 | preferredPriority = newPreferredPriority == null ? PREFERRED_PRIORITY_EDEFAULT : newPreferredPriority; |
261 | if (eNotificationRequired()) |
262 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__PREFERRED_PRIORITY, oldPreferredPriority, preferredPriority)); |
263 | } |
264 | |
265 | /** |
266 | * <!-- begin-user-doc --> |
267 | * <!-- end-user-doc --> |
268 | * @generated |
269 | */ |
270 | public InstanceToBalance getInstances() { |
271 | return instances; |
272 | } |
273 | |
274 | /** |
275 | * <!-- begin-user-doc --> |
276 | * <!-- end-user-doc --> |
277 | * @generated |
278 | */ |
279 | public void setInstances(InstanceToBalance newInstances) { |
280 | InstanceToBalance oldInstances = instances; |
281 | instances = newInstances == null ? INSTANCES_EDEFAULT : newInstances; |
282 | if (eNotificationRequired()) |
283 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__INSTANCES, oldInstances, instances)); |
284 | } |
285 | |
286 | /** |
287 | * <!-- begin-user-doc --> |
288 | * <!-- end-user-doc --> |
289 | * @generated |
290 | */ |
291 | public double getThreshold() { |
292 | return threshold; |
293 | } |
294 | |
295 | /** |
296 | * <!-- begin-user-doc --> |
297 | * <!-- end-user-doc --> |
298 | * @generated |
299 | */ |
300 | public void setThreshold(double newThreshold) { |
301 | double oldThreshold = threshold; |
302 | threshold = newThreshold; |
303 | if (eNotificationRequired()) |
304 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__THRESHOLD, oldThreshold, threshold)); |
305 | } |
306 | |
307 | /** |
308 | * <!-- begin-user-doc --> |
309 | * <!-- end-user-doc --> |
310 | * @generated |
311 | */ |
312 | public int getMaxIterations() { |
313 | return maxIterations; |
314 | } |
315 | |
316 | /** |
317 | * <!-- begin-user-doc --> |
318 | * <!-- end-user-doc --> |
319 | * @generated |
320 | */ |
321 | public void setMaxIterations(int newMaxIterations) { |
322 | int oldMaxIterations = maxIterations; |
323 | maxIterations = newMaxIterations; |
324 | if (eNotificationRequired()) |
325 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__MAX_ITERATIONS, oldMaxIterations, maxIterations)); |
326 | } |
327 | |
328 | /** |
329 | * <!-- begin-user-doc --> |
330 | * <!-- end-user-doc --> |
331 | * @generated |
332 | */ |
333 | public double getBalancingInterval() { |
334 | return balancingInterval; |
335 | } |
336 | |
337 | /** |
338 | * <!-- begin-user-doc --> |
339 | * <!-- end-user-doc --> |
340 | * @generated |
341 | */ |
342 | public void setBalancingInterval(double newBalancingInterval) { |
343 | double oldBalancingInterval = balancingInterval; |
344 | balancingInterval = newBalancingInterval; |
345 | if (eNotificationRequired()) |
346 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.LOAD_BALANCING__BALANCING_INTERVAL, oldBalancingInterval, balancingInterval)); |
347 | } |
348 | |
349 | /** |
350 | * <!-- begin-user-doc --> |
351 | * <!-- end-user-doc --> |
352 | * @generated |
353 | */ |
354 | @Override |
355 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
356 | switch (featureID) { |
357 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_TYPE: |
358 | return getBalancingType(); |
359 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_WAITING_TIME: |
360 | return getPreferredWaitingTime(); |
361 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_PRIORITY: |
362 | return getPreferredPriority(); |
363 | case ConfigurationPackage.LOAD_BALANCING__INSTANCES: |
364 | return getInstances(); |
365 | case ConfigurationPackage.LOAD_BALANCING__THRESHOLD: |
366 | return getThreshold(); |
367 | case ConfigurationPackage.LOAD_BALANCING__MAX_ITERATIONS: |
368 | return getMaxIterations(); |
369 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_INTERVAL: |
370 | return getBalancingInterval(); |
371 | } |
372 | return super.eGet(featureID, resolve, coreType); |
373 | } |
374 | |
375 | /** |
376 | * <!-- begin-user-doc --> |
377 | * <!-- end-user-doc --> |
378 | * @generated |
379 | */ |
380 | @Override |
381 | public void eSet(int featureID, Object newValue) { |
382 | switch (featureID) { |
383 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_TYPE: |
384 | setBalancingType((LoadBalancingType)newValue); |
385 | return; |
386 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_WAITING_TIME: |
387 | setPreferredWaitingTime((PreferredWaitingTime)newValue); |
388 | return; |
389 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_PRIORITY: |
390 | setPreferredPriority((PreferredPriority)newValue); |
391 | return; |
392 | case ConfigurationPackage.LOAD_BALANCING__INSTANCES: |
393 | setInstances((InstanceToBalance)newValue); |
394 | return; |
395 | case ConfigurationPackage.LOAD_BALANCING__THRESHOLD: |
396 | setThreshold((Double)newValue); |
397 | return; |
398 | case ConfigurationPackage.LOAD_BALANCING__MAX_ITERATIONS: |
399 | setMaxIterations((Integer)newValue); |
400 | return; |
401 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_INTERVAL: |
402 | setBalancingInterval((Double)newValue); |
403 | return; |
404 | } |
405 | super.eSet(featureID, newValue); |
406 | } |
407 | |
408 | /** |
409 | * <!-- begin-user-doc --> |
410 | * <!-- end-user-doc --> |
411 | * @generated |
412 | */ |
413 | @Override |
414 | public void eUnset(int featureID) { |
415 | switch (featureID) { |
416 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_TYPE: |
417 | setBalancingType(BALANCING_TYPE_EDEFAULT); |
418 | return; |
419 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_WAITING_TIME: |
420 | setPreferredWaitingTime(PREFERRED_WAITING_TIME_EDEFAULT); |
421 | return; |
422 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_PRIORITY: |
423 | setPreferredPriority(PREFERRED_PRIORITY_EDEFAULT); |
424 | return; |
425 | case ConfigurationPackage.LOAD_BALANCING__INSTANCES: |
426 | setInstances(INSTANCES_EDEFAULT); |
427 | return; |
428 | case ConfigurationPackage.LOAD_BALANCING__THRESHOLD: |
429 | setThreshold(THRESHOLD_EDEFAULT); |
430 | return; |
431 | case ConfigurationPackage.LOAD_BALANCING__MAX_ITERATIONS: |
432 | setMaxIterations(MAX_ITERATIONS_EDEFAULT); |
433 | return; |
434 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_INTERVAL: |
435 | setBalancingInterval(BALANCING_INTERVAL_EDEFAULT); |
436 | return; |
437 | } |
438 | super.eUnset(featureID); |
439 | } |
440 | |
441 | /** |
442 | * <!-- begin-user-doc --> |
443 | * <!-- end-user-doc --> |
444 | * @generated |
445 | */ |
446 | @Override |
447 | public boolean eIsSet(int featureID) { |
448 | switch (featureID) { |
449 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_TYPE: |
450 | return balancingType != BALANCING_TYPE_EDEFAULT; |
451 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_WAITING_TIME: |
452 | return preferredWaitingTime != PREFERRED_WAITING_TIME_EDEFAULT; |
453 | case ConfigurationPackage.LOAD_BALANCING__PREFERRED_PRIORITY: |
454 | return preferredPriority != PREFERRED_PRIORITY_EDEFAULT; |
455 | case ConfigurationPackage.LOAD_BALANCING__INSTANCES: |
456 | return instances != INSTANCES_EDEFAULT; |
457 | case ConfigurationPackage.LOAD_BALANCING__THRESHOLD: |
458 | return threshold != THRESHOLD_EDEFAULT; |
459 | case ConfigurationPackage.LOAD_BALANCING__MAX_ITERATIONS: |
460 | return maxIterations != MAX_ITERATIONS_EDEFAULT; |
461 | case ConfigurationPackage.LOAD_BALANCING__BALANCING_INTERVAL: |
462 | return balancingInterval != BALANCING_INTERVAL_EDEFAULT; |
463 | } |
464 | return super.eIsSet(featureID); |
465 | } |
466 | |
467 | /** |
468 | * <!-- begin-user-doc --> |
469 | * <!-- end-user-doc --> |
470 | * @generated |
471 | */ |
472 | @Override |
473 | public String toString() { |
474 | if (eIsProxy()) return super.toString(); |
475 | |
476 | StringBuffer result = new StringBuffer(super.toString()); |
477 | result.append(" (balancingType: "); |
478 | result.append(balancingType); |
479 | result.append(", preferredWaitingTime: "); |
480 | result.append(preferredWaitingTime); |
481 | result.append(", preferredPriority: "); |
482 | result.append(preferredPriority); |
483 | result.append(", instances: "); |
484 | result.append(instances); |
485 | result.append(", threshold: "); |
486 | result.append(threshold); |
487 | result.append(", maxIterations: "); |
488 | result.append(maxIterations); |
489 | result.append(", balancingInterval: "); |
490 | result.append(balancingInterval); |
491 | result.append(')'); |
492 | return result.toString(); |
493 | } |
494 | |
495 | } //LoadBalancingImpl |