package hibergui.verify;

public class IntegerInterval extends IntervalConstraint {

    public IntegerInterval(Integer a, Integer b, int mode) {
        super(a, b, mode);
    }

    public IntegerInterval(Integer a, Integer b) {
        super(a, b);
    }

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