| 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 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.seff.AbstractBranchTransition; |
| 17 | import de.uka.ipd.sdq.pcm.seff.BranchAction; |
| 18 | import de.uka.ipd.sdq.pcm.seff.ResourceDemandingBehaviour; |
| 19 | import de.uka.ipd.sdq.pcm.seff.SeffPackage; |
| 20 | |
| 21 | /** |
| 22 | * <!-- begin-user-doc --> |
| 23 | * An implementation of the model object '<em><b>Abstract Branch Transition</b></em>'. |
| 24 | * <!-- end-user-doc --> |
| 25 | * <p> |
| 26 | * The following features are implemented: |
| 27 | * <ul> |
| 28 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.AbstractBranchTransitionImpl#getBranchAction_AbstractBranchTransition <em>Branch Action Abstract Branch Transition</em>}</li> |
| 29 | * <li>{@link de.uka.ipd.sdq.pcm.seff.impl.AbstractBranchTransitionImpl#getBranchBehaviour_BranchTransition <em>Branch Behaviour Branch Transition</em>}</li> |
| 30 | * </ul> |
| 31 | * </p> |
| 32 | * |
| 33 | * @generated |
| 34 | */ |
| 35 | public abstract class AbstractBranchTransitionImpl extends EntityImpl implements AbstractBranchTransition { |
| 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 #getBranchBehaviour_BranchTransition() <em>Branch Behaviour Branch Transition</em>}' containment reference. |
| 45 | * <!-- begin-user-doc --> |
| 46 | * <!-- end-user-doc --> |
| 47 | * @see #getBranchBehaviour_BranchTransition() |
| 48 | * @generated |
| 49 | * @ordered |
| 50 | */ |
| 51 | protected ResourceDemandingBehaviour branchBehaviour_BranchTransition; |
| 52 | |
| 53 | /** |
| 54 | * <!-- begin-user-doc --> |
| 55 | * <!-- end-user-doc --> |
| 56 | * @generated |
| 57 | */ |
| 58 | protected AbstractBranchTransitionImpl() { |
| 59 | super(); |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @generated |
| 66 | */ |
| 67 | @Override |
| 68 | protected EClass eStaticClass() { |
| 69 | return SeffPackage.Literals.ABSTRACT_BRANCH_TRANSITION; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * <!-- begin-user-doc --> |
| 74 | * <!-- end-user-doc --> |
| 75 | * @generated |
| 76 | */ |
| 77 | public BranchAction getBranchAction_AbstractBranchTransition() { |
| 78 | if (eContainerFeatureID() != SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION) return null; |
| 79 | return (BranchAction)eContainer(); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * <!-- begin-user-doc --> |
| 84 | * <!-- end-user-doc --> |
| 85 | * @generated |
| 86 | */ |
| 87 | public NotificationChain basicSetBranchAction_AbstractBranchTransition(BranchAction newBranchAction_AbstractBranchTransition, NotificationChain msgs) { |
| 88 | msgs = eBasicSetContainer((InternalEObject)newBranchAction_AbstractBranchTransition, SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION, msgs); |
| 89 | return msgs; |
| 90 | } |
| 91 | |
| 92 | /** |
| 93 | * <!-- begin-user-doc --> |
| 94 | * <!-- end-user-doc --> |
| 95 | * @generated |
| 96 | */ |
| 97 | public void setBranchAction_AbstractBranchTransition(BranchAction newBranchAction_AbstractBranchTransition) { |
| 98 | if (newBranchAction_AbstractBranchTransition != eInternalContainer() || (eContainerFeatureID() != SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION && newBranchAction_AbstractBranchTransition != null)) { |
| 99 | if (EcoreUtil.isAncestor(this, newBranchAction_AbstractBranchTransition)) |
| 100 | throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); |
| 101 | NotificationChain msgs = null; |
| 102 | if (eInternalContainer() != null) |
| 103 | msgs = eBasicRemoveFromContainer(msgs); |
| 104 | if (newBranchAction_AbstractBranchTransition != null) |
| 105 | msgs = ((InternalEObject)newBranchAction_AbstractBranchTransition).eInverseAdd(this, SeffPackage.BRANCH_ACTION__BRANCHES_BRANCH, BranchAction.class, msgs); |
| 106 | msgs = basicSetBranchAction_AbstractBranchTransition(newBranchAction_AbstractBranchTransition, msgs); |
| 107 | if (msgs != null) msgs.dispatch(); |
| 108 | } |
| 109 | else if (eNotificationRequired()) |
| 110 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION, newBranchAction_AbstractBranchTransition, newBranchAction_AbstractBranchTransition)); |
| 111 | } |
| 112 | |
| 113 | /** |
| 114 | * <!-- begin-user-doc --> |
| 115 | * <!-- end-user-doc --> |
| 116 | * @generated |
| 117 | */ |
| 118 | public ResourceDemandingBehaviour getBranchBehaviour_BranchTransition() { |
| 119 | return branchBehaviour_BranchTransition; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | public NotificationChain basicSetBranchBehaviour_BranchTransition(ResourceDemandingBehaviour newBranchBehaviour_BranchTransition, NotificationChain msgs) { |
| 128 | ResourceDemandingBehaviour oldBranchBehaviour_BranchTransition = branchBehaviour_BranchTransition; |
| 129 | branchBehaviour_BranchTransition = newBranchBehaviour_BranchTransition; |
| 130 | if (eNotificationRequired()) { |
| 131 | ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, oldBranchBehaviour_BranchTransition, newBranchBehaviour_BranchTransition); |
| 132 | if (msgs == null) msgs = notification; else msgs.add(notification); |
| 133 | } |
| 134 | return msgs; |
| 135 | } |
| 136 | |
| 137 | /** |
| 138 | * <!-- begin-user-doc --> |
| 139 | * <!-- end-user-doc --> |
| 140 | * @generated |
| 141 | */ |
| 142 | public void setBranchBehaviour_BranchTransition(ResourceDemandingBehaviour newBranchBehaviour_BranchTransition) { |
| 143 | if (newBranchBehaviour_BranchTransition != branchBehaviour_BranchTransition) { |
| 144 | NotificationChain msgs = null; |
| 145 | if (branchBehaviour_BranchTransition != null) |
| 146 | msgs = ((InternalEObject)branchBehaviour_BranchTransition).eInverseRemove(this, SeffPackage.RESOURCE_DEMANDING_BEHAVIOUR__ABSTRACT_BRANCH_TRANSITION_RESOURCE_DEMANDING_BEHAVIOUR, ResourceDemandingBehaviour.class, msgs); |
| 147 | if (newBranchBehaviour_BranchTransition != null) |
| 148 | msgs = ((InternalEObject)newBranchBehaviour_BranchTransition).eInverseAdd(this, SeffPackage.RESOURCE_DEMANDING_BEHAVIOUR__ABSTRACT_BRANCH_TRANSITION_RESOURCE_DEMANDING_BEHAVIOUR, ResourceDemandingBehaviour.class, msgs); |
| 149 | msgs = basicSetBranchBehaviour_BranchTransition(newBranchBehaviour_BranchTransition, msgs); |
| 150 | if (msgs != null) msgs.dispatch(); |
| 151 | } |
| 152 | else if (eNotificationRequired()) |
| 153 | eNotify(new ENotificationImpl(this, Notification.SET, SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, newBranchBehaviour_BranchTransition, newBranchBehaviour_BranchTransition)); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * <!-- begin-user-doc --> |
| 158 | * <!-- end-user-doc --> |
| 159 | * @generated |
| 160 | */ |
| 161 | @Override |
| 162 | public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 163 | switch (featureID) { |
| 164 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 165 | if (eInternalContainer() != null) |
| 166 | msgs = eBasicRemoveFromContainer(msgs); |
| 167 | return basicSetBranchAction_AbstractBranchTransition((BranchAction)otherEnd, msgs); |
| 168 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
| 169 | if (branchBehaviour_BranchTransition != null) |
| 170 | msgs = ((InternalEObject)branchBehaviour_BranchTransition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION, null, msgs); |
| 171 | return basicSetBranchBehaviour_BranchTransition((ResourceDemandingBehaviour)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.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 185 | return basicSetBranchAction_AbstractBranchTransition(null, msgs); |
| 186 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
| 187 | return basicSetBranchBehaviour_BranchTransition(null, msgs); |
| 188 | } |
| 189 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * <!-- begin-user-doc --> |
| 194 | * <!-- end-user-doc --> |
| 195 | * @generated |
| 196 | */ |
| 197 | @Override |
| 198 | public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { |
| 199 | switch (eContainerFeatureID()) { |
| 200 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 201 | return eInternalContainer().eInverseRemove(this, SeffPackage.BRANCH_ACTION__BRANCHES_BRANCH, BranchAction.class, msgs); |
| 202 | } |
| 203 | return super.eBasicRemoveFromContainerFeature(msgs); |
| 204 | } |
| 205 | |
| 206 | /** |
| 207 | * <!-- begin-user-doc --> |
| 208 | * <!-- end-user-doc --> |
| 209 | * @generated |
| 210 | */ |
| 211 | @Override |
| 212 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 213 | switch (featureID) { |
| 214 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 215 | return getBranchAction_AbstractBranchTransition(); |
| 216 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
| 217 | return getBranchBehaviour_BranchTransition(); |
| 218 | } |
| 219 | return super.eGet(featureID, resolve, coreType); |
| 220 | } |
| 221 | |
| 222 | /** |
| 223 | * <!-- begin-user-doc --> |
| 224 | * <!-- end-user-doc --> |
| 225 | * @generated |
| 226 | */ |
| 227 | @Override |
| 228 | public void eSet(int featureID, Object newValue) { |
| 229 | switch (featureID) { |
| 230 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 231 | setBranchAction_AbstractBranchTransition((BranchAction)newValue); |
| 232 | return; |
| 233 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
| 234 | setBranchBehaviour_BranchTransition((ResourceDemandingBehaviour)newValue); |
| 235 | return; |
| 236 | } |
| 237 | super.eSet(featureID, newValue); |
| 238 | } |
| 239 | |
| 240 | /** |
| 241 | * <!-- begin-user-doc --> |
| 242 | * <!-- end-user-doc --> |
| 243 | * @generated |
| 244 | */ |
| 245 | @Override |
| 246 | public void eUnset(int featureID) { |
| 247 | switch (featureID) { |
| 248 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 249 | setBranchAction_AbstractBranchTransition((BranchAction)null); |
| 250 | return; |
| 251 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
| 252 | setBranchBehaviour_BranchTransition((ResourceDemandingBehaviour)null); |
| 253 | return; |
| 254 | } |
| 255 | super.eUnset(featureID); |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * <!-- begin-user-doc --> |
| 260 | * <!-- end-user-doc --> |
| 261 | * @generated |
| 262 | */ |
| 263 | @Override |
| 264 | public boolean eIsSet(int featureID) { |
| 265 | switch (featureID) { |
| 266 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_ACTION_ABSTRACT_BRANCH_TRANSITION: |
| 267 | return getBranchAction_AbstractBranchTransition() != null; |
| 268 | case SeffPackage.ABSTRACT_BRANCH_TRANSITION__BRANCH_BEHAVIOUR_BRANCH_TRANSITION: |
| 269 | return branchBehaviour_BranchTransition != null; |
| 270 | } |
| 271 | return super.eIsSet(featureID); |
| 272 | } |
| 273 | |
| 274 | } //AbstractBranchTransitionImpl |