Merge branch 'develop' into bug/JAL-2346annotationChoice
[jalview.git] / src / jalview / ext / ensembl / EnsemblSeqProxy.java
index 732bc0f..233707b 100644 (file)
@@ -38,6 +38,7 @@ import jalview.io.gff.SequenceOntologyI;
 import jalview.util.Comparison;
 import jalview.util.DBRefUtils;
 import jalview.util.MapList;
+import jalview.util.RangeComparator;
 
 import java.io.IOException;
 import java.net.MalformedURLException;
@@ -110,26 +111,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
   }
 
   /**
-   * A comparator to sort ranges into ascending start position order
-   */
-  private class RangeSorter implements Comparator<int[]>
-  {
-    boolean forwards;
-
-    RangeSorter(boolean forward)
-    {
-      forwards = forward;
-    }
-
-    @Override
-    public int compare(int[] o1, int[] o2)
-    {
-      return (forwards ? 1 : -1) * Integer.compare(o1[0], o2[0]);
-    }
-
-  }
-
-  /**
    * Default constructor (to use rest.ensembl.org)
    */
   public EnsemblSeqProxy()
@@ -626,7 +607,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
      * a final sort is needed since Ensembl returns CDS sorted within source
      * (havana / ensembl_havana)
      */
-    Collections.sort(regions, new RangeSorter(direction == 1));
+    Collections.sort(regions, new RangeComparator(direction == 1));
 
     List<int[]> to = Arrays.asList(new int[] { start,
         start + mappedLength - 1 });