Range implements Comparable<Range> { public boolean contains(long someOffset) { return contains(start, end, someOffset); } Range(long startOffset, long endOffset);  Range(); boolean contains(long someOffset); static boolean containsReaderPosition(long writerStart,
												long writerEnd,
												long readerPosition,
												BufferPositionParser parser); static boolean containsIgnoreGenId(long start,
			                                  long end,
			                                  long offset,
			                                  BufferPositionParser parser); static boolean contains(long start, long end, long someOffset); boolean intersects(Range intersectedRange); @Override int compareTo(Range comparedRange); String toString(BufferPositionParser parser); @Override String toString(); long getStart(); void setStart(long start); long getEnd(); void setEnd(long end); @Override boolean equals(Object obj); @Override int hashCode(); public long start; public long end; }
@Test public void testRangeContainsSimple() { Range r = new Range(1, 100); AssertJUnit.assertFalse(r.contains(-1)); AssertJUnit.assertTrue(r.contains(1)); AssertJUnit.assertTrue(r.contains(5)); AssertJUnit.assertTrue(r.contains(99)); AssertJUnit.assertFalse(r.contains(100)); AssertJUnit.assertFalse(r.contains(101)); AssertJUnit.assertTrue(r.contains(1)); }
@Test public void testRangeContainsReversed() { Range r = new Range(100, 1); AssertJUnit.assertFalse(r.contains(-1)); AssertJUnit.assertTrue(r.contains(0)); AssertJUnit.assertFalse(r.contains(1)); AssertJUnit.assertFalse(r.contains(5)); AssertJUnit.assertTrue(r.contains(105)); AssertJUnit.assertTrue(r.contains(100)); }