Range implements Comparable<Range> { @Override public int compareTo( Range r) { if (r == null) { return Integer.MIN_VALUE; } int c = m_start.compareTo(r.m_start); if (c != 0) { return c; } return m_end.compareTo(r.m_end); } Range(/*@ non_null @*/ Position start, /*@ non_null @*/ Position end, int length);  Range(Position start, Position end); Position getStart(); Position getEnd(); int getLength(); @Override /*@ pure non_null @*/ String toString(); boolean isWithin(/*@ non_null @*/ Position p); @Override int compareTo(/*@ nullable @*/ Range r); Range intersectWith(/*@ non_null @*/ Range r); Range setZero(/*@ non_null @*/ Position zero); @Override /*@ pure @*/ int hashCode(); @Override /*@ pure @*/ boolean equals(Object o); boolean isMultiLine(); static Range make(int start_l, int start_c, int end_l, int end_c); static Range make(int line, int start_c, int end_c);  }
@Test public void testCompare1() { Range r1 = new Range(new Position(0, 0), new Position(0, 0)); Range r2 = new Range(new Position(0, 0), new Position(0, 0)); assertTrue(r1.compareTo(r2) == 0); }
@Test public void testCompare2() { Range r1 = new Range(new Position(0, 0), new Position(1, 0)); Range r2 = new Range(new Position(0, 0), new Position(1, 0)); assertTrue(r1.compareTo(r2) == 0); }
@Test public void testCompare3() { Range r1 = new Range(new Position(0, 0), new Position(0, 0)); Range r2 = new Range(new Position(1, 0), new Position(0, 0)); assertTrue(r1.compareTo(r2) < 0); }
@Test public void testCompare4() { Range r1 = new Range(new Position(1, 0), new Position(0, 0)); Range r2 = new Range(new Position(0, 0), new Position(0, 0)); assertTrue(r1.compareTo(r2) > 0); }
@Test public void testCompare5() { Range r1 = new Range(new Position(0, 0), new Position(0, 5)); Range r2 = new Range(new Position(0, 0), new Position(0, 6)); assertTrue(r1.compareTo(r2) < 0); }
@Test public void testCompare6() { Range r1 = new Range(new Position(0, 0), new Position(0, 6)); Range r2 = new Range(new Position(0, 0), new Position(0, 5)); assertTrue(r1.compareTo(r2) > 0); }