@Test public void test() { final TemporalRange range = new TemporalRange(new Date(100), new Date(1000)); assertFalse(range.isWithin(new Date(10))); assertFalse(range.isWithin(new Date(100000))); assertTrue(range.isWithin(new Date(800))); assertFalse(range.isWithin(new NumericRange(20, 99))); assertFalse(range.isWithin(new NumericRange(1001, 9900))); assertTrue(range.isWithin(new NumericRange(998, 9900))); assertTrue(range.isWithin(new NumericRange(20, 199))); assertTrue(range.isWithin(new NumericRange(150, 199))); assertTrue(check(new NumericRange(-1, 1), new NumericRange(-1, 1))); assertFalse(check(new NumericRange(9, 19), new NumericRange(20, 30))); assertTrue(check(new NumericRange(11, 21), new NumericRange(20, 30))); assertTrue(check(new NumericRange(20, 30), new NumericRange(20, 30))); assertFalse(check(new NumericRange(9, 19), new NumericRange(20, 30))); assertTrue(check(new NumericRange(11, 21), new NumericRange(20, 30))); assertTrue(check(new NumericRange(21, 29), new NumericRange(20, 30))); assertTrue(check(new NumericRange(20, 30), new NumericRange(21, 29))); assertTrue(check(new NumericRange(20, 30), new NumericRange(11, 21))); assertFalse(check(new NumericRange(20, 30), new NumericRange(9, 19))); assertTrue(check(new NumericRange(-3, -1), new NumericRange(-2, 0))); assertTrue(check(new NumericRange(-2, 0), new NumericRange(-3, -1))); assertFalse(check(new NumericRange(-3, 1), new NumericRange(2, 4))); assertTrue(check(new NumericRange(-3, 1), new NumericRange(-2, 0))); assertTrue(check(new NumericRange(-2, 0), new NumericRange(-3, 1))); assertTrue(check(new NumericRange(-2, 0), new NumericRange(-3, -1))); assertTrue(check(new NumericRange(-3, -1), new NumericRange(-2, 0))); assertTrue(check(new NumericRange(-2, 0), new NumericRange(-1, 1))); assertTrue(check(new NumericRange(-1, 3), new NumericRange(0, 2))); assertFalse(check(new NumericRange(-1, -0.5), new NumericRange(0, 2))); assertTrue(check(new NumericRange(0, 2), new NumericRange(-1, 3))); assertTrue(check(new NumericRange(0, 2), new NumericRange(-1, 3))); assertFalse(check(new NumericRange(-1, 2), new NumericRange(3, 4))); assertFalse(check(new NumericRange(-1, 2), new NumericRange(3, 6))); assertTrue(check(new NumericRange(-1, 2), new NumericRange(1, 4))); }
public boolean isWithin(final Date time) { return (startTime.before(time) || startTime.equals(time)) && (endTime.equals(time) || endTime.after(time)); }
TemporalRange { public boolean isWithin(final Date time) { return (startTime.before(time) || startTime.equals(time)) && (endTime.equals(time) || endTime.after(time)); } }
TemporalRange { public boolean isWithin(final Date time) { return (startTime.before(time) || startTime.equals(time)) && (endTime.equals(time) || endTime.after(time)); } TemporalRange();  TemporalRange(final Date startTime, final Date endTime); }
TemporalRange { public boolean isWithin(final Date time) { return (startTime.before(time) || startTime.equals(time)) && (endTime.equals(time) || endTime.after(time)); } TemporalRange();  TemporalRange(final Date startTime, final Date endTime); Date getStartTime(); Date getEndTime(); void setStartTime(final Date startTime); void setEndTime(final Date endTime); boolean isWithin(final Date time); boolean isWithin(final NumericData timeRange); TemporalRange intersect(final TemporalRange range); TemporalRange union(final TemporalRange range); void toBinary(final ByteBuffer buffer); byte[] toBinary(); void fromBinary(final ByteBuffer buffer); void fromBinary(final byte[] data); @Override String toString(); boolean isInfinity(); @Override int hashCode(); @Override boolean equals(final Object obj); }
TemporalRange { public boolean isWithin(final Date time) { return (startTime.before(time) || startTime.equals(time)) && (endTime.equals(time) || endTime.after(time)); } TemporalRange();  TemporalRange(final Date startTime, final Date endTime); Date getStartTime(); Date getEndTime(); void setStartTime(final Date startTime); void setEndTime(final Date endTime); boolean isWithin(final Date time); boolean isWithin(final NumericData timeRange); TemporalRange intersect(final TemporalRange range); TemporalRange union(final TemporalRange range); void toBinary(final ByteBuffer buffer); byte[] toBinary(); void fromBinary(final ByteBuffer buffer); void fromBinary(final byte[] data); @Override String toString(); boolean isInfinity(); @Override int hashCode(); @Override boolean equals(final Object obj); static final Date START_TIME; static final Date END_TIME; }