| /** |
| */ |
| package org.eclipse.qvto.examples.xtext.imperativeoclcs.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.ocl.xtext.basecs.util.BaseCSVisitor; |
| import org.eclipse.ocl.xtext.essentialoclcs.ExpCS; |
| import org.eclipse.qvto.examples.xtext.imperativeoclcs.ImperativeOCLCSPackage; |
| import org.eclipse.qvto.examples.xtext.imperativeoclcs.SwitchAltCS; |
| import org.eclipse.qvto.examples.xtext.imperativeoclcs.util.ImperativeOCLCSVisitor; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Switch Alt CS</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.qvto.examples.xtext.imperativeoclcs.impl.SwitchAltCSImpl#getOwnedCondition <em>Owned Condition</em>}</li> |
| * <li>{@link org.eclipse.qvto.examples.xtext.imperativeoclcs.impl.SwitchAltCSImpl#getOwnedBody <em>Owned Body</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SwitchAltCSImpl extends StatementCSImpl implements SwitchAltCS { |
| /** |
| * The cached value of the '{@link #getOwnedCondition() <em>Owned Condition</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedCondition() |
| * @generated |
| * @ordered |
| */ |
| protected ExpCS ownedCondition; |
| |
| /** |
| * The cached value of the '{@link #getOwnedBody() <em>Owned Body</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getOwnedBody() |
| * @generated |
| * @ordered |
| */ |
| protected ExpCS ownedBody; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SwitchAltCSImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ImperativeOCLCSPackage.Literals.SWITCH_ALT_CS; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ExpCS getOwnedCondition() { |
| return ownedCondition; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedCondition(ExpCS newOwnedCondition, NotificationChain msgs) { |
| ExpCS oldOwnedCondition = ownedCondition; |
| ownedCondition = newOwnedCondition; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION, oldOwnedCondition, newOwnedCondition); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOwnedCondition(ExpCS newOwnedCondition) { |
| if (newOwnedCondition != ownedCondition) { |
| NotificationChain msgs = null; |
| if (ownedCondition != null) |
| msgs = ((InternalEObject)ownedCondition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION, null, msgs); |
| if (newOwnedCondition != null) |
| msgs = ((InternalEObject)newOwnedCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION, null, msgs); |
| msgs = basicSetOwnedCondition(newOwnedCondition, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION, newOwnedCondition, newOwnedCondition)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ExpCS getOwnedBody() { |
| return ownedBody; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetOwnedBody(ExpCS newOwnedBody, NotificationChain msgs) { |
| ExpCS oldOwnedBody = ownedBody; |
| ownedBody = newOwnedBody; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY, oldOwnedBody, newOwnedBody); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setOwnedBody(ExpCS newOwnedBody) { |
| if (newOwnedBody != ownedBody) { |
| NotificationChain msgs = null; |
| if (ownedBody != null) |
| msgs = ((InternalEObject)ownedBody).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY, null, msgs); |
| if (newOwnedBody != null) |
| msgs = ((InternalEObject)newOwnedBody).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY, null, msgs); |
| msgs = basicSetOwnedBody(newOwnedBody, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY, newOwnedBody, newOwnedBody)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION: |
| return basicSetOwnedCondition(null, msgs); |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY: |
| return basicSetOwnedBody(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION: |
| return getOwnedCondition(); |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY: |
| return getOwnedBody(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION: |
| setOwnedCondition((ExpCS)newValue); |
| return; |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY: |
| setOwnedBody((ExpCS)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION: |
| setOwnedCondition((ExpCS)null); |
| return; |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY: |
| setOwnedBody((ExpCS)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_CONDITION: |
| return ownedCondition != null; |
| case ImperativeOCLCSPackage.SWITCH_ALT_CS__OWNED_BODY: |
| return ownedBody != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * {@inheritDoc} |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public <R> R accept(BaseCSVisitor<R> visitor) { |
| return (R) ((ImperativeOCLCSVisitor<?>)visitor).visitSwitchAltCS(this); |
| } |
| |
| } //SwitchAltCSImpl |