package hibergui.verify;

public class DoubleInterval extends IntervalConstraint {

    public DoubleInterval(Double a, Double b, int mode) {
        super(a, b, mode);
    }

    public DoubleInterval(Double a, Double b) {
        super(a, b);
    }

    public boolean check(Number n) {
        double a_ = a.doubleValue(),
               b_ = b.doubleValue(),
               n_ = n.doubleValue();
        return 
            (((mode & LEFT_OPEN) != 0) ? a_ < n_ : a_ <= n_ ) &&
            (((mode & RIGHT_OPEN) != 0) ? n_ < b_ : n_ <= b_);
    }
}
