/**
* 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.Interval;
import org.eclipse.viatra.solver.language.solverLanguage.SolverLanguagePackage;
/**
*
* An implementation of the model object 'Interval'.
*
*
* The following features are implemented:
*
*
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.IntervalImpl#getLowerBound Lower Bound}
* - {@link org.eclipse.viatra.solver.language.solverLanguage.impl.IntervalImpl#getUpperBound Upper Bound}
*
*
* @generated
*/
public class IntervalImpl extends ExpressionImpl implements Interval {
/**
* The cached value of the '{@link #getLowerBound() Lower Bound}' containment reference.
*
*
* @see #getLowerBound()
* @generated
* @ordered
*/
protected Expression lowerBound;
/**
* The cached value of the '{@link #getUpperBound() Upper Bound}' containment reference.
*
*
* @see #getUpperBound()
* @generated
* @ordered
*/
protected Expression upperBound;
/**
*
*
* @generated
*/
protected IntervalImpl() {
super();
}
/**
*
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return SolverLanguagePackage.Literals.INTERVAL;
}
/**
*
*
* @generated
*/
@Override
public Expression getLowerBound() {
return lowerBound;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetLowerBound(Expression newLowerBound, NotificationChain msgs) {
Expression oldLowerBound = lowerBound;
lowerBound = newLowerBound;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.INTERVAL__LOWER_BOUND, oldLowerBound, newLowerBound);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setLowerBound(Expression newLowerBound) {
if (newLowerBound != lowerBound) {
NotificationChain msgs = null;
if (lowerBound != null)
msgs = ((InternalEObject)lowerBound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.INTERVAL__LOWER_BOUND, null, msgs);
if (newLowerBound != null)
msgs = ((InternalEObject)newLowerBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.INTERVAL__LOWER_BOUND, null, msgs);
msgs = basicSetLowerBound(newLowerBound, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.INTERVAL__LOWER_BOUND, newLowerBound, newLowerBound));
}
/**
*
*
* @generated
*/
@Override
public Expression getUpperBound() {
return upperBound;
}
/**
*
*
* @generated
*/
public NotificationChain basicSetUpperBound(Expression newUpperBound, NotificationChain msgs) {
Expression oldUpperBound = upperBound;
upperBound = newUpperBound;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.INTERVAL__UPPER_BOUND, oldUpperBound, newUpperBound);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
*
*
* @generated
*/
@Override
public void setUpperBound(Expression newUpperBound) {
if (newUpperBound != upperBound) {
NotificationChain msgs = null;
if (upperBound != null)
msgs = ((InternalEObject)upperBound).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.INTERVAL__UPPER_BOUND, null, msgs);
if (newUpperBound != null)
msgs = ((InternalEObject)newUpperBound).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SolverLanguagePackage.INTERVAL__UPPER_BOUND, null, msgs);
msgs = basicSetUpperBound(newUpperBound, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, SolverLanguagePackage.INTERVAL__UPPER_BOUND, newUpperBound, newUpperBound));
}
/**
*
*
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case SolverLanguagePackage.INTERVAL__LOWER_BOUND:
return basicSetLowerBound(null, msgs);
case SolverLanguagePackage.INTERVAL__UPPER_BOUND:
return basicSetUpperBound(null, msgs);
}
return super.eInverseRemove(otherEnd, featureID, msgs);
}
/**
*
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case SolverLanguagePackage.INTERVAL__LOWER_BOUND:
return getLowerBound();
case SolverLanguagePackage.INTERVAL__UPPER_BOUND:
return getUpperBound();
}
return super.eGet(featureID, resolve, coreType);
}
/**
*
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case SolverLanguagePackage.INTERVAL__LOWER_BOUND:
setLowerBound((Expression)newValue);
return;
case SolverLanguagePackage.INTERVAL__UPPER_BOUND:
setUpperBound((Expression)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
*
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case SolverLanguagePackage.INTERVAL__LOWER_BOUND:
setLowerBound((Expression)null);
return;
case SolverLanguagePackage.INTERVAL__UPPER_BOUND:
setUpperBound((Expression)null);
return;
}
super.eUnset(featureID);
}
/**
*
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case SolverLanguagePackage.INTERVAL__LOWER_BOUND:
return lowerBound != null;
case SolverLanguagePackage.INTERVAL__UPPER_BOUND:
return upperBound != null;
}
return super.eIsSet(featureID);
}
} //IntervalImpl