| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.designdecision.GDoF.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.ChangeableElementDescription; |
| 10 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.GDoFPackage; |
| 11 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.SelectionRule; |
| 12 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.ValueRule; |
| 13 | |
| 14 | import org.eclipse.emf.common.notify.Notification; |
| 15 | import org.eclipse.emf.common.notify.NotificationChain; |
| 16 | |
| 17 | import org.eclipse.emf.ecore.EClass; |
| 18 | import org.eclipse.emf.ecore.EStructuralFeature; |
| 19 | import org.eclipse.emf.ecore.InternalEObject; |
| 20 | |
| 21 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 22 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 23 | |
| 24 | /** |
| 25 | * <!-- begin-user-doc --> |
| 26 | * An implementation of the model object '<em><b>Changeable Element Description</b></em>'. |
| 27 | * <!-- end-user-doc --> |
| 28 | * <p> |
| 29 | * The following features are implemented: |
| 30 | * <ul> |
| 31 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.ChangeableElementDescriptionImpl#getChangeable <em>Changeable</em>}</li> |
| 32 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.ChangeableElementDescriptionImpl#getValueRule <em>Value Rule</em>}</li> |
| 33 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.ChangeableElementDescriptionImpl#getSelectionRule <em>Selection Rule</em>}</li> |
| 34 | * </ul> |
| 35 | * </p> |
| 36 | * |
| 37 | * @generated |
| 38 | */ |
| 39 | public class ChangeableElementDescriptionImpl extends EObjectImpl implements ChangeableElementDescription { |
| 40 | /** |
| 41 | * The cached value of the '{@link #getChangeable() <em>Changeable</em>}' reference. |
| 42 | * <!-- begin-user-doc --> |
| 43 | * <!-- end-user-doc --> |
| 44 | * @see #getChangeable() |
| 45 | * @generated |
| 46 | * @ordered |
| 47 | */ |
| 48 | protected EStructuralFeature changeable; |
| 49 | |
| 50 | /** |
| 51 | * The cached value of the '{@link #getValueRule() <em>Value Rule</em>}' containment reference. |
| 52 | * <!-- begin-user-doc --> |
| 53 | * <!-- end-user-doc --> |
| 54 | * @see #getValueRule() |
| 55 | * @generated |
| 56 | * @ordered |
| 57 | */ |
| 58 | protected ValueRule valueRule; |
| 59 | |
| 60 | /** |
| 61 | * The cached value of the '{@link #getSelectionRule() <em>Selection Rule</em>}' containment reference. |
| 62 | * <!-- begin-user-doc --> |
| 63 | * <!-- end-user-doc --> |
| 64 | * @see #getSelectionRule() |
| 65 | * @generated |
| 66 | * @ordered |
| 67 | */ |
| 68 | protected SelectionRule selectionRule; |
| 69 | |
| 70 | /** |
| 71 | * <!-- begin-user-doc --> |
| 72 | * <!-- end-user-doc --> |
| 73 | * @generated |
| 74 | */ |
| 75 | protected ChangeableElementDescriptionImpl() { |
| 76 | super(); |
| 77 | } |
| 78 | |
| 79 | /** |
| 80 | * <!-- begin-user-doc --> |
| 81 | * <!-- end-user-doc --> |
| 82 | * @generated |
| 83 | */ |
| 84 | @Override |
| 85 | protected EClass eStaticClass() { |
| 86 | return GDoFPackage.Literals.CHANGEABLE_ELEMENT_DESCRIPTION; |
| 87 | } |
| 88 | |
| 89 | /** |
| 90 | * <!-- begin-user-doc --> |
| 91 | * <!-- end-user-doc --> |
| 92 | * @generated |
| 93 | */ |
| 94 | public EStructuralFeature getChangeable() { |
| 95 | if (changeable != null && changeable.eIsProxy()) { |
| 96 | InternalEObject oldChangeable = (InternalEObject)changeable; |
| 97 | changeable = (EStructuralFeature)eResolveProxy(oldChangeable); |
| 98 | if (changeable != oldChangeable) { |
| 99 | if (eNotificationRequired()) |
| 100 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE, oldChangeable, changeable)); |
| 101 | } |
| 102 | } |
| 103 | return changeable; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * <!-- begin-user-doc --> |
| 108 | * <!-- end-user-doc --> |
| 109 | * @generated |
| 110 | */ |
| 111 | public EStructuralFeature basicGetChangeable() { |
| 112 | return changeable; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * <!-- begin-user-doc --> |
| 117 | * <!-- end-user-doc --> |
| 118 | * @generated |
| 119 | */ |
| 120 | public void setChangeable(EStructuralFeature newChangeable) { |
| 121 | EStructuralFeature oldChangeable = changeable; |
| 122 | changeable = newChangeable; |
| 123 | if (eNotificationRequired()) |
| 124 | eNotify(new ENotificationImpl(this, Notification.SET, GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE, oldChangeable, changeable)); |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @generated |
| 131 | */ |
| 132 | public ValueRule getValueRule() { |
| 133 | return valueRule; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * <!-- begin-user-doc --> |
| 138 | * <!-- end-user-doc --> |
| 139 | * @generated |
| 140 | */ |
| 141 | public NotificationChain basicSetValueRule(ValueRule newValueRule, NotificationChain msgs) { |
| 142 | ValueRule oldValueRule = valueRule; |
| 143 | valueRule = newValueRule; |
| 144 | if (eNotificationRequired()) { |
| 145 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE, oldValueRule, newValueRule); |
| 146 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 147 | } |
| 148 | return msgs; |
| 149 | } |
| 150 | |
| 151 | /** |
| 152 | * <!-- begin-user-doc --> |
| 153 | * <!-- end-user-doc --> |
| 154 | * @generated |
| 155 | */ |
| 156 | public void setValueRule(ValueRule newValueRule) { |
| 157 | if (newValueRule != valueRule) { |
| 158 | NotificationChain msgs = null; |
| 159 | if (valueRule != null) |
| 160 | msgs = ((InternalEObject)valueRule).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE, null, msgs); |
| 161 | if (newValueRule != null) |
| 162 | msgs = ((InternalEObject)newValueRule).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE, null, msgs); |
| 163 | msgs = basicSetValueRule(newValueRule, msgs); |
| 164 | if (msgs != null) msgs.dispatch(); |
| 165 | } |
| 166 | else if (eNotificationRequired()) |
| 167 | eNotify(new ENotificationImpl(this, Notification.SET, GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE, newValueRule, newValueRule)); |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * <!-- begin-user-doc --> |
| 172 | * <!-- end-user-doc --> |
| 173 | * @generated |
| 174 | */ |
| 175 | public SelectionRule getSelectionRule() { |
| 176 | return selectionRule; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * <!-- begin-user-doc --> |
| 181 | * <!-- end-user-doc --> |
| 182 | * @generated |
| 183 | */ |
| 184 | public NotificationChain basicSetSelectionRule(SelectionRule newSelectionRule, NotificationChain msgs) { |
| 185 | SelectionRule oldSelectionRule = selectionRule; |
| 186 | selectionRule = newSelectionRule; |
| 187 | if (eNotificationRequired()) { |
| 188 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE, oldSelectionRule, newSelectionRule); |
| 189 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 190 | } |
| 191 | return msgs; |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * <!-- begin-user-doc --> |
| 196 | * <!-- end-user-doc --> |
| 197 | * @generated |
| 198 | */ |
| 199 | public void setSelectionRule(SelectionRule newSelectionRule) { |
| 200 | if (newSelectionRule != selectionRule) { |
| 201 | NotificationChain msgs = null; |
| 202 | if (selectionRule != null) |
| 203 | msgs = ((InternalEObject)selectionRule).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE, null, msgs); |
| 204 | if (newSelectionRule != null) |
| 205 | msgs = ((InternalEObject)newSelectionRule).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE, null, msgs); |
| 206 | msgs = basicSetSelectionRule(newSelectionRule, msgs); |
| 207 | if (msgs != null) msgs.dispatch(); |
| 208 | } |
| 209 | else if (eNotificationRequired()) |
| 210 | eNotify(new ENotificationImpl(this, Notification.SET, GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE, newSelectionRule, newSelectionRule)); |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * <!-- begin-user-doc --> |
| 215 | * <!-- end-user-doc --> |
| 216 | * @generated |
| 217 | */ |
| 218 | @Override |
| 219 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 220 | switch (featureID) { |
| 221 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE: |
| 222 | return basicSetValueRule(null, msgs); |
| 223 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE: |
| 224 | return basicSetSelectionRule(null, msgs); |
| 225 | } |
| 226 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * <!-- begin-user-doc --> |
| 231 | * <!-- end-user-doc --> |
| 232 | * @generated |
| 233 | */ |
| 234 | @Override |
| 235 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 236 | switch (featureID) { |
| 237 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE: |
| 238 | if (resolve) return getChangeable(); |
| 239 | return basicGetChangeable(); |
| 240 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE: |
| 241 | return getValueRule(); |
| 242 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE: |
| 243 | return getSelectionRule(); |
| 244 | } |
| 245 | return super.eGet(featureID, resolve, coreType); |
| 246 | } |
| 247 | |
| 248 | /** |
| 249 | * <!-- begin-user-doc --> |
| 250 | * <!-- end-user-doc --> |
| 251 | * @generated |
| 252 | */ |
| 253 | @Override |
| 254 | public void eSet(int featureID, Object newValue) { |
| 255 | switch (featureID) { |
| 256 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE: |
| 257 | setChangeable((EStructuralFeature)newValue); |
| 258 | return; |
| 259 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE: |
| 260 | setValueRule((ValueRule)newValue); |
| 261 | return; |
| 262 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE: |
| 263 | setSelectionRule((SelectionRule)newValue); |
| 264 | return; |
| 265 | } |
| 266 | super.eSet(featureID, newValue); |
| 267 | } |
| 268 | |
| 269 | /** |
| 270 | * <!-- begin-user-doc --> |
| 271 | * <!-- end-user-doc --> |
| 272 | * @generated |
| 273 | */ |
| 274 | @Override |
| 275 | public void eUnset(int featureID) { |
| 276 | switch (featureID) { |
| 277 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE: |
| 278 | setChangeable((EStructuralFeature)null); |
| 279 | return; |
| 280 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE: |
| 281 | setValueRule((ValueRule)null); |
| 282 | return; |
| 283 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE: |
| 284 | setSelectionRule((SelectionRule)null); |
| 285 | return; |
| 286 | } |
| 287 | super.eUnset(featureID); |
| 288 | } |
| 289 | |
| 290 | /** |
| 291 | * <!-- begin-user-doc --> |
| 292 | * <!-- end-user-doc --> |
| 293 | * @generated |
| 294 | */ |
| 295 | @Override |
| 296 | public boolean eIsSet(int featureID) { |
| 297 | switch (featureID) { |
| 298 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__CHANGEABLE: |
| 299 | return changeable != null; |
| 300 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__VALUE_RULE: |
| 301 | return valueRule != null; |
| 302 | case GDoFPackage.CHANGEABLE_ELEMENT_DESCRIPTION__SELECTION_RULE: |
| 303 | return selectionRule != null; |
| 304 | } |
| 305 | return super.eIsSet(featureID); |
| 306 | } |
| 307 | |
| 308 | } //ChangeableElementDescriptionImpl |