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.PriorityDegradation; |
18 | import scheduler.configuration.StaticPriorityBoost; |
19 | |
20 | /** |
21 | * <!-- begin-user-doc --> |
22 | * An implementation of the model object '<em><b>Static Priority Boost</b></em>'. |
23 | * <!-- end-user-doc --> |
24 | * <p> |
25 | * The following features are implemented: |
26 | * <ul> |
27 | * <li>{@link scheduler.configuration.impl.StaticPriorityBoostImpl#isResetTimeslice <em>Reset Timeslice</em>}</li> |
28 | * <li>{@link scheduler.configuration.impl.StaticPriorityBoostImpl#getBonus <em>Bonus</em>}</li> |
29 | * <li>{@link scheduler.configuration.impl.StaticPriorityBoostImpl#getDegradation <em>Degradation</em>}</li> |
30 | * <li>{@link scheduler.configuration.impl.StaticPriorityBoostImpl#getTimePenalty <em>Time Penalty</em>}</li> |
31 | * </ul> |
32 | * </p> |
33 | * |
34 | * @generated |
35 | */ |
36 | public class StaticPriorityBoostImpl extends EObjectImpl implements StaticPriorityBoost { |
37 | /** |
38 | * The default value of the '{@link #isResetTimeslice() <em>Reset Timeslice</em>}' attribute. |
39 | * <!-- begin-user-doc --> |
40 | * <!-- end-user-doc --> |
41 | * @see #isResetTimeslice() |
42 | * @generated |
43 | * @ordered |
44 | */ |
45 | protected static final boolean RESET_TIMESLICE_EDEFAULT = false; |
46 | |
47 | /** |
48 | * The cached value of the '{@link #isResetTimeslice() <em>Reset Timeslice</em>}' attribute. |
49 | * <!-- begin-user-doc --> |
50 | * <!-- end-user-doc --> |
51 | * @see #isResetTimeslice() |
52 | * @generated |
53 | * @ordered |
54 | */ |
55 | protected boolean resetTimeslice = RESET_TIMESLICE_EDEFAULT; |
56 | |
57 | /** |
58 | * The default value of the '{@link #getBonus() <em>Bonus</em>}' attribute. |
59 | * <!-- begin-user-doc --> |
60 | * <!-- end-user-doc --> |
61 | * @see #getBonus() |
62 | * @generated |
63 | * @ordered |
64 | */ |
65 | protected static final int BONUS_EDEFAULT = 0; |
66 | |
67 | /** |
68 | * The cached value of the '{@link #getBonus() <em>Bonus</em>}' attribute. |
69 | * <!-- begin-user-doc --> |
70 | * <!-- end-user-doc --> |
71 | * @see #getBonus() |
72 | * @generated |
73 | * @ordered |
74 | */ |
75 | protected int bonus = BONUS_EDEFAULT; |
76 | |
77 | /** |
78 | * The default value of the '{@link #getDegradation() <em>Degradation</em>}' attribute. |
79 | * <!-- begin-user-doc --> |
80 | * <!-- end-user-doc --> |
81 | * @see #getDegradation() |
82 | * @generated |
83 | * @ordered |
84 | */ |
85 | protected static final PriorityDegradation DEGRADATION_EDEFAULT = PriorityDegradation.RESET; |
86 | |
87 | /** |
88 | * The cached value of the '{@link #getDegradation() <em>Degradation</em>}' attribute. |
89 | * <!-- begin-user-doc --> |
90 | * <!-- end-user-doc --> |
91 | * @see #getDegradation() |
92 | * @generated |
93 | * @ordered |
94 | */ |
95 | protected PriorityDegradation degradation = DEGRADATION_EDEFAULT; |
96 | |
97 | /** |
98 | * The default value of the '{@link #getTimePenalty() <em>Time Penalty</em>}' attribute. |
99 | * <!-- begin-user-doc --> |
100 | * <!-- end-user-doc --> |
101 | * @see #getTimePenalty() |
102 | * @generated |
103 | * @ordered |
104 | */ |
105 | protected static final double TIME_PENALTY_EDEFAULT = 0.0; |
106 | |
107 | /** |
108 | * The cached value of the '{@link #getTimePenalty() <em>Time Penalty</em>}' attribute. |
109 | * <!-- begin-user-doc --> |
110 | * <!-- end-user-doc --> |
111 | * @see #getTimePenalty() |
112 | * @generated |
113 | * @ordered |
114 | */ |
115 | protected double timePenalty = TIME_PENALTY_EDEFAULT; |
116 | |
117 | /** |
118 | * <!-- begin-user-doc --> |
119 | * <!-- end-user-doc --> |
120 | * @generated |
121 | */ |
122 | protected StaticPriorityBoostImpl() { |
123 | super(); |
124 | } |
125 | |
126 | /** |
127 | * <!-- begin-user-doc --> |
128 | * <!-- end-user-doc --> |
129 | * @generated |
130 | */ |
131 | @Override |
132 | protected EClass eStaticClass() { |
133 | return ConfigurationPackage.Literals.STATIC_PRIORITY_BOOST; |
134 | } |
135 | |
136 | /** |
137 | * <!-- begin-user-doc --> |
138 | * <!-- end-user-doc --> |
139 | * @generated |
140 | */ |
141 | public boolean isResetTimeslice() { |
142 | return resetTimeslice; |
143 | } |
144 | |
145 | /** |
146 | * <!-- begin-user-doc --> |
147 | * <!-- end-user-doc --> |
148 | * @generated |
149 | */ |
150 | public void setResetTimeslice(boolean newResetTimeslice) { |
151 | boolean oldResetTimeslice = resetTimeslice; |
152 | resetTimeslice = newResetTimeslice; |
153 | if (eNotificationRequired()) |
154 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STATIC_PRIORITY_BOOST__RESET_TIMESLICE, oldResetTimeslice, resetTimeslice)); |
155 | } |
156 | |
157 | /** |
158 | * <!-- begin-user-doc --> |
159 | * <!-- end-user-doc --> |
160 | * @generated |
161 | */ |
162 | public int getBonus() { |
163 | return bonus; |
164 | } |
165 | |
166 | /** |
167 | * <!-- begin-user-doc --> |
168 | * <!-- end-user-doc --> |
169 | * @generated |
170 | */ |
171 | public void setBonus(int newBonus) { |
172 | int oldBonus = bonus; |
173 | bonus = newBonus; |
174 | if (eNotificationRequired()) |
175 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STATIC_PRIORITY_BOOST__BONUS, oldBonus, bonus)); |
176 | } |
177 | |
178 | /** |
179 | * <!-- begin-user-doc --> |
180 | * <!-- end-user-doc --> |
181 | * @generated |
182 | */ |
183 | public PriorityDegradation getDegradation() { |
184 | return degradation; |
185 | } |
186 | |
187 | /** |
188 | * <!-- begin-user-doc --> |
189 | * <!-- end-user-doc --> |
190 | * @generated |
191 | */ |
192 | public void setDegradation(PriorityDegradation newDegradation) { |
193 | PriorityDegradation oldDegradation = degradation; |
194 | degradation = newDegradation == null ? DEGRADATION_EDEFAULT : newDegradation; |
195 | if (eNotificationRequired()) |
196 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STATIC_PRIORITY_BOOST__DEGRADATION, oldDegradation, degradation)); |
197 | } |
198 | |
199 | /** |
200 | * <!-- begin-user-doc --> |
201 | * <!-- end-user-doc --> |
202 | * @generated |
203 | */ |
204 | public double getTimePenalty() { |
205 | return timePenalty; |
206 | } |
207 | |
208 | /** |
209 | * <!-- begin-user-doc --> |
210 | * <!-- end-user-doc --> |
211 | * @generated |
212 | */ |
213 | public void setTimePenalty(double newTimePenalty) { |
214 | double oldTimePenalty = timePenalty; |
215 | timePenalty = newTimePenalty; |
216 | if (eNotificationRequired()) |
217 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STATIC_PRIORITY_BOOST__TIME_PENALTY, oldTimePenalty, timePenalty)); |
218 | } |
219 | |
220 | /** |
221 | * <!-- begin-user-doc --> |
222 | * <!-- end-user-doc --> |
223 | * @generated |
224 | */ |
225 | @Override |
226 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
227 | switch (featureID) { |
228 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__RESET_TIMESLICE: |
229 | return isResetTimeslice(); |
230 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__BONUS: |
231 | return getBonus(); |
232 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__DEGRADATION: |
233 | return getDegradation(); |
234 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__TIME_PENALTY: |
235 | return getTimePenalty(); |
236 | } |
237 | return super.eGet(featureID, resolve, coreType); |
238 | } |
239 | |
240 | /** |
241 | * <!-- begin-user-doc --> |
242 | * <!-- end-user-doc --> |
243 | * @generated |
244 | */ |
245 | @Override |
246 | public void eSet(int featureID, Object newValue) { |
247 | switch (featureID) { |
248 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__RESET_TIMESLICE: |
249 | setResetTimeslice((Boolean)newValue); |
250 | return; |
251 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__BONUS: |
252 | setBonus((Integer)newValue); |
253 | return; |
254 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__DEGRADATION: |
255 | setDegradation((PriorityDegradation)newValue); |
256 | return; |
257 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__TIME_PENALTY: |
258 | setTimePenalty((Double)newValue); |
259 | return; |
260 | } |
261 | super.eSet(featureID, newValue); |
262 | } |
263 | |
264 | /** |
265 | * <!-- begin-user-doc --> |
266 | * <!-- end-user-doc --> |
267 | * @generated |
268 | */ |
269 | @Override |
270 | public void eUnset(int featureID) { |
271 | switch (featureID) { |
272 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__RESET_TIMESLICE: |
273 | setResetTimeslice(RESET_TIMESLICE_EDEFAULT); |
274 | return; |
275 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__BONUS: |
276 | setBonus(BONUS_EDEFAULT); |
277 | return; |
278 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__DEGRADATION: |
279 | setDegradation(DEGRADATION_EDEFAULT); |
280 | return; |
281 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__TIME_PENALTY: |
282 | setTimePenalty(TIME_PENALTY_EDEFAULT); |
283 | return; |
284 | } |
285 | super.eUnset(featureID); |
286 | } |
287 | |
288 | /** |
289 | * <!-- begin-user-doc --> |
290 | * <!-- end-user-doc --> |
291 | * @generated |
292 | */ |
293 | @Override |
294 | public boolean eIsSet(int featureID) { |
295 | switch (featureID) { |
296 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__RESET_TIMESLICE: |
297 | return resetTimeslice != RESET_TIMESLICE_EDEFAULT; |
298 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__BONUS: |
299 | return bonus != BONUS_EDEFAULT; |
300 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__DEGRADATION: |
301 | return degradation != DEGRADATION_EDEFAULT; |
302 | case ConfigurationPackage.STATIC_PRIORITY_BOOST__TIME_PENALTY: |
303 | return timePenalty != TIME_PENALTY_EDEFAULT; |
304 | } |
305 | return super.eIsSet(featureID); |
306 | } |
307 | |
308 | /** |
309 | * <!-- begin-user-doc --> |
310 | * <!-- end-user-doc --> |
311 | * @generated |
312 | */ |
313 | @Override |
314 | public String toString() { |
315 | if (eIsProxy()) return super.toString(); |
316 | |
317 | StringBuffer result = new StringBuffer(super.toString()); |
318 | result.append(" (resetTimeslice: "); |
319 | result.append(resetTimeslice); |
320 | result.append(", bonus: "); |
321 | result.append(bonus); |
322 | result.append(", degradation: "); |
323 | result.append(degradation); |
324 | result.append(", timePenalty: "); |
325 | result.append(timePenalty); |
326 | result.append(')'); |
327 | return result.toString(); |
328 | } |
329 | |
330 | } //StaticPriorityBoostImpl |