Locus extends RangeLocation implements Comparable<Locus> { public Locus intersection(final Locus right) { if(!this.contig.equals(right.contig) ) { return new Locus("", 0, 0); } if (this.getEnd() == right.getStart() || this.getStart() == right.getEnd()) { return new Locus(contig, 0, 0); } if (this.overlaps(right)) { return new Locus(contig, (RangeLocation) super.intersection(right)); } return new Locus(contig, 0, 0); } 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 testIntersection() { Locus locus1 = new Locus("chr6", 1, 1000); Locus locus2 = new Locus("chr7", 1, 1000); Locus locus3 = new Locus("chr6", 1001, 2000); assertTrue(locus1.intersection(locus2).isEmpty()); assertTrue(locus1.intersection(locus3).isEmpty()); }