| 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.BooleanExpression; |
| 16 | import de.uka.ipd.sdq.stoex.IfElseExpression; |
| 17 | import de.uka.ipd.sdq.stoex.StoexPackage; |
| 18 | |
| 19 | /** |
| 20 | * <!-- begin-user-doc --> |
| 21 | * An implementation of the model object '<em><b>If Else Expression</b></em>'. |
| 22 | * <!-- end-user-doc --> |
| 23 | * <p> |
| 24 | * The following features are implemented: |
| 25 | * <ul> |
| 26 | * <li>{@link de.uka.ipd.sdq.stoex.impl.IfElseExpressionImpl#getIfExpression <em>If Expression</em>}</li> |
| 27 | * <li>{@link de.uka.ipd.sdq.stoex.impl.IfElseExpressionImpl#getElseExpression <em>Else Expression</em>}</li> |
| 28 | * <li>{@link de.uka.ipd.sdq.stoex.impl.IfElseExpressionImpl#getConditionExpression <em>Condition Expression</em>}</li> |
| 29 | * </ul> |
| 30 | * </p> |
| 31 | * |
| 32 | * @generated |
| 33 | */ |
| 34 | public class IfElseExpressionImpl extends IfElseImpl implements IfElseExpression { |
| 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 #getIfExpression() <em>If Expression</em>}' containment reference. |
| 44 | * <!-- begin-user-doc --> |
| 45 | * <!-- end-user-doc --> |
| 46 | * @see #getIfExpression() |
| 47 | * @generated |
| 48 | * @ordered |
| 49 | */ |
| 50 | protected BooleanExpression ifExpression; |
| 51 | |
| 52 | /** |
| 53 | * The cached value of the '{@link #getElseExpression() <em>Else Expression</em>}' containment reference. |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @see #getElseExpression() |
| 57 | * @generated |
| 58 | * @ordered |
| 59 | */ |
| 60 | protected BooleanExpression elseExpression; |
| 61 | |
| 62 | /** |
| 63 | * The cached value of the '{@link #getConditionExpression() <em>Condition Expression</em>}' containment reference. |
| 64 | * <!-- begin-user-doc --> |
| 65 | * <!-- end-user-doc --> |
| 66 | * @see #getConditionExpression() |
| 67 | * @generated |
| 68 | * @ordered |
| 69 | */ |
| 70 | protected BooleanExpression conditionExpression; |
| 71 | |
| 72 | /** |
| 73 | * <!-- begin-user-doc --> |
| 74 | * <!-- end-user-doc --> |
| 75 | * @generated |
| 76 | */ |
| 77 | protected IfElseExpressionImpl() { |
| 78 | super(); |
| 79 | } |
| 80 | |
| 81 | /** |
| 82 | * <!-- begin-user-doc --> |
| 83 | * <!-- end-user-doc --> |
| 84 | * @generated |
| 85 | */ |
| 86 | @Override |
| 87 | protected EClass eStaticClass() { |
| 88 | return StoexPackage.Literals.IF_ELSE_EXPRESSION; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * <!-- begin-user-doc --> |
| 93 | * <!-- end-user-doc --> |
| 94 | * @generated |
| 95 | */ |
| 96 | public BooleanExpression getIfExpression() { |
| 97 | return ifExpression; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @generated |
| 104 | */ |
| 105 | public NotificationChain basicSetIfExpression(BooleanExpression newIfExpression, NotificationChain msgs) { |
| 106 | BooleanExpression oldIfExpression = ifExpression; |
| 107 | ifExpression = newIfExpression; |
| 108 | if (eNotificationRequired()) { |
| 109 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION, oldIfExpression, newIfExpression); |
| 110 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 111 | } |
| 112 | return msgs; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * <!-- begin-user-doc --> |
| 117 | * <!-- end-user-doc --> |
| 118 | * @generated |
| 119 | */ |
| 120 | public void setIfExpression(BooleanExpression newIfExpression) { |
| 121 | if (newIfExpression != ifExpression) { |
| 122 | NotificationChain msgs = null; |
| 123 | if (ifExpression != null) |
| 124 | msgs = ((InternalEObject)ifExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION, null, msgs); |
| 125 | if (newIfExpression != null) |
| 126 | msgs = ((InternalEObject)newIfExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION, null, msgs); |
| 127 | msgs = basicSetIfExpression(newIfExpression, msgs); |
| 128 | if (msgs != null) msgs.dispatch(); |
| 129 | } |
| 130 | else if (eNotificationRequired()) |
| 131 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION, newIfExpression, newIfExpression)); |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated |
| 138 | */ |
| 139 | public BooleanExpression getElseExpression() { |
| 140 | return elseExpression; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * <!-- begin-user-doc --> |
| 145 | * <!-- end-user-doc --> |
| 146 | * @generated |
| 147 | */ |
| 148 | public NotificationChain basicSetElseExpression(BooleanExpression newElseExpression, NotificationChain msgs) { |
| 149 | BooleanExpression oldElseExpression = elseExpression; |
| 150 | elseExpression = newElseExpression; |
| 151 | if (eNotificationRequired()) { |
| 152 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION, oldElseExpression, newElseExpression); |
| 153 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 154 | } |
| 155 | return msgs; |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * <!-- begin-user-doc --> |
| 160 | * <!-- end-user-doc --> |
| 161 | * @generated |
| 162 | */ |
| 163 | public void setElseExpression(BooleanExpression newElseExpression) { |
| 164 | if (newElseExpression != elseExpression) { |
| 165 | NotificationChain msgs = null; |
| 166 | if (elseExpression != null) |
| 167 | msgs = ((InternalEObject)elseExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION, null, msgs); |
| 168 | if (newElseExpression != null) |
| 169 | msgs = ((InternalEObject)newElseExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION, null, msgs); |
| 170 | msgs = basicSetElseExpression(newElseExpression, msgs); |
| 171 | if (msgs != null) msgs.dispatch(); |
| 172 | } |
| 173 | else if (eNotificationRequired()) |
| 174 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION, newElseExpression, newElseExpression)); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | public BooleanExpression getConditionExpression() { |
| 183 | return conditionExpression; |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * <!-- begin-user-doc --> |
| 188 | * <!-- end-user-doc --> |
| 189 | * @generated |
| 190 | */ |
| 191 | public NotificationChain basicSetConditionExpression(BooleanExpression newConditionExpression, NotificationChain msgs) { |
| 192 | BooleanExpression oldConditionExpression = conditionExpression; |
| 193 | conditionExpression = newConditionExpression; |
| 194 | if (eNotificationRequired()) { |
| 195 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION, oldConditionExpression, newConditionExpression); |
| 196 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 197 | } |
| 198 | return msgs; |
| 199 | } |
| 200 | |
| 201 | /** |
| 202 | * <!-- begin-user-doc --> |
| 203 | * <!-- end-user-doc --> |
| 204 | * @generated |
| 205 | */ |
| 206 | public void setConditionExpression(BooleanExpression newConditionExpression) { |
| 207 | if (newConditionExpression != conditionExpression) { |
| 208 | NotificationChain msgs = null; |
| 209 | if (conditionExpression != null) |
| 210 | msgs = ((InternalEObject)conditionExpression).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION, null, msgs); |
| 211 | if (newConditionExpression != null) |
| 212 | msgs = ((InternalEObject)newConditionExpression).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION, null, msgs); |
| 213 | msgs = basicSetConditionExpression(newConditionExpression, msgs); |
| 214 | if (msgs != null) msgs.dispatch(); |
| 215 | } |
| 216 | else if (eNotificationRequired()) |
| 217 | eNotify(new ENotificationImpl(this, Notification.SET, StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION, newConditionExpression, newConditionExpression)); |
| 218 | } |
| 219 | |
| 220 | /** |
| 221 | * <!-- begin-user-doc --> |
| 222 | * <!-- end-user-doc --> |
| 223 | * @generated |
| 224 | */ |
| 225 | @Override |
| 226 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 227 | switch (featureID) { |
| 228 | case StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION: |
| 229 | return basicSetIfExpression(null, msgs); |
| 230 | case StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION: |
| 231 | return basicSetElseExpression(null, msgs); |
| 232 | case StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION: |
| 233 | return basicSetConditionExpression(null, msgs); |
| 234 | } |
| 235 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * <!-- begin-user-doc --> |
| 240 | * <!-- end-user-doc --> |
| 241 | * @generated |
| 242 | */ |
| 243 | @Override |
| 244 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 245 | switch (featureID) { |
| 246 | case StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION: |
| 247 | return getIfExpression(); |
| 248 | case StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION: |
| 249 | return getElseExpression(); |
| 250 | case StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION: |
| 251 | return getConditionExpression(); |
| 252 | } |
| 253 | return super.eGet(featureID, resolve, coreType); |
| 254 | } |
| 255 | |
| 256 | /** |
| 257 | * <!-- begin-user-doc --> |
| 258 | * <!-- end-user-doc --> |
| 259 | * @generated |
| 260 | */ |
| 261 | @Override |
| 262 | public void eSet(int featureID, Object newValue) { |
| 263 | switch (featureID) { |
| 264 | case StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION: |
| 265 | setIfExpression((BooleanExpression)newValue); |
| 266 | return; |
| 267 | case StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION: |
| 268 | setElseExpression((BooleanExpression)newValue); |
| 269 | return; |
| 270 | case StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION: |
| 271 | setConditionExpression((BooleanExpression)newValue); |
| 272 | return; |
| 273 | } |
| 274 | super.eSet(featureID, newValue); |
| 275 | } |
| 276 | |
| 277 | /** |
| 278 | * <!-- begin-user-doc --> |
| 279 | * <!-- end-user-doc --> |
| 280 | * @generated |
| 281 | */ |
| 282 | @Override |
| 283 | public void eUnset(int featureID) { |
| 284 | switch (featureID) { |
| 285 | case StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION: |
| 286 | setIfExpression((BooleanExpression)null); |
| 287 | return; |
| 288 | case StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION: |
| 289 | setElseExpression((BooleanExpression)null); |
| 290 | return; |
| 291 | case StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION: |
| 292 | setConditionExpression((BooleanExpression)null); |
| 293 | return; |
| 294 | } |
| 295 | super.eUnset(featureID); |
| 296 | } |
| 297 | |
| 298 | /** |
| 299 | * <!-- begin-user-doc --> |
| 300 | * <!-- end-user-doc --> |
| 301 | * @generated |
| 302 | */ |
| 303 | @Override |
| 304 | public boolean eIsSet(int featureID) { |
| 305 | switch (featureID) { |
| 306 | case StoexPackage.IF_ELSE_EXPRESSION__IF_EXPRESSION: |
| 307 | return ifExpression != null; |
| 308 | case StoexPackage.IF_ELSE_EXPRESSION__ELSE_EXPRESSION: |
| 309 | return elseExpression != null; |
| 310 | case StoexPackage.IF_ELSE_EXPRESSION__CONDITION_EXPRESSION: |
| 311 | return conditionExpression != null; |
| 312 | } |
| 313 | return super.eIsSet(featureID); |
| 314 | } |
| 315 | |
| 316 | } //IfElseExpressionImpl |