Locus extends RangeLocation implements Comparable<Locus> { @Override public int compareTo(Locus right) { if(this.contig.equals(right.contig)) { return this.getMin() - right.getMin(); } return this.contig.compareTo(right.contig); } Locus(final String contig, final int start, final int end);  Locus(final String contig, final RangeLocation range); final int getStart(); final int getEnd(); boolean isPointLocation(); String getContig(); Locus intersection(final Locus right); Locus union(final Locus right); final int length(); boolean isEmpty(); boolean overlaps(final Locus right); @Override boolean equals(final Object right); @Override int compareTo(Locus right); @Override int hashCode(); @Override String toString();  }
@Test public void testCompareTo() { Locus locus1 = new Locus("chr6", 1, 10); Locus locus2 = new Locus("chr6", 2, 10); Locus locus3 = new Locus("chr6", 1, 5); Locus locus4 = new Locus("chr7", 1, 5); assertTrue(locus1.compareTo(locus2) < 0); assertTrue(locus2.compareTo(locus3) > 0); assertTrue(locus2.compareTo(locus2) == 0); assertTrue(locus3.compareTo(locus4) < 0); }