/** */ package kmlogo.asm.impl; import kmlogo.asm.AsmPackage; import kmlogo.asm.Block; import kmlogo.asm.If; 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; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>If</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link kmlogo.asm.impl.IfImpl#getThenPart <em>Then Part</em>}</li> * <li>{@link kmlogo.asm.impl.IfImpl#getElsePart <em>Else Part</em>}</li> * </ul> * </p> * * @generated */ public class IfImpl extends ControlStructureImpl implements If { /** * The cached value of the '{@link #getThenPart() <em>Then Part</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getThenPart() * @generated * @ordered */ protected Block thenPart; /** * The cached value of the '{@link #getElsePart() <em>Else Part</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getElsePart() * @generated * @ordered */ protected Block elsePart; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IfImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return AsmPackage.Literals.IF; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Block getThenPart() { return thenPart; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetThenPart(Block newThenPart, NotificationChain msgs) { Block oldThenPart = thenPart; thenPart = newThenPart; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AsmPackage.IF__THEN_PART, oldThenPart, newThenPart); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setThenPart(Block newThenPart) { if (newThenPart != thenPart) { NotificationChain msgs = null; if (thenPart != null) msgs = ((InternalEObject)thenPart).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AsmPackage.IF__THEN_PART, null, msgs); if (newThenPart != null) msgs = ((InternalEObject)newThenPart).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AsmPackage.IF__THEN_PART, null, msgs); msgs = basicSetThenPart(newThenPart, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AsmPackage.IF__THEN_PART, newThenPart, newThenPart)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Block getElsePart() { return elsePart; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetElsePart(Block newElsePart, NotificationChain msgs) { Block oldElsePart = elsePart; elsePart = newElsePart; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AsmPackage.IF__ELSE_PART, oldElsePart, newElsePart); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setElsePart(Block newElsePart) { if (newElsePart != elsePart) { NotificationChain msgs = null; if (elsePart != null) msgs = ((InternalEObject)elsePart).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AsmPackage.IF__ELSE_PART, null, msgs); if (newElsePart != null) msgs = ((InternalEObject)newElsePart).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AsmPackage.IF__ELSE_PART, null, msgs); msgs = basicSetElsePart(newElsePart, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, AsmPackage.IF__ELSE_PART, newElsePart, newElsePart)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case AsmPackage.IF__THEN_PART: return basicSetThenPart(null, msgs); case AsmPackage.IF__ELSE_PART: return basicSetElsePart(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 AsmPackage.IF__THEN_PART: return getThenPart(); case AsmPackage.IF__ELSE_PART: return getElsePart(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case AsmPackage.IF__THEN_PART: setThenPart((Block)newValue); return; case AsmPackage.IF__ELSE_PART: setElsePart((Block)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case AsmPackage.IF__THEN_PART: setThenPart((Block)null); return; case AsmPackage.IF__ELSE_PART: setElsePart((Block)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case AsmPackage.IF__THEN_PART: return thenPart != null; case AsmPackage.IF__ELSE_PART: return elsePart != null; } return super.eIsSet(featureID); } } //IfImpl