| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.stoex.impl; |
| 8 | |
| 9 | import org.eclipse.emf.common.notify.Notification; |
| 10 | import org.eclipse.emf.common.notify.NotificationChain; |
| 11 | import org.eclipse.emf.ecore.EClass; |
| 12 | import org.eclipse.emf.ecore.InternalEObject; |
| 13 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 14 | |
| 15 | import de.uka.ipd.sdq.stoex.Power; |
| 16 | import de.uka.ipd.sdq.stoex.PowerExpression; |
| 17 | import de.uka.ipd.sdq.stoex.StoexPackage; |
| 18 | import de.uka.ipd.sdq.stoex.Unary; |
| 19 | |
| 20 | /** |
| 21 | * <!-- begin-user-doc --> |
| 22 | * An implementation of the model object '<em><b>Power Expression</b></em>'. |
| 23 | * <!-- end-user-doc --> |
| 24 | * <p> |
| 25 | * The following features are implemented: |
| 26 | * <ul> |
| 27 | * <li>{@link de.uka.ipd.sdq.stoex.impl.PowerExpressionImpl#getBase <em>Base</em>}</li> |
| 28 | * <li>{@link de.uka.ipd.sdq.stoex.impl.PowerExpressionImpl#getExponent <em>Exponent</em>}</li> |
| 29 | * </ul> |
| 30 | * </p> |
| 31 | * |
| 32 | * @generated |
| 33 | */ |
| 34 | public class PowerExpressionImpl extends PowerImpl implements PowerExpression { |
| 35 | /** |
| 36 | * <!-- begin-user-doc --> |
| 37 | * <!-- end-user-doc --> |
| 38 | * @generated |
| 39 | */ |
| 40 | public static final String copyright = "Copyright 2007-2009, SDQ, IPD, U Karlsruhe"; |
| 41 | |
| 42 | /** |
| 43 | * The cached value of the '{@link #getBase() <em>Base</em>}' containment reference. |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @see #getBase() |
| 47 | * @generated |
| 48 | * @ordered |
| 49 | */ |
| 50 | protected Power base; |
| 51 | |
| 52 | /** |
| 53 | * The cached value of the '{@link #getExponent() <em>Exponent</em>}' containment reference. |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @see #getExponent() |
| 57 | * @generated |
| 58 | * @ordered |
| 59 | */ |
| 60 | protected Unary exponent; |
| 61 | |
| 62 | /** |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @generated |
| 66 | */ |
| 67 | protected PowerExpressionImpl() { |
| 68 | super(); |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | @Override |
| 77 | protected EClass eStaticClass() { |
| 78 | return StoexPackage.Literals.POWER_EXPRESSION; |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @generated |
| 85 | */ |
| 86 | public Power getBase() { |
| 87 | return base; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * <!-- begin-user-doc --> |
| 92 | * <!-- end-user-doc --> |
| 93 | * @generated |
| 94 | */ |
| 95 | public NotificationChain basicSetBase(Power newBase, NotificationChain msgs) { |
| 96 | Power oldBase = base; |
| 97 | base = newBase; |
| 98 | if (eNotificationRequired()) { |
| 99 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.POWER_EXPRESSION__BASE, oldBase, newBase); |
| 100 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 101 | } |
| 102 | return msgs; |
| 103 | } |
| 104 | |
| 105 | /** |
| 106 | * <!-- begin-user-doc --> |
| 107 | * <!-- end-user-doc --> |
| 108 | * @generated |
| 109 | */ |
| 110 | public void setBase(Power newBase) { |
| 111 | if (newBase != base) { |
| 112 | NotificationChain msgs = null; |
| 113 | if (base != null) |
| 114 | msgs = ((InternalEObject)base).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.POWER_EXPRESSION__BASE, null, msgs); |
| 115 | if (newBase != null) |
| 116 | msgs = ((InternalEObject)newBase).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.POWER_EXPRESSION__BASE, null, msgs); |
| 117 | msgs = basicSetBase(newBase, msgs); |
| 118 | if (msgs != null) msgs.dispatch(); |
| 119 | } |
| 120 | else if (eNotificationRequired()) |
| 121 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.POWER_EXPRESSION__BASE, newBase, newBase)); |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * <!-- begin-user-doc --> |
| 126 | * <!-- end-user-doc --> |
| 127 | * @generated |
| 128 | */ |
| 129 | public Unary getExponent() { |
| 130 | return exponent; |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * <!-- begin-user-doc --> |
| 135 | * <!-- end-user-doc --> |
| 136 | * @generated |
| 137 | */ |
| 138 | public NotificationChain basicSetExponent(Unary newExponent, NotificationChain msgs) { |
| 139 | Unary oldExponent = exponent; |
| 140 | exponent = newExponent; |
| 141 | if (eNotificationRequired()) { |
| 142 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.POWER_EXPRESSION__EXPONENT, oldExponent, newExponent); |
| 143 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 144 | } |
| 145 | return msgs; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * <!-- begin-user-doc --> |
| 150 | * <!-- end-user-doc --> |
| 151 | * @generated |
| 152 | */ |
| 153 | public void setExponent(Unary newExponent) { |
| 154 | if (newExponent != exponent) { |
| 155 | NotificationChain msgs = null; |
| 156 | if (exponent != null) |
| 157 | msgs = ((InternalEObject)exponent).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.POWER_EXPRESSION__EXPONENT, null, msgs); |
| 158 | if (newExponent != null) |
| 159 | msgs = ((InternalEObject)newExponent).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.POWER_EXPRESSION__EXPONENT, null, msgs); |
| 160 | msgs = basicSetExponent(newExponent, msgs); |
| 161 | if (msgs != null) msgs.dispatch(); |
| 162 | } |
| 163 | else if (eNotificationRequired()) |
| 164 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.POWER_EXPRESSION__EXPONENT, newExponent, newExponent)); |
| 165 | } |
| 166 | |
| 167 | /** |
| 168 | * <!-- begin-user-doc --> |
| 169 | * <!-- end-user-doc --> |
| 170 | * @generated |
| 171 | */ |
| 172 | @Override |
| 173 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 174 | switch (featureID) { |
| 175 | case StoexPackage.POWER_EXPRESSION__BASE: |
| 176 | return basicSetBase(null, msgs); |
| 177 | case StoexPackage.POWER_EXPRESSION__EXPONENT: |
| 178 | return basicSetExponent(null, msgs); |
| 179 | } |
| 180 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * <!-- begin-user-doc --> |
| 185 | * <!-- end-user-doc --> |
| 186 | * @generated |
| 187 | */ |
| 188 | @Override |
| 189 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 190 | switch (featureID) { |
| 191 | case StoexPackage.POWER_EXPRESSION__BASE: |
| 192 | return getBase(); |
| 193 | case StoexPackage.POWER_EXPRESSION__EXPONENT: |
| 194 | return getExponent(); |
| 195 | } |
| 196 | return super.eGet(featureID, resolve, coreType); |
| 197 | } |
| 198 | |
| 199 | /** |
| 200 | * <!-- begin-user-doc --> |
| 201 | * <!-- end-user-doc --> |
| 202 | * @generated |
| 203 | */ |
| 204 | @Override |
| 205 | public void eSet(int featureID, Object newValue) { |
| 206 | switch (featureID) { |
| 207 | case StoexPackage.POWER_EXPRESSION__BASE: |
| 208 | setBase((Power)newValue); |
| 209 | return; |
| 210 | case StoexPackage.POWER_EXPRESSION__EXPONENT: |
| 211 | setExponent((Unary)newValue); |
| 212 | return; |
| 213 | } |
| 214 | super.eSet(featureID, newValue); |
| 215 | } |
| 216 | |
| 217 | /** |
| 218 | * <!-- begin-user-doc --> |
| 219 | * <!-- end-user-doc --> |
| 220 | * @generated |
| 221 | */ |
| 222 | @Override |
| 223 | public void eUnset(int featureID) { |
| 224 | switch (featureID) { |
| 225 | case StoexPackage.POWER_EXPRESSION__BASE: |
| 226 | setBase((Power)null); |
| 227 | return; |
| 228 | case StoexPackage.POWER_EXPRESSION__EXPONENT: |
| 229 | setExponent((Unary)null); |
| 230 | return; |
| 231 | } |
| 232 | super.eUnset(featureID); |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * <!-- begin-user-doc --> |
| 237 | * <!-- end-user-doc --> |
| 238 | * @generated |
| 239 | */ |
| 240 | @Override |
| 241 | public boolean eIsSet(int featureID) { |
| 242 | switch (featureID) { |
| 243 | case StoexPackage.POWER_EXPRESSION__BASE: |
| 244 | return base != null; |
| 245 | case StoexPackage.POWER_EXPRESSION__EXPONENT: |
| 246 | return exponent != null; |
| 247 | } |
| 248 | return super.eIsSet(featureID); |
| 249 | } |
| 250 | |
| 251 | } //PowerExpressionImpl |