Range implements Comparable<Range> { public String toString(BufferPositionParser parser) { StringBuilder sb = new StringBuilder(); sb.append("{start:"); sb.append(parser.toString(start)); sb.append(" - end:"); sb.append(parser.toString(end)); sb.append("}"); return sb.toString(); } 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 testToString() { BufferPositionParser parser = new BufferPositionParser(Integer.MAX_VALUE,Integer.MAX_VALUE); Range r1 = new Range(1, 100); String exp = "{start:1:[GenId=0;Index=0;Offset=1] - end:100:[GenId=0;Index=0;Offset=100]}"; AssertJUnit.assertEquals("Range ToString", exp,r1.toString(parser)); r1 = new Range(0, Integer.MAX_VALUE); exp = "{start:0:[GenId=0;Index=0;Offset=0] - end:2147483647:[GenId=0;Index=0;Offset=2147483647]}"; AssertJUnit.assertEquals("Range ToString", exp,r1.toString(parser)); r1 = new Range(0, Long.MAX_VALUE); exp = "{start:0:[GenId=0;Index=0;Offset=0] - end:" + Long.MAX_VALUE + ":[GenId=1;Index=2147483647;Offset=2147483647]}"; AssertJUnit.assertEquals("Range ToString", exp,r1.toString(parser)); }