| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.cost.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.cost.ProcessingResourceCost; |
| 10 | import org.eclipse.emf.common.notify.Notification; |
| 11 | import org.eclipse.emf.common.notify.NotificationChain; |
| 12 | import org.eclipse.emf.ecore.EClass; |
| 13 | import org.eclipse.emf.ecore.EObject; |
| 14 | import org.eclipse.emf.ecore.InternalEObject; |
| 15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 16 | |
| 17 | import de.uka.ipd.sdq.pcm.cost.ScalarFunction; |
| 18 | import de.uka.ipd.sdq.pcm.cost.VariableProcessingResourceCost; |
| 19 | import de.uka.ipd.sdq.pcm.cost.costPackage; |
| 20 | import de.uka.ipd.sdq.pcm.cost.helper.CostUtil; |
| 21 | import de.uka.ipd.sdq.pcm.resourceenvironment.ProcessingResourceSpecification; |
| 22 | |
| 23 | /** |
| 24 | * <!-- begin-user-doc --> |
| 25 | * An implementation of the model object '<em><b>Variable Processing Resource Cost</b></em>'. |
| 26 | * <!-- end-user-doc --> |
| 27 | * <p> |
| 28 | * The following features are implemented: |
| 29 | * <ul> |
| 30 | * <li>{@link de.uka.ipd.sdq.pcm.cost.impl.VariableProcessingResourceCostImpl#getProcessingresourcespecification <em>Processingresourcespecification</em>}</li> |
| 31 | * <li>{@link de.uka.ipd.sdq.pcm.cost.impl.VariableProcessingResourceCostImpl#getProcessingRateInitialFunction <em>Processing Rate Initial Function</em>}</li> |
| 32 | * <li>{@link de.uka.ipd.sdq.pcm.cost.impl.VariableProcessingResourceCostImpl#getProcessingRateOperatingFunction <em>Processing Rate Operating Function</em>}</li> |
| 33 | * </ul> |
| 34 | * </p> |
| 35 | * |
| 36 | * @generated |
| 37 | */ |
| 38 | public class VariableProcessingResourceCostImpl extends VariableCostImpl implements VariableProcessingResourceCost { |
| 39 | /** |
| 40 | * The cached value of the '{@link #getProcessingresourcespecification() <em>Processingresourcespecification</em>}' reference. |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @see #getProcessingresourcespecification() |
| 44 | * @generated |
| 45 | * @ordered |
| 46 | */ |
| 47 | protected ProcessingResourceSpecification processingresourcespecification; |
| 48 | |
| 49 | /** |
| 50 | * The cached value of the '{@link #getProcessingRateInitialFunction() <em>Processing Rate Initial Function</em>}' containment reference. |
| 51 | * <!-- begin-user-doc --> |
| 52 | * <!-- end-user-doc --> |
| 53 | * @see #getProcessingRateInitialFunction() |
| 54 | * @generated |
| 55 | * @ordered |
| 56 | */ |
| 57 | protected ScalarFunction processingRateInitialFunction; |
| 58 | |
| 59 | /** |
| 60 | * The cached value of the '{@link #getProcessingRateOperatingFunction() <em>Processing Rate Operating Function</em>}' containment reference. |
| 61 | * <!-- begin-user-doc --> |
| 62 | * <!-- end-user-doc --> |
| 63 | * @see #getProcessingRateOperatingFunction() |
| 64 | * @generated |
| 65 | * @ordered |
| 66 | */ |
| 67 | protected ScalarFunction processingRateOperatingFunction; |
| 68 | |
| 69 | /** |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @generated |
| 73 | */ |
| 74 | protected VariableProcessingResourceCostImpl() { |
| 75 | super(); |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * <!-- begin-user-doc --> |
| 80 | * <!-- end-user-doc --> |
| 81 | * @generated |
| 82 | */ |
| 83 | @Override |
| 84 | protected EClass eStaticClass() { |
| 85 | return costPackage.Literals.VARIABLE_PROCESSING_RESOURCE_COST; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * <!-- begin-user-doc --> |
| 90 | * <!-- end-user-doc --> |
| 91 | * @generated |
| 92 | */ |
| 93 | public ScalarFunction getProcessingRateInitialFunction() { |
| 94 | return processingRateInitialFunction; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | public NotificationChain basicSetProcessingRateInitialFunction(ScalarFunction newProcessingRateInitialFunction, NotificationChain msgs) { |
| 103 | ScalarFunction oldProcessingRateInitialFunction = processingRateInitialFunction; |
| 104 | processingRateInitialFunction = newProcessingRateInitialFunction; |
| 105 | if (eNotificationRequired()) { |
| 106 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION, oldProcessingRateInitialFunction, newProcessingRateInitialFunction); |
| 107 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 108 | } |
| 109 | return msgs; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * <!-- begin-user-doc --> |
| 114 | * <!-- end-user-doc --> |
| 115 | * @generated |
| 116 | */ |
| 117 | public void setProcessingRateInitialFunction(ScalarFunction newProcessingRateInitialFunction) { |
| 118 | if (newProcessingRateInitialFunction != processingRateInitialFunction) { |
| 119 | NotificationChain msgs = null; |
| 120 | if (processingRateInitialFunction != null) |
| 121 | msgs = ((InternalEObject)processingRateInitialFunction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION, null, msgs); |
| 122 | if (newProcessingRateInitialFunction != null) |
| 123 | msgs = ((InternalEObject)newProcessingRateInitialFunction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION, null, msgs); |
| 124 | msgs = basicSetProcessingRateInitialFunction(newProcessingRateInitialFunction, msgs); |
| 125 | if (msgs != null) msgs.dispatch(); |
| 126 | } |
| 127 | else if (eNotificationRequired()) |
| 128 | eNotify(new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION, newProcessingRateInitialFunction, newProcessingRateInitialFunction)); |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * <!-- begin-user-doc --> |
| 133 | * <!-- end-user-doc --> |
| 134 | * @generated |
| 135 | */ |
| 136 | public ScalarFunction getProcessingRateOperatingFunction() { |
| 137 | return processingRateOperatingFunction; |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | public NotificationChain basicSetProcessingRateOperatingFunction(ScalarFunction newProcessingRateOperatingFunction, NotificationChain msgs) { |
| 146 | ScalarFunction oldProcessingRateOperatingFunction = processingRateOperatingFunction; |
| 147 | processingRateOperatingFunction = newProcessingRateOperatingFunction; |
| 148 | if (eNotificationRequired()) { |
| 149 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION, oldProcessingRateOperatingFunction, newProcessingRateOperatingFunction); |
| 150 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 151 | } |
| 152 | return msgs; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | public void setProcessingRateOperatingFunction(ScalarFunction newProcessingRateOperatingFunction) { |
| 161 | if (newProcessingRateOperatingFunction != processingRateOperatingFunction) { |
| 162 | NotificationChain msgs = null; |
| 163 | if (processingRateOperatingFunction != null) |
| 164 | msgs = ((InternalEObject)processingRateOperatingFunction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION, null, msgs); |
| 165 | if (newProcessingRateOperatingFunction != null) |
| 166 | msgs = ((InternalEObject)newProcessingRateOperatingFunction).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION, null, msgs); |
| 167 | msgs = basicSetProcessingRateOperatingFunction(newProcessingRateOperatingFunction, msgs); |
| 168 | if (msgs != null) msgs.dispatch(); |
| 169 | } |
| 170 | else if (eNotificationRequired()) |
| 171 | eNotify(new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION, newProcessingRateOperatingFunction, newProcessingRateOperatingFunction)); |
| 172 | } |
| 173 | |
| 174 | /** |
| 175 | * <!-- begin-user-doc --> |
| 176 | * <!-- end-user-doc --> |
| 177 | * @generated |
| 178 | */ |
| 179 | public ProcessingResourceSpecification getProcessingresourcespecification() { |
| 180 | if (processingresourcespecification != null && processingresourcespecification.eIsProxy()) { |
| 181 | InternalEObject oldProcessingresourcespecification = (InternalEObject)processingresourcespecification; |
| 182 | processingresourcespecification = (ProcessingResourceSpecification)eResolveProxy(oldProcessingresourcespecification); |
| 183 | if (processingresourcespecification != oldProcessingresourcespecification) { |
| 184 | if (eNotificationRequired()) |
| 185 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION, oldProcessingresourcespecification, processingresourcespecification)); |
| 186 | } |
| 187 | } |
| 188 | return processingresourcespecification; |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * <!-- begin-user-doc --> |
| 193 | * <!-- end-user-doc --> |
| 194 | * @generated |
| 195 | */ |
| 196 | public ProcessingResourceSpecification basicGetProcessingresourcespecification() { |
| 197 | return processingresourcespecification; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * <!-- begin-user-doc --> |
| 202 | * <!-- end-user-doc --> |
| 203 | * @generated |
| 204 | */ |
| 205 | public void setProcessingresourcespecification(ProcessingResourceSpecification newProcessingresourcespecification) { |
| 206 | ProcessingResourceSpecification oldProcessingresourcespecification = processingresourcespecification; |
| 207 | processingresourcespecification = newProcessingresourcespecification; |
| 208 | if (eNotificationRequired()) |
| 209 | eNotify(new ENotificationImpl(this, Notification.SET, costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION, oldProcessingresourcespecification, processingresourcespecification)); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * <!-- begin-user-doc --> |
| 214 | * <!-- end-user-doc --> |
| 215 | * @generated |
| 216 | */ |
| 217 | @Override |
| 218 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 219 | switch (featureID) { |
| 220 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION: |
| 221 | return basicSetProcessingRateInitialFunction(null, msgs); |
| 222 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION: |
| 223 | return basicSetProcessingRateOperatingFunction(null, msgs); |
| 224 | } |
| 225 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 226 | } |
| 227 | |
| 228 | /** |
| 229 | * <!-- begin-user-doc --> |
| 230 | * <!-- end-user-doc --> |
| 231 | * @generated |
| 232 | */ |
| 233 | @Override |
| 234 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 235 | switch (featureID) { |
| 236 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION: |
| 237 | if (resolve) return getProcessingresourcespecification(); |
| 238 | return basicGetProcessingresourcespecification(); |
| 239 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION: |
| 240 | return getProcessingRateInitialFunction(); |
| 241 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION: |
| 242 | return getProcessingRateOperatingFunction(); |
| 243 | } |
| 244 | return super.eGet(featureID, resolve, coreType); |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * <!-- begin-user-doc --> |
| 249 | * <!-- end-user-doc --> |
| 250 | * @generated |
| 251 | */ |
| 252 | @Override |
| 253 | public void eSet(int featureID, Object newValue) { |
| 254 | switch (featureID) { |
| 255 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION: |
| 256 | setProcessingresourcespecification((ProcessingResourceSpecification)newValue); |
| 257 | return; |
| 258 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION: |
| 259 | setProcessingRateInitialFunction((ScalarFunction)newValue); |
| 260 | return; |
| 261 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION: |
| 262 | setProcessingRateOperatingFunction((ScalarFunction)newValue); |
| 263 | return; |
| 264 | } |
| 265 | super.eSet(featureID, newValue); |
| 266 | } |
| 267 | |
| 268 | /** |
| 269 | * <!-- begin-user-doc --> |
| 270 | * <!-- end-user-doc --> |
| 271 | * @generated |
| 272 | */ |
| 273 | @Override |
| 274 | public void eUnset(int featureID) { |
| 275 | switch (featureID) { |
| 276 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION: |
| 277 | setProcessingresourcespecification((ProcessingResourceSpecification)null); |
| 278 | return; |
| 279 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION: |
| 280 | setProcessingRateInitialFunction((ScalarFunction)null); |
| 281 | return; |
| 282 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION: |
| 283 | setProcessingRateOperatingFunction((ScalarFunction)null); |
| 284 | return; |
| 285 | } |
| 286 | super.eUnset(featureID); |
| 287 | } |
| 288 | |
| 289 | /** |
| 290 | * <!-- begin-user-doc --> |
| 291 | * <!-- end-user-doc --> |
| 292 | * @generated |
| 293 | */ |
| 294 | @Override |
| 295 | public boolean eIsSet(int featureID) { |
| 296 | switch (featureID) { |
| 297 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION: |
| 298 | return processingresourcespecification != null; |
| 299 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_INITIAL_FUNCTION: |
| 300 | return processingRateInitialFunction != null; |
| 301 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSING_RATE_OPERATING_FUNCTION: |
| 302 | return processingRateOperatingFunction != null; |
| 303 | } |
| 304 | return super.eIsSet(featureID); |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * <!-- begin-user-doc --> |
| 309 | * <!-- end-user-doc --> |
| 310 | * @generated |
| 311 | */ |
| 312 | @Override |
| 313 | public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) { |
| 314 | if (baseClass == ProcessingResourceCost.class) { |
| 315 | switch (derivedFeatureID) { |
| 316 | case costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION: return costPackage.PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION; |
| 317 | default: return -1; |
| 318 | } |
| 319 | } |
| 320 | return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass); |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * <!-- begin-user-doc --> |
| 325 | * <!-- end-user-doc --> |
| 326 | * @generated |
| 327 | */ |
| 328 | @Override |
| 329 | public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) { |
| 330 | if (baseClass == ProcessingResourceCost.class) { |
| 331 | switch (baseFeatureID) { |
| 332 | case costPackage.PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION: return costPackage.VARIABLE_PROCESSING_RESOURCE_COST__PROCESSINGRESOURCESPECIFICATION; |
| 333 | default: return -1; |
| 334 | } |
| 335 | } |
| 336 | return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass); |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * <!-- begin-user-doc --> |
| 341 | * <!-- end-user-doc --> |
| 342 | * @generated not |
| 343 | */ |
| 344 | @Override |
| 345 | public double getOperatingCost() { |
| 346 | return CostUtil.getInstance().getOperatingCost(this); |
| 347 | } |
| 348 | |
| 349 | /** |
| 350 | * <!-- begin-user-doc --> |
| 351 | * <!-- end-user-doc --> |
| 352 | * @generated not |
| 353 | */ |
| 354 | @Override |
| 355 | public double getInitialCost() { |
| 356 | return CostUtil.getInstance().getInitialCost(this); |
| 357 | } |
| 358 | |
| 359 | |
| 360 | |
| 361 | @Override |
| 362 | public EObject basicGetAnnotatedElement() { |
| 363 | return this.getProcessingresourcespecification(); |
| 364 | } |
| 365 | |
| 366 | } //VariableProcessingResourceCostImpl |