comparator for interval objects
git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@111 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
parent
f810412d75
commit
4c3b92b860
|
|
@ -0,0 +1,22 @@
|
|||
package org.broadinstitute.sting.indels;
|
||||
|
||||
import org.broadinstitute.sting.utils.Interval;
|
||||
|
||||
|
||||
public class IntervalComparator implements java.util.Comparator<Interval> {
|
||||
public int compare(Interval r1, Interval r2) {
|
||||
if ( r1.getStart() < r2.getStart() ) return -1;
|
||||
if ( r1.getStart() == r2.getStart() ) {
|
||||
if ( r1.getStop() < r2.getStop() ) return -1;
|
||||
if ( r1.getStop() == r2.getStop() ) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if ( o instanceof IntervalComparator) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue