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