| 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.StarvationBoost; |
| 18 | |
| 19 | /** |
| 20 | * <!-- begin-user-doc --> |
| 21 | * An implementation of the model object '<em><b>Starvation Boost</b></em>'. |
| 22 | * <!-- end-user-doc --> |
| 23 | * <p> |
| 24 | * The following features are implemented: |
| 25 | * <ul> |
| 26 | * <li>{@link scheduler.configuration.impl.StarvationBoostImpl#getStarvationLimit <em>Starvation Limit</em>}</li> |
| 27 | * <li>{@link scheduler.configuration.impl.StarvationBoostImpl#getBoost <em>Boost</em>}</li> |
| 28 | * <li>{@link scheduler.configuration.impl.StarvationBoostImpl#getDurationInTimeslices <em>Duration In Timeslices</em>}</li> |
| 29 | * </ul> |
| 30 | * </p> |
| 31 | * |
| 32 | * @generated |
| 33 | */ |
| 34 | public class StarvationBoostImpl extends EObjectImpl implements StarvationBoost { |
| 35 | /** |
| 36 | * The default value of the '{@link #getStarvationLimit() <em>Starvation Limit</em>}' attribute. |
| 37 | * <!-- begin-user-doc --> |
| 38 | * <!-- end-user-doc --> |
| 39 | * @see #getStarvationLimit() |
| 40 | * @generated |
| 41 | * @ordered |
| 42 | */ |
| 43 | protected static final double STARVATION_LIMIT_EDEFAULT = 0.0; |
| 44 | |
| 45 | /** |
| 46 | * The cached value of the '{@link #getStarvationLimit() <em>Starvation Limit</em>}' attribute. |
| 47 | * <!-- begin-user-doc --> |
| 48 | * <!-- end-user-doc --> |
| 49 | * @see #getStarvationLimit() |
| 50 | * @generated |
| 51 | * @ordered |
| 52 | */ |
| 53 | protected double starvationLimit = STARVATION_LIMIT_EDEFAULT; |
| 54 | |
| 55 | /** |
| 56 | * The default value of the '{@link #getBoost() <em>Boost</em>}' attribute. |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @see #getBoost() |
| 60 | * @generated |
| 61 | * @ordered |
| 62 | */ |
| 63 | protected static final int BOOST_EDEFAULT = 0; |
| 64 | |
| 65 | /** |
| 66 | * The cached value of the '{@link #getBoost() <em>Boost</em>}' attribute. |
| 67 | * <!-- begin-user-doc --> |
| 68 | * <!-- end-user-doc --> |
| 69 | * @see #getBoost() |
| 70 | * @generated |
| 71 | * @ordered |
| 72 | */ |
| 73 | protected int boost = BOOST_EDEFAULT; |
| 74 | |
| 75 | /** |
| 76 | * The default value of the '{@link #getDurationInTimeslices() <em>Duration In Timeslices</em>}' attribute. |
| 77 | * <!-- begin-user-doc --> |
| 78 | * <!-- end-user-doc --> |
| 79 | * @see #getDurationInTimeslices() |
| 80 | * @generated |
| 81 | * @ordered |
| 82 | */ |
| 83 | protected static final int DURATION_IN_TIMESLICES_EDEFAULT = 0; |
| 84 | |
| 85 | /** |
| 86 | * The cached value of the '{@link #getDurationInTimeslices() <em>Duration In Timeslices</em>}' attribute. |
| 87 | * <!-- begin-user-doc --> |
| 88 | * <!-- end-user-doc --> |
| 89 | * @see #getDurationInTimeslices() |
| 90 | * @generated |
| 91 | * @ordered |
| 92 | */ |
| 93 | protected int durationInTimeslices = DURATION_IN_TIMESLICES_EDEFAULT; |
| 94 | |
| 95 | /** |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | protected StarvationBoostImpl() { |
| 101 | super(); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * <!-- begin-user-doc --> |
| 106 | * <!-- end-user-doc --> |
| 107 | * @generated |
| 108 | */ |
| 109 | @Override |
| 110 | protected EClass eStaticClass() { |
| 111 | return ConfigurationPackage.Literals.STARVATION_BOOST; |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * <!-- begin-user-doc --> |
| 116 | * <!-- end-user-doc --> |
| 117 | * @generated |
| 118 | */ |
| 119 | public double getStarvationLimit() { |
| 120 | return starvationLimit; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | public void setStarvationLimit(double newStarvationLimit) { |
| 129 | double oldStarvationLimit = starvationLimit; |
| 130 | starvationLimit = newStarvationLimit; |
| 131 | if (eNotificationRequired()) |
| 132 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STARVATION_BOOST__STARVATION_LIMIT, oldStarvationLimit, starvationLimit)); |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * <!-- begin-user-doc --> |
| 137 | * <!-- end-user-doc --> |
| 138 | * @generated |
| 139 | */ |
| 140 | public int getBoost() { |
| 141 | return boost; |
| 142 | } |
| 143 | |
| 144 | /** |
| 145 | * <!-- begin-user-doc --> |
| 146 | * <!-- end-user-doc --> |
| 147 | * @generated |
| 148 | */ |
| 149 | public void setBoost(int newBoost) { |
| 150 | int oldBoost = boost; |
| 151 | boost = newBoost; |
| 152 | if (eNotificationRequired()) |
| 153 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STARVATION_BOOST__BOOST, oldBoost, boost)); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * <!-- begin-user-doc --> |
| 158 | * <!-- end-user-doc --> |
| 159 | * @generated |
| 160 | */ |
| 161 | public int getDurationInTimeslices() { |
| 162 | return durationInTimeslices; |
| 163 | } |
| 164 | |
| 165 | /** |
| 166 | * <!-- begin-user-doc --> |
| 167 | * <!-- end-user-doc --> |
| 168 | * @generated |
| 169 | */ |
| 170 | public void setDurationInTimeslices(int newDurationInTimeslices) { |
| 171 | int oldDurationInTimeslices = durationInTimeslices; |
| 172 | durationInTimeslices = newDurationInTimeslices; |
| 173 | if (eNotificationRequired()) |
| 174 | eNotify(new ENotificationImpl(this, Notification.SET, ConfigurationPackage.STARVATION_BOOST__DURATION_IN_TIMESLICES, oldDurationInTimeslices, durationInTimeslices)); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | @Override |
| 183 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 184 | switch (featureID) { |
| 185 | case ConfigurationPackage.STARVATION_BOOST__STARVATION_LIMIT: |
| 186 | return getStarvationLimit(); |
| 187 | case ConfigurationPackage.STARVATION_BOOST__BOOST: |
| 188 | return getBoost(); |
| 189 | case ConfigurationPackage.STARVATION_BOOST__DURATION_IN_TIMESLICES: |
| 190 | return getDurationInTimeslices(); |
| 191 | } |
| 192 | return super.eGet(featureID, resolve, coreType); |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * <!-- begin-user-doc --> |
| 197 | * <!-- end-user-doc --> |
| 198 | * @generated |
| 199 | */ |
| 200 | @Override |
| 201 | public void eSet(int featureID, Object newValue) { |
| 202 | switch (featureID) { |
| 203 | case ConfigurationPackage.STARVATION_BOOST__STARVATION_LIMIT: |
| 204 | setStarvationLimit((Double)newValue); |
| 205 | return; |
| 206 | case ConfigurationPackage.STARVATION_BOOST__BOOST: |
| 207 | setBoost((Integer)newValue); |
| 208 | return; |
| 209 | case ConfigurationPackage.STARVATION_BOOST__DURATION_IN_TIMESLICES: |
| 210 | setDurationInTimeslices((Integer)newValue); |
| 211 | return; |
| 212 | } |
| 213 | super.eSet(featureID, newValue); |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * <!-- begin-user-doc --> |
| 218 | * <!-- end-user-doc --> |
| 219 | * @generated |
| 220 | */ |
| 221 | @Override |
| 222 | public void eUnset(int featureID) { |
| 223 | switch (featureID) { |
| 224 | case ConfigurationPackage.STARVATION_BOOST__STARVATION_LIMIT: |
| 225 | setStarvationLimit(STARVATION_LIMIT_EDEFAULT); |
| 226 | return; |
| 227 | case ConfigurationPackage.STARVATION_BOOST__BOOST: |
| 228 | setBoost(BOOST_EDEFAULT); |
| 229 | return; |
| 230 | case ConfigurationPackage.STARVATION_BOOST__DURATION_IN_TIMESLICES: |
| 231 | setDurationInTimeslices(DURATION_IN_TIMESLICES_EDEFAULT); |
| 232 | return; |
| 233 | } |
| 234 | super.eUnset(featureID); |
| 235 | } |
| 236 | |
| 237 | /** |
| 238 | * <!-- begin-user-doc --> |
| 239 | * <!-- end-user-doc --> |
| 240 | * @generated |
| 241 | */ |
| 242 | @Override |
| 243 | public boolean eIsSet(int featureID) { |
| 244 | switch (featureID) { |
| 245 | case ConfigurationPackage.STARVATION_BOOST__STARVATION_LIMIT: |
| 246 | return starvationLimit != STARVATION_LIMIT_EDEFAULT; |
| 247 | case ConfigurationPackage.STARVATION_BOOST__BOOST: |
| 248 | return boost != BOOST_EDEFAULT; |
| 249 | case ConfigurationPackage.STARVATION_BOOST__DURATION_IN_TIMESLICES: |
| 250 | return durationInTimeslices != DURATION_IN_TIMESLICES_EDEFAULT; |
| 251 | } |
| 252 | return super.eIsSet(featureID); |
| 253 | } |
| 254 | |
| 255 | /** |
| 256 | * <!-- begin-user-doc --> |
| 257 | * <!-- end-user-doc --> |
| 258 | * @generated |
| 259 | */ |
| 260 | @Override |
| 261 | public String toString() { |
| 262 | if (eIsProxy()) return super.toString(); |
| 263 | |
| 264 | StringBuffer result = new StringBuffer(super.toString()); |
| 265 | result.append(" (starvationLimit: "); |
| 266 | result.append(starvationLimit); |
| 267 | result.append(", boost: "); |
| 268 | result.append(boost); |
| 269 | result.append(", durationInTimeslices: "); |
| 270 | result.append(durationInTimeslices); |
| 271 | result.append(')'); |
| 272 | return result.toString(); |
| 273 | } |
| 274 | |
| 275 | } //StarvationBoostImpl |