@Test public void testContains() { assertTrue(new Interval(Interval.<Integer>getMinusInf(), false, 1000, false).contains(20)); assertFalse(new Interval(Interval.<Integer>getMinusInf(), false, 1000, false).contains(1000)); assertFalse(new Interval(Interval.<Integer>getMinusInf(), false, 1000, false).contains(1001)); assertTrue(new Interval(1000, false, Interval.<Integer>getPlusInf(), false).contains(2000)); assertFalse(new Interval(1000, false, Interval.<Integer>getPlusInf(), false).contains(1000)); assertFalse(new Interval(1000, false, Interval.<Integer>getPlusInf(), false).contains(999)); }
public boolean contains(K value) { return (includeLower ? low.compareTo(value) <= 0 : low.compareTo(value) < 0) && (includeUpper ? up.compareTo(value) >= 0 : up.compareTo(value) > 0); }
Interval { public boolean contains(K value) { return (includeLower ? low.compareTo(value) <= 0 : low.compareTo(value) < 0) && (includeUpper ? up.compareTo(value) >= 0 : up.compareTo(value) > 0); } }
Interval { public boolean contains(K value) { return (includeLower ? low.compareTo(value) <= 0 : low.compareTo(value) < 0) && (includeUpper ? up.compareTo(value) >= 0 : up.compareTo(value) > 0); } Interval(K low, boolean includeLower, K up, boolean includeUpper); }
Interval { public boolean contains(K value) { return (includeLower ? low.compareTo(value) <= 0 : low.compareTo(value) < 0) && (includeUpper ? up.compareTo(value) >= 0 : up.compareTo(value) > 0); } Interval(K low, boolean includeLower, K up, boolean includeUpper); static K getMinusInf(); static K getPlusInf(); boolean contains(K value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); }
Interval { public boolean contains(K value) { return (includeLower ? low.compareTo(value) <= 0 : low.compareTo(value) < 0) && (includeUpper ? up.compareTo(value) >= 0 : up.compareTo(value) > 0); } Interval(K low, boolean includeLower, K up, boolean includeUpper); static K getMinusInf(); static K getPlusInf(); boolean contains(K value); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); final K low; final boolean includeLower; final K up; final boolean includeUpper; }