/**
*/
package org.yakindu.base.types.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.yakindu.base.types.RangeConstraint;
import org.yakindu.base.types.TypesPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Range Constraint</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.yakindu.base.types.impl.RangeConstraintImpl#getLowerBound <em>Lower Bound</em>}</li>
* <li>{@link org.yakindu.base.types.impl.RangeConstraintImpl#getUpperBound <em>Upper Bound</em>}</li>
* </ul>
*
* @generated
*/
public class RangeConstraintImpl extends TypeConstraintImpl implements RangeConstraint {
/**
* The default value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLowerBound()
* @generated
* @ordered
*/
protected static final long LOWER_BOUND_EDEFAULT = 0L;
/**
* The cached value of the '{@link #getLowerBound() <em>Lower Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLowerBound()
* @generated
* @ordered
*/
protected long lowerBound = LOWER_BOUND_EDEFAULT;
/**
* The default value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUpperBound()
* @generated
* @ordered
*/
protected static final long UPPER_BOUND_EDEFAULT = 0L;
/**
* The cached value of the '{@link #getUpperBound() <em>Upper Bound</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getUpperBound()
* @generated
* @ordered
*/
protected long upperBound = UPPER_BOUND_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected RangeConstraintImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return TypesPackage.Literals.RANGE_CONSTRAINT;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public long getLowerBound() {
return lowerBound;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLowerBound(long newLowerBound) {
long oldLowerBound = lowerBound;
lowerBound = newLowerBound;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.RANGE_CONSTRAINT__LOWER_BOUND, oldLowerBound, lowerBound));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public long getUpperBound() {
return upperBound;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setUpperBound(long newUpperBound) {
long oldUpperBound = upperBound;
upperBound = newUpperBound;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, TypesPackage.RANGE_CONSTRAINT__UPPER_BOUND, oldUpperBound, upperBound));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case TypesPackage.RANGE_CONSTRAINT__LOWER_BOUND:
return getLowerBound();
case TypesPackage.RANGE_CONSTRAINT__UPPER_BOUND:
return getUpperBound();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case TypesPackage.RANGE_CONSTRAINT__LOWER_BOUND:
setLowerBound((Long)newValue);
return;
case TypesPackage.RANGE_CONSTRAINT__UPPER_BOUND:
setUpperBound((Long)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case TypesPackage.RANGE_CONSTRAINT__LOWER_BOUND:
setLowerBound(LOWER_BOUND_EDEFAULT);
return;
case TypesPackage.RANGE_CONSTRAINT__UPPER_BOUND:
setUpperBound(UPPER_BOUND_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case TypesPackage.RANGE_CONSTRAINT__LOWER_BOUND:
return lowerBound != LOWER_BOUND_EDEFAULT;
case TypesPackage.RANGE_CONSTRAINT__UPPER_BOUND:
return upperBound != UPPER_BOUND_EDEFAULT;
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (lowerBound: ");
result.append(lowerBound);
result.append(", upperBound: ");
result.append(upperBound);
result.append(')');
return result.toString();
}
} //RangeConstraintImpl