Range implements Comparable<Range> { public boolean intersects(Range intersectedRange) { if (contains(intersectedRange.start) || intersectedRange.contains(start)) { return true; } return false; } 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 testIntersects() { { Range r1 = new Range(1, 100); Range r2 = new Range(1, 100); AssertJUnit.assertTrue(r1.intersects(r2)); } { Range r1 = new Range(3773223,3774955); Range r2 = new Range(3774955,3775116); AssertJUnit.assertTrue(!(r1.intersects(r2))); } { Range r1 = new Range(3774955,100); Range r2 = new Range(100,3774945); AssertJUnit.assertTrue(!(r1.intersects(r2))); } }