| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.spa.expression.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.spa.expression.Expression; |
| 10 | import de.uka.ipd.sdq.spa.expression.ExpressionPackage; |
| 11 | import de.uka.ipd.sdq.spa.expression.Parallel; |
| 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>Parallel</b></em>'. |
| 24 | * <!-- end-user-doc --> |
| 25 | * <p> |
| 26 | * The following features are implemented: |
| 27 | * <ul> |
| 28 | * <li>{@link de.uka.ipd.sdq.spa.expression.impl.ParallelImpl#getLeftTask <em>Left Task</em>}</li> |
| 29 | * <li>{@link de.uka.ipd.sdq.spa.expression.impl.ParallelImpl#getRightTask <em>Right Task</em>}</li> |
| 30 | * </ul> |
| 31 | * </p> |
| 32 | * |
| 33 | * @generated |
| 34 | */ |
| 35 | public class ParallelImpl extends OperationImpl implements Parallel { |
| 36 | /** |
| 37 | * The cached value of the '{@link #getLeftTask() <em>Left Task</em>}' containment reference. |
| 38 | * <!-- begin-user-doc --> |
| 39 | * <!-- end-user-doc --> |
| 40 | * @see #getLeftTask() |
| 41 | * @generated |
| 42 | * @ordered |
| 43 | */ |
| 44 | protected Expression leftTask = null; |
| 45 | |
| 46 | /** |
| 47 | * The cached value of the '{@link #getRightTask() <em>Right Task</em>}' containment reference. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @see #getRightTask() |
| 51 | * @generated |
| 52 | * @ordered |
| 53 | */ |
| 54 | protected Expression rightTask = null; |
| 55 | |
| 56 | /** |
| 57 | * <!-- begin-user-doc --> |
| 58 | * <!-- end-user-doc --> |
| 59 | * @generated |
| 60 | */ |
| 61 | protected ParallelImpl() { |
| 62 | super(); |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @generated |
| 69 | */ |
| 70 | @Override |
| 71 | protected EClass eStaticClass() { |
| 72 | return ExpressionPackage.Literals.PARALLEL; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * <!-- begin-user-doc --> |
| 77 | * <!-- end-user-doc --> |
| 78 | * @generated |
| 79 | */ |
| 80 | public Expression getLeftTask() { |
| 81 | return leftTask; |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * <!-- begin-user-doc --> |
| 86 | * <!-- end-user-doc --> |
| 87 | * @generated |
| 88 | */ |
| 89 | public NotificationChain basicSetLeftTask(Expression newLeftTask, NotificationChain msgs) { |
| 90 | Expression oldLeftTask = leftTask; |
| 91 | leftTask = newLeftTask; |
| 92 | if (eNotificationRequired()) { |
| 93 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.PARALLEL__LEFT_TASK, oldLeftTask, newLeftTask); |
| 94 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 95 | } |
| 96 | return msgs; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * <!-- begin-user-doc --> |
| 101 | * <!-- end-user-doc --> |
| 102 | * @generated |
| 103 | */ |
| 104 | public void setLeftTask(Expression newLeftTask) { |
| 105 | if (newLeftTask != leftTask) { |
| 106 | NotificationChain msgs = null; |
| 107 | if (leftTask != null) |
| 108 | msgs = ((InternalEObject)leftTask).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.PARALLEL__LEFT_TASK, null, msgs); |
| 109 | if (newLeftTask != null) |
| 110 | msgs = ((InternalEObject)newLeftTask).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.PARALLEL__LEFT_TASK, null, msgs); |
| 111 | msgs = basicSetLeftTask(newLeftTask, msgs); |
| 112 | if (msgs != null) msgs.dispatch(); |
| 113 | } |
| 114 | else if (eNotificationRequired()) |
| 115 | eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.PARALLEL__LEFT_TASK, newLeftTask, newLeftTask)); |
| 116 | } |
| 117 | |
| 118 | /** |
| 119 | * <!-- begin-user-doc --> |
| 120 | * <!-- end-user-doc --> |
| 121 | * @generated |
| 122 | */ |
| 123 | public Expression getRightTask() { |
| 124 | return rightTask; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * <!-- begin-user-doc --> |
| 129 | * <!-- end-user-doc --> |
| 130 | * @generated |
| 131 | */ |
| 132 | public NotificationChain basicSetRightTask(Expression newRightTask, NotificationChain msgs) { |
| 133 | Expression oldRightTask = rightTask; |
| 134 | rightTask = newRightTask; |
| 135 | if (eNotificationRequired()) { |
| 136 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ExpressionPackage.PARALLEL__RIGHT_TASK, oldRightTask, newRightTask); |
| 137 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 138 | } |
| 139 | return msgs; |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * <!-- begin-user-doc --> |
| 144 | * <!-- end-user-doc --> |
| 145 | * @generated |
| 146 | */ |
| 147 | public void setRightTask(Expression newRightTask) { |
| 148 | if (newRightTask != rightTask) { |
| 149 | NotificationChain msgs = null; |
| 150 | if (rightTask != null) |
| 151 | msgs = ((InternalEObject)rightTask).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.PARALLEL__RIGHT_TASK, null, msgs); |
| 152 | if (newRightTask != null) |
| 153 | msgs = ((InternalEObject)newRightTask).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ExpressionPackage.PARALLEL__RIGHT_TASK, null, msgs); |
| 154 | msgs = basicSetRightTask(newRightTask, msgs); |
| 155 | if (msgs != null) msgs.dispatch(); |
| 156 | } |
| 157 | else if (eNotificationRequired()) |
| 158 | eNotify(new ENotificationImpl(this, Notification.SET, ExpressionPackage.PARALLEL__RIGHT_TASK, newRightTask, newRightTask)); |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * <!-- begin-user-doc --> |
| 163 | * <!-- end-user-doc --> |
| 164 | * @generated |
| 165 | */ |
| 166 | @Override |
| 167 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 168 | switch (featureID) { |
| 169 | case ExpressionPackage.PARALLEL__LEFT_TASK: |
| 170 | return basicSetLeftTask(null, msgs); |
| 171 | case ExpressionPackage.PARALLEL__RIGHT_TASK: |
| 172 | return basicSetRightTask(null, msgs); |
| 173 | } |
| 174 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * <!-- begin-user-doc --> |
| 179 | * <!-- end-user-doc --> |
| 180 | * @generated |
| 181 | */ |
| 182 | @Override |
| 183 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 184 | switch (featureID) { |
| 185 | case ExpressionPackage.PARALLEL__LEFT_TASK: |
| 186 | return getLeftTask(); |
| 187 | case ExpressionPackage.PARALLEL__RIGHT_TASK: |
| 188 | return getRightTask(); |
| 189 | } |
| 190 | return super.eGet(featureID, resolve, coreType); |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * <!-- begin-user-doc --> |
| 195 | * <!-- end-user-doc --> |
| 196 | * @generated |
| 197 | */ |
| 198 | @Override |
| 199 | public void eSet(int featureID, Object newValue) { |
| 200 | switch (featureID) { |
| 201 | case ExpressionPackage.PARALLEL__LEFT_TASK: |
| 202 | setLeftTask((Expression)newValue); |
| 203 | return; |
| 204 | case ExpressionPackage.PARALLEL__RIGHT_TASK: |
| 205 | setRightTask((Expression)newValue); |
| 206 | return; |
| 207 | } |
| 208 | super.eSet(featureID, newValue); |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * <!-- begin-user-doc --> |
| 213 | * <!-- end-user-doc --> |
| 214 | * @generated |
| 215 | */ |
| 216 | @Override |
| 217 | public void eUnset(int featureID) { |
| 218 | switch (featureID) { |
| 219 | case ExpressionPackage.PARALLEL__LEFT_TASK: |
| 220 | setLeftTask((Expression)null); |
| 221 | return; |
| 222 | case ExpressionPackage.PARALLEL__RIGHT_TASK: |
| 223 | setRightTask((Expression)null); |
| 224 | return; |
| 225 | } |
| 226 | super.eUnset(featureID); |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * <!-- begin-user-doc --> |
| 231 | * <!-- end-user-doc --> |
| 232 | * @generated |
| 233 | */ |
| 234 | @Override |
| 235 | public boolean eIsSet(int featureID) { |
| 236 | switch (featureID) { |
| 237 | case ExpressionPackage.PARALLEL__LEFT_TASK: |
| 238 | return leftTask != null; |
| 239 | case ExpressionPackage.PARALLEL__RIGHT_TASK: |
| 240 | return rightTask != null; |
| 241 | } |
| 242 | return super.eIsSet(featureID); |
| 243 | } |
| 244 | |
| 245 | } //ParallelImpl |