/** * generated by Xtext 2.21.0 */ package org.eclipse.viatra.solver.language.solverLanguage.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.viatra.solver.language.solverLanguage.Expression; import org.eclipse.viatra.solver.language.solverLanguage.IfElse; import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage; /** * * An implementation of the model object 'If Else'. * *

* The following features are implemented: *

* * * @generated */ public class IfElseImpl extends ExpressionImpl implements IfElse { /** * The cached value of the '{@link #getThen() Then}' containment reference. * * * @see #getThen() * @generated * @ordered */ protected Expression then; /** * The cached value of the '{@link #getElse() Else}' containment reference. * * * @see #getElse() * @generated * @ordered */ protected Expression else_; /** * The cached value of the '{@link #getCondition() Condition}' containment reference. * * * @see #getCondition() * @generated * @ordered */ protected Expression condition; /** * * * @generated */ protected IfElseImpl() { super(); } /** * * * @generated */ @Override protected EClass eStaticClass() { return SolverLanguagePackage.Literals.IF_ELSE; } /** * * * @generated */ @Override public Expression getThen() { return then; } /** * * * @generated */ public NotificationChain basicSetThen(Expression newThen, NotificationChain msgs) { Expression oldThen = then; then = newThen; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.IF_ELSE__THEN, oldThen, newThen); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setThen(Expression newThen) { if (newThen != then) { NotificationChain msgs = null; if (then != null) msgs = ((InternalEObject)then).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.IF_ELSE__THEN, null, msgs); if (newThen != null) msgs = ((InternalEObject)newThen).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.IF_ELSE__THEN, null, msgs); msgs = basicSetThen(newThen, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.IF_ELSE__THEN, newThen, newThen)); } /** * * * @generated */ @Override public Expression getElse() { return else_; } /** * * * @generated */ public NotificationChain basicSetElse(Expression newElse, NotificationChain msgs) { Expression oldElse = else_; else_ = newElse; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.IF_ELSE__ELSE, oldElse, newElse); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setElse(Expression newElse) { if (newElse != else_) { NotificationChain msgs = null; if (else_ != null) msgs = ((InternalEObject)else_).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.IF_ELSE__ELSE, null, msgs); if (newElse != null) msgs = ((InternalEObject)newElse).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.IF_ELSE__ELSE, null, msgs); msgs = basicSetElse(newElse, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.IF_ELSE__ELSE, newElse, newElse)); } /** * * * @generated */ @Override public Expression getCondition() { return condition; } /** * * * @generated */ public NotificationChain basicSetCondition(Expression newCondition, NotificationChain msgs) { Expression oldCondition = condition; condition = newCondition; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.IF_ELSE__CONDITION, oldCondition, newCondition); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * * * @generated */ @Override public void setCondition(Expression newCondition) { if (newCondition != condition) { NotificationChain msgs = null; if (condition != null) msgs = ((InternalEObject)condition).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.IF_ELSE__CONDITION, null, msgs); if (newCondition != null) msgs = ((InternalEObject)newCondition).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.IF_ELSE__CONDITION, null, msgs); msgs = basicSetCondition(newCondition, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.IF_ELSE__CONDITION, newCondition, newCondition)); } /** * * * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case SolverLanguagePackage.IF_ELSE__THEN: return basicSetThen(null, msgs); case SolverLanguagePackage.IF_ELSE__ELSE: return basicSetElse(null, msgs); case SolverLanguagePackage.IF_ELSE__CONDITION: return basicSetCondition(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * * * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case SolverLanguagePackage.IF_ELSE__THEN: return getThen(); case SolverLanguagePackage.IF_ELSE__ELSE: return getElse(); case SolverLanguagePackage.IF_ELSE__CONDITION: return getCondition(); } return super.eGet(featureID, resolve, coreType); } /** * * * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case SolverLanguagePackage.IF_ELSE__THEN: setThen((Expression)newValue); return; case SolverLanguagePackage.IF_ELSE__ELSE: setElse((Expression)newValue); return; case SolverLanguagePackage.IF_ELSE__CONDITION: setCondition((Expression)newValue); return; } super.eSet(featureID, newValue); } /** * * * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case SolverLanguagePackage.IF_ELSE__THEN: setThen((Expression)null); return; case SolverLanguagePackage.IF_ELSE__ELSE: setElse((Expression)null); return; case SolverLanguagePackage.IF_ELSE__CONDITION: setCondition((Expression)null); return; } super.eUnset(featureID); } /** * * * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case SolverLanguagePackage.IF_ELSE__THEN: return then != null; case SolverLanguagePackage.IF_ELSE__ELSE: return else_ != null; case SolverLanguagePackage.IF_ELSE__CONDITION: return condition != null; } return super.eIsSet(featureID); } } //IfElseImpl