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:
asivache 2009-03-20 05:15:13 +00:00
parent f810412d75
commit 4c3b92b860
1 changed files with 22 additions and 0 deletions

View File

@ -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;
}
}