/** */ package fr.inria.diverse.minilang.impl; import fr.inria.diverse.minilang.Block; import fr.inria.diverse.minilang.BooleanExpression; import fr.inria.diverse.minilang.If; import fr.inria.diverse.minilang.MinilangPackage; 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.emf.ecore.impl.MinimalEObjectImpl; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>If</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * </p> * <ul> * <li>{@link fr.inria.diverse.minilang.impl.IfImpl#getCondition <em>Condition</em>}</li> * <li>{@link fr.inria.diverse.minilang.impl.IfImpl#getThen <em>Then</em>}</li> * <li>{@link fr.inria.diverse.minilang.impl.IfImpl#getElse <em>Else</em>}</li> * </ul> * * @generated */ public class IfImpl extends MinimalEObjectImpl.Container implements If { /** * The cached value of the '{@link #getCondition() <em>Condition</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getCondition() * @generated * @ordered */ protected BooleanExpression condition; /** * The cached value of the '{@link #getThen() <em>Then</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getThen() * @generated * @ordered */ protected Block then; /** * The cached value of the '{@link #getElse() <em>Else</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getElse() * @generated * @ordered */ protected Block else_; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IfImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return MinilangPackage.Literals.IF; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public BooleanExpression getCondition() { return condition; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetCondition(BooleanExpression newCondition, NotificationChain msgs) { BooleanExpression oldCondition = condition; condition = newCondition; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MinilangPackage.IF__CONDITION, oldCondition, newCondition); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setCondition(BooleanExpression newCondition) { if (newCondition != condition) { NotificationChain msgs = null; if (condition != null) msgs = ((InternalEObject)condition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.IF__CONDITION, null, msgs); if (newCondition != null) msgs = ((InternalEObject)newCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.IF__CONDITION, null, msgs); msgs = basicSetCondition(newCondition, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MinilangPackage.IF__CONDITION, newCondition, newCondition)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Block getThen() { return then; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetThen(Block newThen, NotificationChain msgs) { Block oldThen = then; then = newThen; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MinilangPackage.IF__THEN, oldThen, newThen); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setThen(Block newThen) { if (newThen != then) { NotificationChain msgs = null; if (then != null) msgs = ((InternalEObject)then).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.IF__THEN, null, msgs); if (newThen != null) msgs = ((InternalEObject)newThen).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.IF__THEN, null, msgs); msgs = basicSetThen(newThen, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MinilangPackage.IF__THEN, newThen, newThen)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Block getElse() { return else_; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetElse(Block newElse, NotificationChain msgs) { Block oldElse = else_; else_ = newElse; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MinilangPackage.IF__ELSE, oldElse, newElse); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setElse(Block newElse) { if (newElse != else_) { NotificationChain msgs = null; if (else_ != null) msgs = ((InternalEObject)else_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.IF__ELSE, null, msgs); if (newElse != null) msgs = ((InternalEObject)newElse).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MinilangPackage.IF__ELSE, null, msgs); msgs = basicSetElse(newElse, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, MinilangPackage.IF__ELSE, newElse, newElse)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case MinilangPackage.IF__CONDITION: return basicSetCondition(null, msgs); case MinilangPackage.IF__THEN: return basicSetThen(null, msgs); case MinilangPackage.IF__ELSE: return basicSetElse(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 MinilangPackage.IF__CONDITION: return getCondition(); case MinilangPackage.IF__THEN: return getThen(); case MinilangPackage.IF__ELSE: return getElse(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case MinilangPackage.IF__CONDITION: setCondition((BooleanExpression)newValue); return; case MinilangPackage.IF__THEN: setThen((Block)newValue); return; case MinilangPackage.IF__ELSE: setElse((Block)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case MinilangPackage.IF__CONDITION: setCondition((BooleanExpression)null); return; case MinilangPackage.IF__THEN: setThen((Block)null); return; case MinilangPackage.IF__ELSE: setElse((Block)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case MinilangPackage.IF__CONDITION: return condition != null; case MinilangPackage.IF__THEN: return then != null; case MinilangPackage.IF__ELSE: return else_ != null; } return super.eIsSet(featureID); } } //IfImpl