| 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.impl.EObjectImpl; |
| 17 | import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList; |
| 18 | import org.eclipse.emf.ecore.util.EcoreUtil; |
| 19 | import org.eclipse.emf.ecore.util.InternalEList; |
| 20 | |
| 21 | import de.uka.ipd.sdq.pcm.parameter.ParameterPackage; |
| 22 | import de.uka.ipd.sdq.pcm.parameter.VariableUsage; |
| 23 | import de.uka.ipd.sdq.pcm.seff.ForkAction; |
| 24 | import de.uka.ipd.sdq.pcm.seff.ForkedBehaviour; |
| 25 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 26 | import de.uka.ipd.sdq.pcm.seff.SynchronisationPoint; |
| 27 | |
| 28 | /** |
| 29 | * <!-- begin-user-doc --> |
| 30 | * An implementation of the model object '<em><b>Synchronisation Point</b></em>'. |
| 31 | * <!-- end-user-doc --> |
| 32 | * <p> |
| 33 | * The following features are implemented: |
| 34 | * <ul> |
| 35 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.SynchronisationPointImpl#getOutputParameterUsage_SynchronisationPoint <em>Output Parameter Usage Synchronisation Point</em>}</li> |
| 36 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.SynchronisationPointImpl#getForkAction_SynchronisationPoint <em>Fork Action Synchronisation Point</em>}</li> |
| 37 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.SynchronisationPointImpl#getSynchronousForkedBehaviours_SynchronisationPoint <em>Synchronous Forked Behaviours Synchronisation Point</em>}</li> |
| 38 | * </ul> |
| 39 | * </p> |
| 40 | * |
| 41 | * @generated |
| 42 | */ |
| 43 | public class SynchronisationPointImpl extends EObjectImpl implements SynchronisationPoint { |
| 44 | /** |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @generated |
| 48 | */ |
| 49 | public static final String copyright = "Copyright 2005-2009 by SDQ, IPD, University of Karlsruhe, Germany"; |
| 50 | |
| 51 | /** |
| 52 | * The cached value of the '{@link #getOutputParameterUsage_SynchronisationPoint() <em>Output Parameter Usage Synchronisation Point</em>}' containment reference list. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @see #getOutputParameterUsage_SynchronisationPoint() |
| 56 | * @generated |
| 57 | * @ordered |
| 58 | */ |
| 59 | protected EList<VariableUsage> outputParameterUsage_SynchronisationPoint; |
| 60 | |
| 61 | /** |
| 62 | * The cached value of the '{@link #getSynchronousForkedBehaviours_SynchronisationPoint() <em>Synchronous Forked Behaviours Synchronisation Point</em>}' containment reference list. |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @see #getSynchronousForkedBehaviours_SynchronisationPoint() |
| 66 | * @generated |
| 67 | * @ordered |
| 68 | */ |
| 69 | protected EList<ForkedBehaviour> synchronousForkedBehaviours_SynchronisationPoint; |
| 70 | |
| 71 | /** |
| 72 | * <!-- begin-user-doc --> |
| 73 | * <!-- end-user-doc --> |
| 74 | * @generated |
| 75 | */ |
| 76 | protected SynchronisationPointImpl() { |
| 77 | super(); |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * <!-- begin-user-doc --> |
| 82 | * <!-- end-user-doc --> |
| 83 | * @generated |
| 84 | */ |
| 85 | @Override |
| 86 | protected EClass eStaticClass() { |
| 87 | return SeffPackage.Literals.SYNCHRONISATION_POINT; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * <!-- begin-user-doc --> |
| 92 | * <!-- end-user-doc --> |
| 93 | * @generated |
| 94 | */ |
| 95 | public EList<VariableUsage> getOutputParameterUsage_SynchronisationPoint() { |
| 96 | if (outputParameterUsage_SynchronisationPoint == null) { |
| 97 | outputParameterUsage_SynchronisationPoint = new EObjectContainmentWithInverseEList<VariableUsage>(VariableUsage.class, this, SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT, ParameterPackage.VARIABLE_USAGE__SYNCHRONISATION_POINT_VARIABLE_USAGE); |
| 98 | } |
| 99 | return outputParameterUsage_SynchronisationPoint; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * <!-- begin-user-doc --> |
| 104 | * <!-- end-user-doc --> |
| 105 | * @generated |
| 106 | */ |
| 107 | public ForkAction getForkAction_SynchronisationPoint() { |
| 108 | if (eContainerFeatureID() != SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT) return null; |
| 109 | return (ForkAction)eContainer(); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * <!-- begin-user-doc --> |
| 114 | * <!-- end-user-doc --> |
| 115 | * @generated |
| 116 | */ |
| 117 | public NotificationChain basicSetForkAction_SynchronisationPoint(ForkAction newForkAction_SynchronisationPoint, NotificationChain msgs) { |
| 118 | msgs = eBasicSetContainer((InternalEObject)newForkAction_SynchronisationPoint, SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT, msgs); |
| 119 | return msgs; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | public void setForkAction_SynchronisationPoint(ForkAction newForkAction_SynchronisationPoint) { |
| 128 | if (newForkAction_SynchronisationPoint != eInternalContainer() || (eContainerFeatureID() != SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT && newForkAction_SynchronisationPoint != null)) { |
| 129 | if (EcoreUtil.isAncestor(this, newForkAction_SynchronisationPoint)) |
| 130 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 131 | NotificationChain msgs = null; |
| 132 | if (eInternalContainer() != null) |
| 133 | msgs = eBasicRemoveFromContainer(msgs); |
| 134 | if (newForkAction_SynchronisationPoint != null) |
| 135 | msgs = ((InternalEObject)newForkAction_SynchronisationPoint).eInverseAdd(this, SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION, ForkAction.class, msgs); |
| 136 | msgs = basicSetForkAction_SynchronisationPoint(newForkAction_SynchronisationPoint, msgs); |
| 137 | if (msgs != null) msgs.dispatch(); |
| 138 | } |
| 139 | else if (eNotificationRequired()) |
| 140 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT, newForkAction_SynchronisationPoint, newForkAction_SynchronisationPoint)); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * <!-- begin-user-doc --> |
| 145 | * <!-- end-user-doc --> |
| 146 | * @generated |
| 147 | */ |
| 148 | public EList<ForkedBehaviour> getSynchronousForkedBehaviours_SynchronisationPoint() { |
| 149 | if (synchronousForkedBehaviours_SynchronisationPoint == null) { |
| 150 | synchronousForkedBehaviours_SynchronisationPoint = new EObjectContainmentWithInverseEList<ForkedBehaviour>(ForkedBehaviour.class, this, SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT, SeffPackage.FORKED_BEHAVIOUR__SYNCHRONISATION_POINT_FORKED_BEHAVIOUR); |
| 151 | } |
| 152 | return synchronousForkedBehaviours_SynchronisationPoint; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * <!-- begin-user-doc --> |
| 157 | * <!-- end-user-doc --> |
| 158 | * @generated |
| 159 | */ |
| 160 | @SuppressWarnings("unchecked") |
| 161 | @Override |
| 162 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 163 | switch (featureID) { |
| 164 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
| 165 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getOutputParameterUsage_SynchronisationPoint()).basicAdd(otherEnd, msgs); |
| 166 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 167 | if (eInternalContainer() != null) |
| 168 | msgs = eBasicRemoveFromContainer(msgs); |
| 169 | return basicSetForkAction_SynchronisationPoint((ForkAction)otherEnd, msgs); |
| 170 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
| 171 | return ((InternalEList<InternalEObject>)(InternalEList<?>)getSynchronousForkedBehaviours_SynchronisationPoint()).basicAdd(otherEnd, msgs); |
| 172 | } |
| 173 | return super.eInverseAdd(otherEnd, featureID, msgs); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * <!-- begin-user-doc --> |
| 178 | * <!-- end-user-doc --> |
| 179 | * @generated |
| 180 | */ |
| 181 | @Override |
| 182 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 183 | switch (featureID) { |
| 184 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
| 185 | return ((InternalEList<?>)getOutputParameterUsage_SynchronisationPoint()).basicRemove(otherEnd, msgs); |
| 186 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 187 | return basicSetForkAction_SynchronisationPoint(null, msgs); |
| 188 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
| 189 | return ((InternalEList<?>)getSynchronousForkedBehaviours_SynchronisationPoint()).basicRemove(otherEnd, msgs); |
| 190 | } |
| 191 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * <!-- begin-user-doc --> |
| 196 | * <!-- end-user-doc --> |
| 197 | * @generated |
| 198 | */ |
| 199 | @Override |
| 200 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 201 | switch (eContainerFeatureID()) { |
| 202 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 203 | return eInternalContainer().eInverseRemove(this, SeffPackage.FORK_ACTION__SYNCHRONISING_BEHAVIOURS_FORK_ACTION, ForkAction.class, msgs); |
| 204 | } |
| 205 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 206 | } |
| 207 | |
| 208 | /** |
| 209 | * <!-- begin-user-doc --> |
| 210 | * <!-- end-user-doc --> |
| 211 | * @generated |
| 212 | */ |
| 213 | @Override |
| 214 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 215 | switch (featureID) { |
| 216 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
| 217 | return getOutputParameterUsage_SynchronisationPoint(); |
| 218 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 219 | return getForkAction_SynchronisationPoint(); |
| 220 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
| 221 | return getSynchronousForkedBehaviours_SynchronisationPoint(); |
| 222 | } |
| 223 | return super.eGet(featureID, resolve, coreType); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * <!-- begin-user-doc --> |
| 228 | * <!-- end-user-doc --> |
| 229 | * @generated |
| 230 | */ |
| 231 | @SuppressWarnings("unchecked") |
| 232 | @Override |
| 233 | public void eSet(int featureID, Object newValue) { |
| 234 | switch (featureID) { |
| 235 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
| 236 | getOutputParameterUsage_SynchronisationPoint().clear(); |
| 237 | getOutputParameterUsage_SynchronisationPoint().addAll((Collection<? extends VariableUsage>)newValue); |
| 238 | return; |
| 239 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 240 | setForkAction_SynchronisationPoint((ForkAction)newValue); |
| 241 | return; |
| 242 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
| 243 | getSynchronousForkedBehaviours_SynchronisationPoint().clear(); |
| 244 | getSynchronousForkedBehaviours_SynchronisationPoint().addAll((Collection<? extends ForkedBehaviour>)newValue); |
| 245 | return; |
| 246 | } |
| 247 | super.eSet(featureID, newValue); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * <!-- begin-user-doc --> |
| 252 | * <!-- end-user-doc --> |
| 253 | * @generated |
| 254 | */ |
| 255 | @Override |
| 256 | public void eUnset(int featureID) { |
| 257 | switch (featureID) { |
| 258 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
| 259 | getOutputParameterUsage_SynchronisationPoint().clear(); |
| 260 | return; |
| 261 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 262 | setForkAction_SynchronisationPoint((ForkAction)null); |
| 263 | return; |
| 264 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
| 265 | getSynchronousForkedBehaviours_SynchronisationPoint().clear(); |
| 266 | return; |
| 267 | } |
| 268 | super.eUnset(featureID); |
| 269 | } |
| 270 | |
| 271 | /** |
| 272 | * <!-- begin-user-doc --> |
| 273 | * <!-- end-user-doc --> |
| 274 | * @generated |
| 275 | */ |
| 276 | @Override |
| 277 | public boolean eIsSet(int featureID) { |
| 278 | switch (featureID) { |
| 279 | case SeffPackage.SYNCHRONISATION_POINT__OUTPUT_PARAMETER_USAGE_SYNCHRONISATION_POINT: |
| 280 | return outputParameterUsage_SynchronisationPoint != null && !outputParameterUsage_SynchronisationPoint.isEmpty(); |
| 281 | case SeffPackage.SYNCHRONISATION_POINT__FORK_ACTION_SYNCHRONISATION_POINT: |
| 282 | return getForkAction_SynchronisationPoint() != null; |
| 283 | case SeffPackage.SYNCHRONISATION_POINT__SYNCHRONOUS_FORKED_BEHAVIOURS_SYNCHRONISATION_POINT: |
| 284 | return synchronousForkedBehaviours_SynchronisationPoint != null && !synchronousForkedBehaviours_SynchronisationPoint.isEmpty(); |
| 285 | } |
| 286 | return super.eIsSet(featureID); |
| 287 | } |
| 288 | |
| 289 | } //SynchronisationPointImpl |