| 1 | /** |
| 2 | * Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany |
| 3 | * |
| 4 | * $Id$ |
| 5 | */ |
| 6 | package de.uka.ipd.sdq.pcm.seff.impl; |
| 7 | |
| 8 | import java.util.Collection; |
| 9 | |
| 10 | import org.eclipse.emf.common.notify.Notification; |
| 11 | import org.eclipse.emf.common.notify.NotificationChain; |
| 12 | import org.eclipse.emf.common.util.EList; |
| 13 | import org.eclipse.emf.ecore.EClass; |
| 14 | import org.eclipse.emf.ecore.InternalEObject; |
| 15 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 16 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 17 | import org.eclipse.emf.ecore.util.InternalEList; |
| 18 | |
| 19 | import de.uka.ipd.sdq.pcm.seff.ForkAction; |
| 20 | import de.uka.ipd.sdq.pcm.seff.ForkedBehaviour; |
| 21 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 22 | import de.uka.ipd.sdq.pcm.seff.SynchronisationPoint; |
| 23 | |
| 24 | /** |
| 25 | * <!-- begin-user-doc --> |
| 26 | * An implementation of the model object '<em><b>Fork Action</b></em>'. |
| 27 | * <!-- end-user-doc --> |
| 28 | * <p> |
| 29 | * The following features are implemented: |
| 30 | * <ul> |
| 31 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ForkActionImpl#getAsynchronousForkedBehaviours_ForkAction <em>Asynchronous Forked Behaviours Fork Action</em>}</li> |
| 32 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.ForkActionImpl#getSynchronisingBehaviours_ForkAction <em>Synchronising Behaviours Fork Action</em>}</li> |
| 33 | * </ul> |
| 34 | * </p> |
| 35 | * |
| 36 | * @generated |
| 37 | */ |
| 38 | public class ForkActionImpl extends AbstractInternalControlFlowActionImpl implements ForkAction { |
| 39 | /** |
| 40 | * <!-- begin-user-doc --> |
| 41 | * <!-- end-user-doc --> |
| 42 | * @generated |
| 43 | */ |
| 44 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 45 | |
| 46 | /** |
| 47 | * The cached value of the '{@link #getAsynchronousForkedBehaviours_ForkAction() <em>Asynchronous Forked Behaviours Fork Action</em>}' containment reference list. |
| 48 | * <!-- begin-user-doc --> |
| 49 | * <!-- end-user-doc --> |
| 50 | * @see #getAsynchronousForkedBehaviours_ForkAction() |
| 51 | * @generated |
| 52 | * @ordered |
| 53 | */ |
| 54 | protected EList<ForkedBehaviour> asynchronousForkedBehaviours_ForkAction; |
| 55 | |
| 56 | /** |
| 57 | * The cached value of the '{@link #getSynchronisingBehaviours_ForkAction() <em>Synchronising Behaviours Fork Action</em>}' containment reference. |
| 58 | * <!-- begin-user-doc --> |
| 59 | * <!-- end-user-doc --> |
| 60 | * @see #getSynchronisingBehaviours_ForkAction() |
| 61 | * @generated |
| 62 | * @ordered |
| 63 | */ |
| 64 | protected SynchronisationPoint synchronisingBehaviours_ForkAction; |
| 65 | |
| 66 | /** |
| 67 | * <!-- begin-user-doc --> |
| 68 | * <!-- end-user-doc --> |
| 69 | * @generated |
| 70 | */ |
| 71 | protected ForkActionImpl() { |
| 72 | super(); |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * <!-- begin-user-doc --> |
| 77 | * <!-- end-user-doc --> |
| 78 | * @generated |
| 79 | */ |
| 80 | @Override |
| 81 | protected EClass eStaticClass() { |
| 82 | return SeffPackage.Literals.FORK_ACTION; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * <!-- begin-user-doc --> |
| 87 | * <!-- end-user-doc --> |
| 88 | * @generated |
| 89 | */ |
| 90 | public EList<ForkedBehaviour> getAsynchronousForkedBehaviours_ForkAction() { |
| 91 | if (asynchronousForkedBehaviours_ForkAction == null) { |
| 92 | asynchronousForkedBehaviours_ForkAction = new EObjectContainmentWithInverseEList<ForkedBehaviour>(ForkedBehaviour.class, this, SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION, SeffPackage.FORKED_BEHAVIOUR__FORK_ACTION_FORKED_BEHAIVOUR); |
| 93 | } |
| 94 | return asynchronousForkedBehaviours_ForkAction; |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * <!-- begin-user-doc --> |
| 99 | * <!-- end-user-doc --> |
| 100 | * @generated |
| 101 | */ |
| 102 | public SynchronisationPoint getSynchronisingBehaviours_ForkAction() { |
| 103 | return synchronisingBehaviours_ForkAction; |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * <!-- begin-user-doc --> |
| 108 | * <!-- end-user-doc --> |
| 109 | * @generated |
| 110 | */ |
| 111 | public NotificationChain basicSetSynchronisingBehaviours_ForkAction(SynchronisationPoint newSynchronisingBehaviours_ForkAction, NotificationChain msgs) { |
| 112 | SynchronisationPoint oldSynchronisingBehaviours_ForkAction = synchronisingBehaviours_ForkAction; |
| 113 | synchronisingBehaviours_ForkAction = newSynchronisingBehaviours_ForkAction; |
| 114 | if (eNotificationRequired()) { |
| 115 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION, oldSynchronisingBehaviours_ForkAction, newSynchronisingBehaviours_ForkAction); |
| 116 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 117 | } |
| 118 | return msgs; |
| 119 | } |
| 120 | |
| 121 | /** |
| 122 | * <!-- begin-user-doc --> |
| 123 | * <!-- end-user-doc --> |
| 124 | * @generated |
| 125 | */ |
| 126 | public void setSynchronisingBehaviours_ForkAction(SynchronisationPoint newSynchronisingBehaviours_ForkAction) { |
| 127 | if (newSynchronisingBehaviours_ForkAction != synchronisingBehaviours_ForkAction) { |
| 128 | NotificationChain msgs = null; |
| 129 | if (synchronisingBehaviours_ForkAction != null) |
| 130 | msgs = ((InternalEObject)synchronisingBehaviours_ForkAction).eInverseRemove(this, SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT, SynchronisationPoint.class, msgs); |
| 131 | if (newSynchronisingBehaviours_ForkAction != null) |
| 132 | msgs = ((InternalEObject)newSynchronisingBehaviours_ForkAction).eInverseAdd(this, SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT, SynchronisationPoint.class, msgs); |
| 133 | msgs = basicSetSynchronisingBehaviours_ForkAction(newSynchronisingBehaviours_ForkAction, msgs); |
| 134 | if (msgs != null) msgs.dispatch(); |
| 135 | } |
| 136 | else if (eNotificationRequired()) |
| 137 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION, newSynchronisingBehaviours_ForkAction, newSynchronisingBehaviours_ForkAction)); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | @SuppressWarnings("unchecked") |
| 146 | @Override |
| 147 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 148 | switch (featureID) { |
| 149 | case SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION: |
| 150 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getAsynchronousForkedBehaviours_ForkAction()).basicAdd(otherEnd, msgs); |
| 151 | case SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION: |
| 152 | if (synchronisingBehaviours_ForkAction != null) |
| 153 | msgs = ((InternalEObject)synchronisingBehaviours_ForkAction).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION, null, msgs); |
| 154 | return basicSetSynchronisingBehaviours_ForkAction((SynchronisationPoint)otherEnd, msgs); |
| 155 | } |
| 156 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 157 | } |
| 158 | |
| 159 | /** |
| 160 | * <!-- begin-user-doc --> |
| 161 | * <!-- end-user-doc --> |
| 162 | * @generated |
| 163 | */ |
| 164 | @Override |
| 165 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 166 | switch (featureID) { |
| 167 | case SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION: |
| 168 | return ((InternalEList<?>)getAsynchronousForkedBehaviours_ForkAction()).basicRemove(otherEnd, msgs); |
| 169 | case SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION: |
| 170 | return basicSetSynchronisingBehaviours_ForkAction(null, msgs); |
| 171 | } |
| 172 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * <!-- begin-user-doc --> |
| 177 | * <!-- end-user-doc --> |
| 178 | * @generated |
| 179 | */ |
| 180 | @Override |
| 181 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 182 | switch (featureID) { |
| 183 | case SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION: |
| 184 | return getAsynchronousForkedBehaviours_ForkAction(); |
| 185 | case SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION: |
| 186 | return getSynchronisingBehaviours_ForkAction(); |
| 187 | } |
| 188 | return super.eGet(featureID, resolve, coreType); |
| 189 | } |
| 190 | |
| 191 | /** |
| 192 | * <!-- begin-user-doc --> |
| 193 | * <!-- end-user-doc --> |
| 194 | * @generated |
| 195 | */ |
| 196 | @SuppressWarnings("unchecked") |
| 197 | @Override |
| 198 | public void eSet(int featureID, Object newValue) { |
| 199 | switch (featureID) { |
| 200 | case SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION: |
| 201 | getAsynchronousForkedBehaviours_ForkAction().clear(); |
| 202 | getAsynchronousForkedBehaviours_ForkAction().addAll((Collection<? extends ForkedBehaviour>)newValue); |
| 203 | return; |
| 204 | case SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION: |
| 205 | setSynchronisingBehaviours_ForkAction((SynchronisationPoint)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 SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION: |
| 220 | getAsynchronousForkedBehaviours_ForkAction().clear(); |
| 221 | return; |
| 222 | case SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION: |
| 223 | setSynchronisingBehaviours_ForkAction((SynchronisationPoint)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 SeffPackage.FORK_ACTION__ASYNCHRONOUS_FORKED_BEHAVIOURS_FORK_ACTION: |
| 238 | return asynchronousForkedBehaviours_ForkAction != null && !asynchronousForkedBehaviours_ForkAction.isEmpty(); |
| 239 | case SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION: |
| 240 | return synchronisingBehaviours_ForkAction != null; |
| 241 | } |
| 242 | return super.eIsSet(featureID); |
| 243 | } |
| 244 | |
| 245 | } //ForkActionImpl |