| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.usagemodel.impl; |
| 7 | |
| 8 | import org.eclipse.emf.common.notify.Notification; |
| 9 | import org.eclipse.emf.common.notify.NotificationChain; |
| 10 | import org.eclipse.emf.ecore.EClass; |
| 11 | import org.eclipse.emf.ecore.InternalEObject; |
| 12 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 13 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 14 | |
| 15 | import de.uka.ipd.sdq.pcm.core.entity.impl.EntityImpl; |
| 16 | import de.uka.ipd.sdq.pcm.usagemodel.AbstractUserAction; |
| 17 | import de.uka.ipd.sdq.pcm.usagemodel.ScenarioBehaviour; |
| 18 | import de.uka.ipd.sdq.pcm.usagemodel.UsagemodelPackage; |
| 19 | |
| 20 | /** |
| 21 | * <!-- begin-user-doc --> |
| 22 | * An implementation of the model object '<em><b>Abstract User Action</b></em>'. |
| 23 | * <!-- end-user-doc --> |
| 24 | * <p> |
| 25 | * The following features are implemented: |
| 26 | * <ul> |
| 27 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.AbstractUserActionImpl#getSuccessor <em>Successor</em>}</li> |
| 28 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.AbstractUserActionImpl#getPredecessor <em>Predecessor</em>}</li> |
| 29 | * <li>{@link de.uka.ipd.sdq.pcm.usagemodel.impl.AbstractUserActionImpl#getScenarioBehaviour_AbstractUserAction <em>Scenario Behaviour Abstract User Action</em>}</li> |
| 30 | * </ul> |
| 31 | * </p> |
| 32 | * |
| 33 | * @generated |
| 34 | */ |
| 35 | public abstract class AbstractUserActionImpl extends EntityImpl implements AbstractUserAction { |
| 36 | /** |
| 37 | * <!-- begin-user-doc --> |
| 38 | * <!-- end-user-doc --> |
| 39 | * @generated |
| 40 | */ |
| 41 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 42 | |
| 43 | /** |
| 44 | * The cached value of the '{@link #getSuccessor() <em>Successor</em>}' reference. |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @see #getSuccessor() |
| 48 | * @generated |
| 49 | * @ordered |
| 50 | */ |
| 51 | protected AbstractUserAction successor; |
| 52 | |
| 53 | /** |
| 54 | * The cached value of the '{@link #getPredecessor() <em>Predecessor</em>}' reference. |
| 55 | * <!-- begin-user-doc --> |
| 56 | * <!-- end-user-doc --> |
| 57 | * @see #getPredecessor() |
| 58 | * @generated |
| 59 | * @ordered |
| 60 | */ |
| 61 | protected AbstractUserAction predecessor; |
| 62 | |
| 63 | /** |
| 64 | * <!-- begin-user-doc --> |
| 65 | * <!-- end-user-doc --> |
| 66 | * @generated |
| 67 | */ |
| 68 | protected AbstractUserActionImpl() { |
| 69 | super(); |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * <!-- begin-user-doc --> |
| 74 | * <!-- end-user-doc --> |
| 75 | * @generated |
| 76 | */ |
| 77 | @Override |
| 78 | protected EClass eStaticClass() { |
| 79 | return UsagemodelPackage.Literals.ABSTRACT_USER_ACTION; |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * <!-- begin-user-doc --> |
| 84 | * <!-- end-user-doc --> |
| 85 | * @generated |
| 86 | */ |
| 87 | public AbstractUserAction getSuccessor() { |
| 88 | if (successor != null && successor.eIsProxy()) { |
| 89 | InternalEObject oldSuccessor = (InternalEObject)successor; |
| 90 | successor = (AbstractUserAction)eResolveProxy(oldSuccessor); |
| 91 | if (successor != oldSuccessor) { |
| 92 | if (eNotificationRequired()) |
| 93 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR, oldSuccessor, successor)); |
| 94 | } |
| 95 | } |
| 96 | return successor; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * <!-- begin-user-doc --> |
| 101 | * <!-- end-user-doc --> |
| 102 | * @generated |
| 103 | */ |
| 104 | public AbstractUserAction basicGetSuccessor() { |
| 105 | return successor; |
| 106 | } |
| 107 | |
| 108 | /** |
| 109 | * <!-- begin-user-doc --> |
| 110 | * <!-- end-user-doc --> |
| 111 | * @generated |
| 112 | */ |
| 113 | public NotificationChain basicSetSuccessor(AbstractUserAction newSuccessor, NotificationChain msgs) { |
| 114 | AbstractUserAction oldSuccessor = successor; |
| 115 | successor = newSuccessor; |
| 116 | if (eNotificationRequired()) { |
| 117 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR, oldSuccessor, newSuccessor); |
| 118 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 119 | } |
| 120 | return msgs; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * <!-- begin-user-doc --> |
| 125 | * <!-- end-user-doc --> |
| 126 | * @generated |
| 127 | */ |
| 128 | public void setSuccessor(AbstractUserAction newSuccessor) { |
| 129 | if (newSuccessor != successor) { |
| 130 | NotificationChain msgs = null; |
| 131 | if (successor != null) |
| 132 | msgs = ((InternalEObject)successor).eInverseRemove(this, UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR, AbstractUserAction.class, msgs); |
| 133 | if (newSuccessor != null) |
| 134 | msgs = ((InternalEObject)newSuccessor).eInverseAdd(this, UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR, AbstractUserAction.class, msgs); |
| 135 | msgs = basicSetSuccessor(newSuccessor, msgs); |
| 136 | if (msgs != null) msgs.dispatch(); |
| 137 | } |
| 138 | else if (eNotificationRequired()) |
| 139 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR, newSuccessor, newSuccessor)); |
| 140 | } |
| 141 | |
| 142 | /** |
| 143 | * <!-- begin-user-doc --> |
| 144 | * <!-- end-user-doc --> |
| 145 | * @generated |
| 146 | */ |
| 147 | public AbstractUserAction getPredecessor() { |
| 148 | if (predecessor != null && predecessor.eIsProxy()) { |
| 149 | InternalEObject oldPredecessor = (InternalEObject)predecessor; |
| 150 | predecessor = (AbstractUserAction)eResolveProxy(oldPredecessor); |
| 151 | if (predecessor != oldPredecessor) { |
| 152 | if (eNotificationRequired()) |
| 153 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR, oldPredecessor, predecessor)); |
| 154 | } |
| 155 | } |
| 156 | return predecessor; |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * <!-- begin-user-doc --> |
| 161 | * <!-- end-user-doc --> |
| 162 | * @generated |
| 163 | */ |
| 164 | public AbstractUserAction basicGetPredecessor() { |
| 165 | return predecessor; |
| 166 | } |
| 167 | |
| 168 | /** |
| 169 | * <!-- begin-user-doc --> |
| 170 | * <!-- end-user-doc --> |
| 171 | * @generated |
| 172 | */ |
| 173 | public NotificationChain basicSetPredecessor(AbstractUserAction newPredecessor, NotificationChain msgs) { |
| 174 | AbstractUserAction oldPredecessor = predecessor; |
| 175 | predecessor = newPredecessor; |
| 176 | if (eNotificationRequired()) { |
| 177 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR, oldPredecessor, newPredecessor); |
| 178 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 179 | } |
| 180 | return msgs; |
| 181 | } |
| 182 | |
| 183 | /** |
| 184 | * <!-- begin-user-doc --> |
| 185 | * <!-- end-user-doc --> |
| 186 | * @generated |
| 187 | */ |
| 188 | public void setPredecessor(AbstractUserAction newPredecessor) { |
| 189 | if (newPredecessor != predecessor) { |
| 190 | NotificationChain msgs = null; |
| 191 | if (predecessor != null) |
| 192 | msgs = ((InternalEObject)predecessor).eInverseRemove(this, UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR, AbstractUserAction.class, msgs); |
| 193 | if (newPredecessor != null) |
| 194 | msgs = ((InternalEObject)newPredecessor).eInverseAdd(this, UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR, AbstractUserAction.class, msgs); |
| 195 | msgs = basicSetPredecessor(newPredecessor, msgs); |
| 196 | if (msgs != null) msgs.dispatch(); |
| 197 | } |
| 198 | else if (eNotificationRequired()) |
| 199 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR, newPredecessor, newPredecessor)); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * <!-- begin-user-doc --> |
| 204 | * <!-- end-user-doc --> |
| 205 | * @generated |
| 206 | */ |
| 207 | public ScenarioBehaviour getScenarioBehaviour_AbstractUserAction() { |
| 208 | if (eContainerFeatureID() != UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION) return null; |
| 209 | return (ScenarioBehaviour)eContainer(); |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * <!-- begin-user-doc --> |
| 214 | * <!-- end-user-doc --> |
| 215 | * @generated |
| 216 | */ |
| 217 | public NotificationChain basicSetScenarioBehaviour_AbstractUserAction(ScenarioBehaviour newScenarioBehaviour_AbstractUserAction, NotificationChain msgs) { |
| 218 | msgs = eBasicSetContainer((InternalEObject)newScenarioBehaviour_AbstractUserAction, UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION, msgs); |
| 219 | return msgs; |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * <!-- begin-user-doc --> |
| 224 | * <!-- end-user-doc --> |
| 225 | * @generated |
| 226 | */ |
| 227 | public void setScenarioBehaviour_AbstractUserAction(ScenarioBehaviour newScenarioBehaviour_AbstractUserAction) { |
| 228 | if (newScenarioBehaviour_AbstractUserAction != eInternalContainer() || (eContainerFeatureID() != UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION && newScenarioBehaviour_AbstractUserAction != null)) { |
| 229 | if (EcoreUtil.isAncestor(this, newScenarioBehaviour_AbstractUserAction)) |
| 230 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 231 | NotificationChain msgs = null; |
| 232 | if (eInternalContainer() != null) |
| 233 | msgs = eBasicRemoveFromContainer(msgs); |
| 234 | if (newScenarioBehaviour_AbstractUserAction != null) |
| 235 | msgs = ((InternalEObject)newScenarioBehaviour_AbstractUserAction).eInverseAdd(this, UsagemodelPackage.SCENARIO_BEHAVIOUR__ACTIONS_SCENARIO_BEHAVIOUR, ScenarioBehaviour.class, msgs); |
| 236 | msgs = basicSetScenarioBehaviour_AbstractUserAction(newScenarioBehaviour_AbstractUserAction, msgs); |
| 237 | if (msgs != null) msgs.dispatch(); |
| 238 | } |
| 239 | else if (eNotificationRequired()) |
| 240 | eNotify(new ENotificationImpl(this, Notification.SET, UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION, newScenarioBehaviour_AbstractUserAction, newScenarioBehaviour_AbstractUserAction)); |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * <!-- begin-user-doc --> |
| 245 | * <!-- end-user-doc --> |
| 246 | * @generated |
| 247 | */ |
| 248 | @Override |
| 249 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 250 | switch (featureID) { |
| 251 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR: |
| 252 | if (successor != null) |
| 253 | msgs = ((InternalEObject)successor).eInverseRemove(this, UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR, AbstractUserAction.class, msgs); |
| 254 | return basicSetSuccessor((AbstractUserAction)otherEnd, msgs); |
| 255 | case UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR: |
| 256 | if (predecessor != null) |
| 257 | msgs = ((InternalEObject)predecessor).eInverseRemove(this, UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR, AbstractUserAction.class, msgs); |
| 258 | return basicSetPredecessor((AbstractUserAction)otherEnd, msgs); |
| 259 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 260 | if (eInternalContainer() != null) |
| 261 | msgs = eBasicRemoveFromContainer(msgs); |
| 262 | return basicSetScenarioBehaviour_AbstractUserAction((ScenarioBehaviour)otherEnd, msgs); |
| 263 | } |
| 264 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * <!-- begin-user-doc --> |
| 269 | * <!-- end-user-doc --> |
| 270 | * @generated |
| 271 | */ |
| 272 | @Override |
| 273 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 274 | switch (featureID) { |
| 275 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR: |
| 276 | return basicSetSuccessor(null, msgs); |
| 277 | case UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR: |
| 278 | return basicSetPredecessor(null, msgs); |
| 279 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 280 | return basicSetScenarioBehaviour_AbstractUserAction(null, msgs); |
| 281 | } |
| 282 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 283 | } |
| 284 | |
| 285 | /** |
| 286 | * <!-- begin-user-doc --> |
| 287 | * <!-- end-user-doc --> |
| 288 | * @generated |
| 289 | */ |
| 290 | @Override |
| 291 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 292 | switch (eContainerFeatureID()) { |
| 293 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 294 | return eInternalContainer().eInverseRemove(this, UsagemodelPackage.SCENARIO_BEHAVIOUR__ACTIONS_SCENARIO_BEHAVIOUR, ScenarioBehaviour.class, msgs); |
| 295 | } |
| 296 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * <!-- begin-user-doc --> |
| 301 | * <!-- end-user-doc --> |
| 302 | * @generated |
| 303 | */ |
| 304 | @Override |
| 305 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 306 | switch (featureID) { |
| 307 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR: |
| 308 | if (resolve) return getSuccessor(); |
| 309 | return basicGetSuccessor(); |
| 310 | case UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR: |
| 311 | if (resolve) return getPredecessor(); |
| 312 | return basicGetPredecessor(); |
| 313 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 314 | return getScenarioBehaviour_AbstractUserAction(); |
| 315 | } |
| 316 | return super.eGet(featureID, resolve, coreType); |
| 317 | } |
| 318 | |
| 319 | /** |
| 320 | * <!-- begin-user-doc --> |
| 321 | * <!-- end-user-doc --> |
| 322 | * @generated |
| 323 | */ |
| 324 | @Override |
| 325 | public void eSet(int featureID, Object newValue) { |
| 326 | switch (featureID) { |
| 327 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR: |
| 328 | setSuccessor((AbstractUserAction)newValue); |
| 329 | return; |
| 330 | case UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR: |
| 331 | setPredecessor((AbstractUserAction)newValue); |
| 332 | return; |
| 333 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 334 | setScenarioBehaviour_AbstractUserAction((ScenarioBehaviour)newValue); |
| 335 | return; |
| 336 | } |
| 337 | super.eSet(featureID, newValue); |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * <!-- begin-user-doc --> |
| 342 | * <!-- end-user-doc --> |
| 343 | * @generated |
| 344 | */ |
| 345 | @Override |
| 346 | public void eUnset(int featureID) { |
| 347 | switch (featureID) { |
| 348 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR: |
| 349 | setSuccessor((AbstractUserAction)null); |
| 350 | return; |
| 351 | case UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR: |
| 352 | setPredecessor((AbstractUserAction)null); |
| 353 | return; |
| 354 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 355 | setScenarioBehaviour_AbstractUserAction((ScenarioBehaviour)null); |
| 356 | return; |
| 357 | } |
| 358 | super.eUnset(featureID); |
| 359 | } |
| 360 | |
| 361 | /** |
| 362 | * <!-- begin-user-doc --> |
| 363 | * <!-- end-user-doc --> |
| 364 | * @generated |
| 365 | */ |
| 366 | @Override |
| 367 | public boolean eIsSet(int featureID) { |
| 368 | switch (featureID) { |
| 369 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SUCCESSOR: |
| 370 | return successor != null; |
| 371 | case UsagemodelPackage.ABSTRACT_USER_ACTION__PREDECESSOR: |
| 372 | return predecessor != null; |
| 373 | case UsagemodelPackage.ABSTRACT_USER_ACTION__SCENARIO_BEHAVIOUR_ABSTRACT_USER_ACTION: |
| 374 | return getScenarioBehaviour_AbstractUserAction() != null; |
| 375 | } |
| 376 | return super.eIsSet(featureID); |
| 377 | } |
| 378 | |
| 379 | } //AbstractUserActionImpl |