| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.repository.impl; |
| 7 | |
| 8 | import org.eclipse.emf.common.notify.Notification; |
| 9 | import org.eclipse.emf.common.notify.NotificationChain; |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.InternalEObject; |
| 12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 13 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 14 | |
| 15 | import de.uka.ipd.sdq.pcm.core.CorePackage; |
| 16 | import de.uka.ipd.sdq.pcm.core.PCMRandomVariable; |
| 17 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
| 18 | import de.uka.ipd.sdq.pcm.reliability.ReliabilityPackage; |
| 19 | import de.uka.ipd.sdq.pcm.reliability.ResourceTimeoutFailureType; |
| 20 | import de.uka.ipd.sdq.pcm.repository.BasicComponent; |
| 21 | import de.uka.ipd.sdq.pcm.repository.PassiveResource; |
| 22 | import de.uka.ipd.sdq.pcm.repository.RepositoryPackage; |
| 23 | |
| 24 | /** |
| 25 | * <!-- begin-user-doc --> |
| 26 | * An implementation of the model object '<em><b>Passive Resource</b></em>'. |
| 27 | * <!-- end-user-doc --> |
| 28 | * <p> |
| 29 | * The following features are implemented: |
| 30 | * <ul> |
| 31 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.PassiveResourceImpl#getCapacity_PassiveResource <em>Capacity Passive Resource</em>}</li> |
| 32 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.PassiveResourceImpl#getBasicComponent_PassiveResource <em>Basic Component Passive Resource</em>}</li> |
| 33 | * <li>{@link de.uka.ipd.sdq.pcm.repository.impl.PassiveResourceImpl#getResourceTimeoutFailureType__PassiveResource <em>Resource Timeout Failure Type Passive Resource</em>}</li> |
| 34 | * </ul> |
| 35 | * </p> |
| 36 | * |
| 37 | * @generated |
| 38 | */ |
| 39 | public class PassiveResourceImpl extends EntityImpl implements PassiveResource { |
| 40 | /** |
| 41 | * <!-- begin-user-doc --> |
| 42 | * <!-- end-user-doc --> |
| 43 | * @generated |
| 44 | */ |
| 45 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 46 | |
| 47 | /** |
| 48 | * The cached value of the '{@link #getCapacity_PassiveResource() <em>Capacity Passive Resource</em>}' containment reference. |
| 49 | * <!-- begin-user-doc --> |
| 50 | * <!-- end-user-doc --> |
| 51 | * @see #getCapacity_PassiveResource() |
| 52 | * @generated |
| 53 | * @ordered |
| 54 | */ |
| 55 | protected PCMRandomVariable capacity_PassiveResource; |
| 56 | |
| 57 | /** |
| 58 | * The cached value of the '{@link #getResourceTimeoutFailureType__PassiveResource() <em>Resource Timeout Failure Type Passive Resource</em>}' reference. |
| 59 | * <!-- begin-user-doc --> |
| 60 | * <!-- end-user-doc --> |
| 61 | * @see #getResourceTimeoutFailureType__PassiveResource() |
| 62 | * @generated |
| 63 | * @ordered |
| 64 | */ |
| 65 | protected ResourceTimeoutFailureType resourceTimeoutFailureType__PassiveResource; |
| 66 | |
| 67 | /** |
| 68 | * <!-- begin-user-doc --> |
| 69 | * <!-- end-user-doc --> |
| 70 | * @generated |
| 71 | */ |
| 72 | protected PassiveResourceImpl() { |
| 73 | super(); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * <!-- begin-user-doc --> |
| 78 | * <!-- end-user-doc --> |
| 79 | * @generated |
| 80 | */ |
| 81 | @Override |
| 82 | protected EClass eStaticClass() { |
| 83 | return RepositoryPackage.Literals.PASSIVE_RESOURCE; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * <!-- begin-user-doc --> |
| 88 | * <!-- end-user-doc --> |
| 89 | * @generated |
| 90 | */ |
| 91 | public PCMRandomVariable getCapacity_PassiveResource() { |
| 92 | return capacity_PassiveResource; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * <!-- begin-user-doc --> |
| 97 | * <!-- end-user-doc --> |
| 98 | * @generated |
| 99 | */ |
| 100 | public NotificationChain basicSetCapacity_PassiveResource(PCMRandomVariable newCapacity_PassiveResource, NotificationChain msgs) { |
| 101 | PCMRandomVariable oldCapacity_PassiveResource = capacity_PassiveResource; |
| 102 | capacity_PassiveResource = newCapacity_PassiveResource; |
| 103 | if (eNotificationRequired()) { |
| 104 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE, oldCapacity_PassiveResource, newCapacity_PassiveResource); |
| 105 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 106 | } |
| 107 | return msgs; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * <!-- begin-user-doc --> |
| 112 | * <!-- end-user-doc --> |
| 113 | * @generated |
| 114 | */ |
| 115 | public void setCapacity_PassiveResource(PCMRandomVariable newCapacity_PassiveResource) { |
| 116 | if (newCapacity_PassiveResource != capacity_PassiveResource) { |
| 117 | NotificationChain msgs = null; |
| 118 | if (capacity_PassiveResource != null) |
| 119 | msgs = ((InternalEObject)capacity_PassiveResource).eInverseRemove(this, CorePackage.PCM_RANDOM_VARIABLE__PASSIVE_RESOURCE_CAPACITY_PCM_RANDOM_VARIABLE, PCMRandomVariable.class, msgs); |
| 120 | if (newCapacity_PassiveResource != null) |
| 121 | msgs = ((InternalEObject)newCapacity_PassiveResource).eInverseAdd(this, CorePackage.PCM_RANDOM_VARIABLE__PASSIVE_RESOURCE_CAPACITY_PCM_RANDOM_VARIABLE, PCMRandomVariable.class, msgs); |
| 122 | msgs = basicSetCapacity_PassiveResource(newCapacity_PassiveResource, msgs); |
| 123 | if (msgs != null) msgs.dispatch(); |
| 124 | } |
| 125 | else if (eNotificationRequired()) |
| 126 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE, newCapacity_PassiveResource, newCapacity_PassiveResource)); |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * <!-- begin-user-doc --> |
| 131 | * <!-- end-user-doc --> |
| 132 | * @generated |
| 133 | */ |
| 134 | public BasicComponent getBasicComponent_PassiveResource() { |
| 135 | if (eContainerFeatureID() != RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE) return null; |
| 136 | return (BasicComponent)eContainer(); |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * <!-- begin-user-doc --> |
| 141 | * <!-- end-user-doc --> |
| 142 | * @generated |
| 143 | */ |
| 144 | public NotificationChain basicSetBasicComponent_PassiveResource(BasicComponent newBasicComponent_PassiveResource, NotificationChain msgs) { |
| 145 | msgs = eBasicSetContainer((InternalEObject)newBasicComponent_PassiveResource, RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE, msgs); |
| 146 | return msgs; |
| 147 | } |
| 148 | |
| 149 | /** |
| 150 | * <!-- begin-user-doc --> |
| 151 | * <!-- end-user-doc --> |
| 152 | * @generated |
| 153 | */ |
| 154 | public void setBasicComponent_PassiveResource(BasicComponent newBasicComponent_PassiveResource) { |
| 155 | if (newBasicComponent_PassiveResource != eInternalContainer() || (eContainerFeatureID() != RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE && newBasicComponent_PassiveResource != null)) { |
| 156 | if (EcoreUtil.isAncestor(this, newBasicComponent_PassiveResource)) |
| 157 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 158 | NotificationChain msgs = null; |
| 159 | if (eInternalContainer() != null) |
| 160 | msgs = eBasicRemoveFromContainer(msgs); |
| 161 | if (newBasicComponent_PassiveResource != null) |
| 162 | msgs = ((InternalEObject)newBasicComponent_PassiveResource).eInverseAdd(this, RepositoryPackage.BASIC_COMPONENT__PASSIVE_RESOURCE_BASIC_COMPONENT, BasicComponent.class, msgs); |
| 163 | msgs = basicSetBasicComponent_PassiveResource(newBasicComponent_PassiveResource, msgs); |
| 164 | if (msgs != null) msgs.dispatch(); |
| 165 | } |
| 166 | else if (eNotificationRequired()) |
| 167 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE, newBasicComponent_PassiveResource, newBasicComponent_PassiveResource)); |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | public ResourceTimeoutFailureType getResourceTimeoutFailureType__PassiveResource() { |
| 176 | if (resourceTimeoutFailureType__PassiveResource != null && resourceTimeoutFailureType__PassiveResource.eIsProxy()) { |
| 177 | InternalEObject oldResourceTimeoutFailureType__PassiveResource = (InternalEObject)resourceTimeoutFailureType__PassiveResource; |
| 178 | resourceTimeoutFailureType__PassiveResource = (ResourceTimeoutFailureType)eResolveProxy(oldResourceTimeoutFailureType__PassiveResource); |
| 179 | if (resourceTimeoutFailureType__PassiveResource != oldResourceTimeoutFailureType__PassiveResource) { |
| 180 | if (eNotificationRequired()) |
| 181 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE, oldResourceTimeoutFailureType__PassiveResource, resourceTimeoutFailureType__PassiveResource)); |
| 182 | } |
| 183 | } |
| 184 | return resourceTimeoutFailureType__PassiveResource; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * <!-- begin-user-doc --> |
| 189 | * <!-- end-user-doc --> |
| 190 | * @generated |
| 191 | */ |
| 192 | public ResourceTimeoutFailureType basicGetResourceTimeoutFailureType__PassiveResource() { |
| 193 | return resourceTimeoutFailureType__PassiveResource; |
| 194 | } |
| 195 | |
| 196 | /** |
| 197 | * <!-- begin-user-doc --> |
| 198 | * <!-- end-user-doc --> |
| 199 | * @generated |
| 200 | */ |
| 201 | public NotificationChain basicSetResourceTimeoutFailureType__PassiveResource(ResourceTimeoutFailureType newResourceTimeoutFailureType__PassiveResource, NotificationChain msgs) { |
| 202 | ResourceTimeoutFailureType oldResourceTimeoutFailureType__PassiveResource = resourceTimeoutFailureType__PassiveResource; |
| 203 | resourceTimeoutFailureType__PassiveResource = newResourceTimeoutFailureType__PassiveResource; |
| 204 | if (eNotificationRequired()) { |
| 205 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE, oldResourceTimeoutFailureType__PassiveResource, newResourceTimeoutFailureType__PassiveResource); |
| 206 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 207 | } |
| 208 | return msgs; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * <!-- begin-user-doc --> |
| 213 | * <!-- end-user-doc --> |
| 214 | * @generated |
| 215 | */ |
| 216 | public void setResourceTimeoutFailureType__PassiveResource(ResourceTimeoutFailureType newResourceTimeoutFailureType__PassiveResource) { |
| 217 | if (newResourceTimeoutFailureType__PassiveResource != resourceTimeoutFailureType__PassiveResource) { |
| 218 | NotificationChain msgs = null; |
| 219 | if (resourceTimeoutFailureType__PassiveResource != null) |
| 220 | msgs = ((InternalEObject)resourceTimeoutFailureType__PassiveResource).eInverseRemove(this, ReliabilityPackage.RESOURCE_TIMEOUT_FAILURE_TYPE__PASSIVE_RESOURCE_RESOURCE_TIMEOUT_FAILURE_TYPE, ResourceTimeoutFailureType.class, msgs); |
| 221 | if (newResourceTimeoutFailureType__PassiveResource != null) |
| 222 | msgs = ((InternalEObject)newResourceTimeoutFailureType__PassiveResource).eInverseAdd(this, ReliabilityPackage.RESOURCE_TIMEOUT_FAILURE_TYPE__PASSIVE_RESOURCE_RESOURCE_TIMEOUT_FAILURE_TYPE, ResourceTimeoutFailureType.class, msgs); |
| 223 | msgs = basicSetResourceTimeoutFailureType__PassiveResource(newResourceTimeoutFailureType__PassiveResource, msgs); |
| 224 | if (msgs != null) msgs.dispatch(); |
| 225 | } |
| 226 | else if (eNotificationRequired()) |
| 227 | eNotify(new ENotificationImpl(this, Notification.SET, RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE, newResourceTimeoutFailureType__PassiveResource, newResourceTimeoutFailureType__PassiveResource)); |
| 228 | } |
| 229 | |
| 230 | /** |
| 231 | * <!-- begin-user-doc --> |
| 232 | * <!-- end-user-doc --> |
| 233 | * @generated |
| 234 | */ |
| 235 | @Override |
| 236 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 237 | switch (featureID) { |
| 238 | case RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE: |
| 239 | if (capacity_PassiveResource != null) |
| 240 | msgs = ((InternalEObject)capacity_PassiveResource).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE, null, msgs); |
| 241 | return basicSetCapacity_PassiveResource((PCMRandomVariable)otherEnd, msgs); |
| 242 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 243 | if (eInternalContainer() != null) |
| 244 | msgs = eBasicRemoveFromContainer(msgs); |
| 245 | return basicSetBasicComponent_PassiveResource((BasicComponent)otherEnd, msgs); |
| 246 | case RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE: |
| 247 | if (resourceTimeoutFailureType__PassiveResource != null) |
| 248 | msgs = ((InternalEObject)resourceTimeoutFailureType__PassiveResource).eInverseRemove(this, ReliabilityPackage.RESOURCE_TIMEOUT_FAILURE_TYPE__PASSIVE_RESOURCE_RESOURCE_TIMEOUT_FAILURE_TYPE, ResourceTimeoutFailureType.class, msgs); |
| 249 | return basicSetResourceTimeoutFailureType__PassiveResource((ResourceTimeoutFailureType)otherEnd, msgs); |
| 250 | } |
| 251 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * <!-- begin-user-doc --> |
| 256 | * <!-- end-user-doc --> |
| 257 | * @generated |
| 258 | */ |
| 259 | @Override |
| 260 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 261 | switch (featureID) { |
| 262 | case RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE: |
| 263 | return basicSetCapacity_PassiveResource(null, msgs); |
| 264 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 265 | return basicSetBasicComponent_PassiveResource(null, msgs); |
| 266 | case RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE: |
| 267 | return basicSetResourceTimeoutFailureType__PassiveResource(null, msgs); |
| 268 | } |
| 269 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * <!-- begin-user-doc --> |
| 274 | * <!-- end-user-doc --> |
| 275 | * @generated |
| 276 | */ |
| 277 | @Override |
| 278 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 279 | switch (eContainerFeatureID()) { |
| 280 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 281 | return eInternalContainer().eInverseRemove(this, RepositoryPackage.BASIC_COMPONENT__PASSIVE_RESOURCE_BASIC_COMPONENT, BasicComponent.class, msgs); |
| 282 | } |
| 283 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 284 | } |
| 285 | |
| 286 | /** |
| 287 | * <!-- begin-user-doc --> |
| 288 | * <!-- end-user-doc --> |
| 289 | * @generated |
| 290 | */ |
| 291 | @Override |
| 292 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 293 | switch (featureID) { |
| 294 | case RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE: |
| 295 | return getCapacity_PassiveResource(); |
| 296 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 297 | return getBasicComponent_PassiveResource(); |
| 298 | case RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE: |
| 299 | if (resolve) return getResourceTimeoutFailureType__PassiveResource(); |
| 300 | return basicGetResourceTimeoutFailureType__PassiveResource(); |
| 301 | } |
| 302 | return super.eGet(featureID, resolve, coreType); |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * <!-- begin-user-doc --> |
| 307 | * <!-- end-user-doc --> |
| 308 | * @generated |
| 309 | */ |
| 310 | @Override |
| 311 | public void eSet(int featureID, Object newValue) { |
| 312 | switch (featureID) { |
| 313 | case RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE: |
| 314 | setCapacity_PassiveResource((PCMRandomVariable)newValue); |
| 315 | return; |
| 316 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 317 | setBasicComponent_PassiveResource((BasicComponent)newValue); |
| 318 | return; |
| 319 | case RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE: |
| 320 | setResourceTimeoutFailureType__PassiveResource((ResourceTimeoutFailureType)newValue); |
| 321 | return; |
| 322 | } |
| 323 | super.eSet(featureID, newValue); |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * <!-- begin-user-doc --> |
| 328 | * <!-- end-user-doc --> |
| 329 | * @generated |
| 330 | */ |
| 331 | @Override |
| 332 | public void eUnset(int featureID) { |
| 333 | switch (featureID) { |
| 334 | case RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE: |
| 335 | setCapacity_PassiveResource((PCMRandomVariable)null); |
| 336 | return; |
| 337 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 338 | setBasicComponent_PassiveResource((BasicComponent)null); |
| 339 | return; |
| 340 | case RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE: |
| 341 | setResourceTimeoutFailureType__PassiveResource((ResourceTimeoutFailureType)null); |
| 342 | return; |
| 343 | } |
| 344 | super.eUnset(featureID); |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * <!-- begin-user-doc --> |
| 349 | * <!-- end-user-doc --> |
| 350 | * @generated |
| 351 | */ |
| 352 | @Override |
| 353 | public boolean eIsSet(int featureID) { |
| 354 | switch (featureID) { |
| 355 | case RepositoryPackage.PASSIVE_RESOURCE__CAPACITY_PASSIVE_RESOURCE: |
| 356 | return capacity_PassiveResource != null; |
| 357 | case RepositoryPackage.PASSIVE_RESOURCE__BASIC_COMPONENT_PASSIVE_RESOURCE: |
| 358 | return getBasicComponent_PassiveResource() != null; |
| 359 | case RepositoryPackage.PASSIVE_RESOURCE__RESOURCE_TIMEOUT_FAILURE_TYPE_PASSIVE_RESOURCE: |
| 360 | return resourceTimeoutFailureType__PassiveResource != null; |
| 361 | } |
| 362 | return super.eIsSet(featureID); |
| 363 | } |
| 364 | |
| 365 | } //PassiveResourceImpl |