public boolean contains(final T n) { if (_type.isNaN(n)) return false; final int lcmp = getLower().compareTo(n); if (lcmp > 0) return false; if (lcmp == 0) return true; final int ucmp = getUpper().compareTo(n); return ucmp >= 0; }
public boolean contains(final T n) { if (_type.isNaN(n)) return false; final int lcmp = getLower().compareTo(n); if (lcmp > 0) return false; if (lcmp == 0) return true; final int ucmp = getUpper().compareTo(n); return ucmp >= 0; }
/** * Get the subinterval greater than n * * @param n * @return a new interval, formed by intersecting this interval with (n,+inf) or <code>null</code> if that intersection is empty */ public FloatingPointInterval<T> greater(final T n) { if (n == null) throw new NullPointerException(); if (_type.isNaN(n)) throw new IllegalArgumentException(); if (getLower().compareTo(n) >= 0) return this; else if (getUpper().compareTo(n) <= 0) return null; else return create(_type.increment(n), getUpper()); }
/** * Get the subinterval greater than n * * @param n * @return a new interval, formed by intersecting this interval with (n,+inf) or <code>null</code> if that intersection is empty */ public FloatingPointInterval<T> greater(final T n) { if (n == null) throw new NullPointerException(); if (_type.isNaN(n)) throw new IllegalArgumentException(); if (getLower().compareTo(n) >= 0) return this; else if (getUpper().compareTo(n) <= 0) return null; else return create(_type.increment(n), getUpper()); }
/** * Get the subinterval less than n * * @param n * @return a new interval, formed by intersecting this interval with (-inf,n) or <code>null</code> if that intersection is empty */ public FloatingPointInterval<T> less(final T n) { if (n == null) throw new NullPointerException(); if (_type.isNaN(n)) throw new IllegalArgumentException(); if (getUpper().compareTo(n) <= 0) return this; else if (getLower().compareTo(n) >= 0) return null; else return create(getLower(), _type.decrement(n)); }
/** * Get the subinterval less than n * * @param n * @return a new interval, formed by intersecting this interval with (-inf,n) or <code>null</code> if that intersection is empty */ public FloatingPointInterval<T> less(final T n) { if (n == null) throw new NullPointerException(); if (_type.isNaN(n)) throw new IllegalArgumentException(); if (getUpper().compareTo(n) <= 0) return this; else if (getLower().compareTo(n) >= 0) return null; else return create(getLower(), _type.decrement(n)); }