| 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.ComponentCost; |
| 10 | import de.uka.ipd.sdq.pcm.cost.costPackage; |
| 11 | |
| 12 | import de.uka.ipd.sdq.pcm.repository.RepositoryComponent; |
| 13 | |
| 14 | import org.eclipse.emf.common.notify.Notification; |
| 15 | |
| 16 | import org.eclipse.emf.ecore.EClass; |
| 17 | import org.eclipse.emf.ecore.EObject; |
| 18 | import org.eclipse.emf.ecore.InternalEObject; |
| 19 | |
| 20 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 21 | |
| 22 | /** |
| 23 | * <!-- begin-user-doc --> |
| 24 | * An implementation of the model object '<em><b>Component Cost</b></em>'. |
| 25 | * <!-- end-user-doc --> |
| 26 | * <p> |
| 27 | * The following features are implemented: |
| 28 | * <ul> |
| 29 | * <li>{@link de.uka.ipd.sdq.pcm.cost.impl.ComponentCostImpl#getComponentOperatingCost <em>Component Operating Cost</em>}</li> |
| 30 | * <li>{@link de.uka.ipd.sdq.pcm.cost.impl.ComponentCostImpl#getComponentInitialCost <em>Component Initial Cost</em>}</li> |
| 31 | * <li>{@link de.uka.ipd.sdq.pcm.cost.impl.ComponentCostImpl#getRepositoryComponent <em>Repository Component</em>}</li> |
| 32 | * </ul> |
| 33 | * </p> |
| 34 | * |
| 35 | * @generated |
| 36 | */ |
| 37 | public class ComponentCostImpl extends CostImpl implements ComponentCost { |
| 38 | /** |
| 39 | * The default value of the '{@link #getComponentOperatingCost() <em>Component Operating Cost</em>}' attribute. |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @see #getComponentOperatingCost() |
| 43 | * @generated |
| 44 | * @ordered |
| 45 | */ |
| 46 | protected static final double COMPONENT_OPERATING_COST_EDEFAULT = 0.0; |
| 47 | |
| 48 | /** |
| 49 | * The cached value of the '{@link #getComponentOperatingCost() <em>Component Operating Cost</em>}' attribute. |
| 50 | * <!-- begin-user-doc --> |
| 51 | * <!-- end-user-doc --> |
| 52 | * @see #getComponentOperatingCost() |
| 53 | * @generated |
| 54 | * @ordered |
| 55 | */ |
| 56 | protected double componentOperatingCost = COMPONENT_OPERATING_COST_EDEFAULT; |
| 57 | |
| 58 | /** |
| 59 | * The default value of the '{@link #getComponentInitialCost() <em>Component Initial Cost</em>}' attribute. |
| 60 | * <!-- begin-user-doc --> |
| 61 | * <!-- end-user-doc --> |
| 62 | * @see #getComponentInitialCost() |
| 63 | * @generated |
| 64 | * @ordered |
| 65 | */ |
| 66 | protected static final double COMPONENT_INITIAL_COST_EDEFAULT = 0.0; |
| 67 | |
| 68 | /** |
| 69 | * The cached value of the '{@link #getComponentInitialCost() <em>Component Initial Cost</em>}' attribute. |
| 70 | * <!-- begin-user-doc --> |
| 71 | * <!-- end-user-doc --> |
| 72 | * @see #getComponentInitialCost() |
| 73 | * @generated |
| 74 | * @ordered |
| 75 | */ |
| 76 | protected double componentInitialCost = COMPONENT_INITIAL_COST_EDEFAULT; |
| 77 | |
| 78 | /** |
| 79 | * The cached value of the '{@link #getRepositoryComponent() <em>Repository Component</em>}' reference. |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @see #getRepositoryComponent() |
| 83 | * @generated |
| 84 | * @ordered |
| 85 | */ |
| 86 | protected RepositoryComponent repositoryComponent; |
| 87 | |
| 88 | /** |
| 89 | * <!-- begin-user-doc --> |
| 90 | * <!-- end-user-doc --> |
| 91 | * @generated |
| 92 | */ |
| 93 | protected ComponentCostImpl() { |
| 94 | super(); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | @Override |
| 103 | protected EClass eStaticClass() { |
| 104 | return costPackage.Literals.COMPONENT_COST; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * <!-- begin-user-doc --> |
| 109 | * <!-- end-user-doc --> |
| 110 | * @generated |
| 111 | */ |
| 112 | public double getComponentOperatingCost() { |
| 113 | return componentOperatingCost; |
| 114 | } |
| 115 | |
| 116 | /** |
| 117 | * <!-- begin-user-doc --> |
| 118 | * <!-- end-user-doc --> |
| 119 | * @generated |
| 120 | */ |
| 121 | public void setComponentOperatingCost(double newComponentOperatingCost) { |
| 122 | double oldComponentOperatingCost = componentOperatingCost; |
| 123 | componentOperatingCost = newComponentOperatingCost; |
| 124 | if (eNotificationRequired()) |
| 125 | eNotify(new ENotificationImpl(this, Notification.SET, costPackage.COMPONENT_COST__COMPONENT_OPERATING_COST, oldComponentOperatingCost, componentOperatingCost)); |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * <!-- begin-user-doc --> |
| 130 | * <!-- end-user-doc --> |
| 131 | * @generated |
| 132 | */ |
| 133 | public double getComponentInitialCost() { |
| 134 | return componentInitialCost; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * <!-- begin-user-doc --> |
| 139 | * <!-- end-user-doc --> |
| 140 | * @generated |
| 141 | */ |
| 142 | public void setComponentInitialCost(double newComponentInitialCost) { |
| 143 | double oldComponentInitialCost = componentInitialCost; |
| 144 | componentInitialCost = newComponentInitialCost; |
| 145 | if (eNotificationRequired()) |
| 146 | eNotify(new ENotificationImpl(this, Notification.SET, costPackage.COMPONENT_COST__COMPONENT_INITIAL_COST, oldComponentInitialCost, componentInitialCost)); |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * <!-- begin-user-doc --> |
| 151 | * <!-- end-user-doc --> |
| 152 | * @generated |
| 153 | */ |
| 154 | public RepositoryComponent getRepositoryComponent() { |
| 155 | if (repositoryComponent != null && repositoryComponent.eIsProxy()) { |
| 156 | InternalEObject oldRepositoryComponent = (InternalEObject)repositoryComponent; |
| 157 | repositoryComponent = (RepositoryComponent)eResolveProxy(oldRepositoryComponent); |
| 158 | if (repositoryComponent != oldRepositoryComponent) { |
| 159 | if (eNotificationRequired()) |
| 160 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, costPackage.COMPONENT_COST__REPOSITORY_COMPONENT, oldRepositoryComponent, repositoryComponent)); |
| 161 | } |
| 162 | } |
| 163 | return repositoryComponent; |
| 164 | } |
| 165 | |
| 166 | /** |
| 167 | * <!-- begin-user-doc --> |
| 168 | * <!-- end-user-doc --> |
| 169 | * @generated |
| 170 | */ |
| 171 | public RepositoryComponent basicGetRepositoryComponent() { |
| 172 | return repositoryComponent; |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * <!-- begin-user-doc --> |
| 177 | * <!-- end-user-doc --> |
| 178 | * @generated |
| 179 | */ |
| 180 | public void setRepositoryComponent(RepositoryComponent newRepositoryComponent) { |
| 181 | RepositoryComponent oldRepositoryComponent = repositoryComponent; |
| 182 | repositoryComponent = newRepositoryComponent; |
| 183 | if (eNotificationRequired()) |
| 184 | eNotify(new ENotificationImpl(this, Notification.SET, costPackage.COMPONENT_COST__REPOSITORY_COMPONENT, oldRepositoryComponent, repositoryComponent)); |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * <!-- begin-user-doc --> |
| 189 | * <!-- end-user-doc --> |
| 190 | * @generated |
| 191 | */ |
| 192 | @Override |
| 193 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 194 | switch (featureID) { |
| 195 | case costPackage.COMPONENT_COST__COMPONENT_OPERATING_COST: |
| 196 | return getComponentOperatingCost(); |
| 197 | case costPackage.COMPONENT_COST__COMPONENT_INITIAL_COST: |
| 198 | return getComponentInitialCost(); |
| 199 | case costPackage.COMPONENT_COST__REPOSITORY_COMPONENT: |
| 200 | if (resolve) return getRepositoryComponent(); |
| 201 | return basicGetRepositoryComponent(); |
| 202 | } |
| 203 | return super.eGet(featureID, resolve, coreType); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * <!-- begin-user-doc --> |
| 208 | * <!-- end-user-doc --> |
| 209 | * @generated |
| 210 | */ |
| 211 | @Override |
| 212 | public void eSet(int featureID, Object newValue) { |
| 213 | switch (featureID) { |
| 214 | case costPackage.COMPONENT_COST__COMPONENT_OPERATING_COST: |
| 215 | setComponentOperatingCost((Double)newValue); |
| 216 | return; |
| 217 | case costPackage.COMPONENT_COST__COMPONENT_INITIAL_COST: |
| 218 | setComponentInitialCost((Double)newValue); |
| 219 | return; |
| 220 | case costPackage.COMPONENT_COST__REPOSITORY_COMPONENT: |
| 221 | setRepositoryComponent((RepositoryComponent)newValue); |
| 222 | return; |
| 223 | } |
| 224 | super.eSet(featureID, newValue); |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * <!-- begin-user-doc --> |
| 229 | * <!-- end-user-doc --> |
| 230 | * @generated |
| 231 | */ |
| 232 | @Override |
| 233 | public void eUnset(int featureID) { |
| 234 | switch (featureID) { |
| 235 | case costPackage.COMPONENT_COST__COMPONENT_OPERATING_COST: |
| 236 | setComponentOperatingCost(COMPONENT_OPERATING_COST_EDEFAULT); |
| 237 | return; |
| 238 | case costPackage.COMPONENT_COST__COMPONENT_INITIAL_COST: |
| 239 | setComponentInitialCost(COMPONENT_INITIAL_COST_EDEFAULT); |
| 240 | return; |
| 241 | case costPackage.COMPONENT_COST__REPOSITORY_COMPONENT: |
| 242 | setRepositoryComponent((RepositoryComponent)null); |
| 243 | return; |
| 244 | } |
| 245 | super.eUnset(featureID); |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * <!-- begin-user-doc --> |
| 250 | * <!-- end-user-doc --> |
| 251 | * @generated |
| 252 | */ |
| 253 | @Override |
| 254 | public boolean eIsSet(int featureID) { |
| 255 | switch (featureID) { |
| 256 | case costPackage.COMPONENT_COST__COMPONENT_OPERATING_COST: |
| 257 | return componentOperatingCost != COMPONENT_OPERATING_COST_EDEFAULT; |
| 258 | case costPackage.COMPONENT_COST__COMPONENT_INITIAL_COST: |
| 259 | return componentInitialCost != COMPONENT_INITIAL_COST_EDEFAULT; |
| 260 | case costPackage.COMPONENT_COST__REPOSITORY_COMPONENT: |
| 261 | return repositoryComponent != null; |
| 262 | } |
| 263 | return super.eIsSet(featureID); |
| 264 | } |
| 265 | |
| 266 | /** |
| 267 | * <!-- begin-user-doc --> |
| 268 | * <!-- end-user-doc --> |
| 269 | * @generated |
| 270 | */ |
| 271 | @Override |
| 272 | public String toString() { |
| 273 | if (eIsProxy()) return super.toString(); |
| 274 | |
| 275 | StringBuffer result = new StringBuffer(super.toString()); |
| 276 | result.append(" (componentOperatingCost: "); |
| 277 | result.append(componentOperatingCost); |
| 278 | result.append(", componentInitialCost: "); |
| 279 | result.append(componentInitialCost); |
| 280 | result.append(')'); |
| 281 | return result.toString(); |
| 282 | } |
| 283 | |
| 284 | /** |
| 285 | * <!-- begin-user-doc --> |
| 286 | * <!-- end-user-doc --> |
| 287 | * @generated not |
| 288 | */ |
| 289 | @Override |
| 290 | public double getOperatingCost() { |
| 291 | return this.getComponentOperatingCost(); |
| 292 | } |
| 293 | |
| 294 | /** |
| 295 | * <!-- begin-user-doc --> |
| 296 | * <!-- end-user-doc --> |
| 297 | * @generated not |
| 298 | */ |
| 299 | @Override |
| 300 | public double getInitialCost() { |
| 301 | return this.getComponentInitialCost(); |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * @generated not |
| 306 | */ |
| 307 | @Override |
| 308 | public EObject basicGetAnnotatedElement() { |
| 309 | return this.getRepositoryComponent(); |
| 310 | } |
| 311 | |
| 312 | } //ComponentCostImpl |