JAL-3761 debugged and working (but not tidied) locateInFrom2/To2
[jalview.git] / src / jalview / util / QuickSort.java
index 521783e..6901e24 100755 (executable)
@@ -1,6 +1,6 @@
 /*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2)
- * Copyright (C) 2015 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
  * 
  * This file is part of Jalview.
  * 
@@ -51,8 +51,9 @@ public class QuickSort
     @Override
     public int compare(Integer o1, Integer o2)
     {
-      return ascending ? Float.compare(values[o1], values[o2]) : Float
-              .compare(values[o2], values[o1]);
+      return ascending
+              ? Float.compare(values[o1.intValue()], values[o2.intValue()])
+              : Float.compare(values[o2.intValue()], values[o1.intValue()]);
     }
   }
 
@@ -77,11 +78,11 @@ public class QuickSort
     {
       if (ascending)
       {
-        return Double.compare(values[o1], values[o2]);
+        return Double.compare(values[o1.intValue()], values[o2.intValue()]);
       }
       else
       {
-        return Double.compare(values[o2], values[o1]);
+        return Double.compare(values[o2.intValue()], values[o1.intValue()]);
       }
     }
   }
@@ -105,8 +106,11 @@ public class QuickSort
     @Override
     public int compare(Integer o1, Integer o2)
     {
-      return ascending ? Integer.compare(values[o1], values[o2]) : Integer
-              .compare(values[o2], values[o1]);
+      return ascending
+              ? Integer.compare(values[o1.intValue()],
+                      values[o2.intValue()])
+              : Integer.compare(values[o2.intValue()],
+                      values[o1.intValue()]);
     }
   }
 
@@ -129,8 +133,9 @@ public class QuickSort
     @Override
     public int compare(Integer o1, Integer o2)
     {
-      return ascending ? values[o1].compareTo(values[o2]) : values[o2]
-              .compareTo(values[o1]);
+      return ascending
+              ? values[o1.intValue()].compareTo(values[o2.intValue()])
+              : values[o2.intValue()].compareTo(values[o1.intValue()]);
     }
   }
 
@@ -475,10 +480,10 @@ public class QuickSort
     /*
      * Copy sorted positive values after the negatives and zeros
      */
-    System.arraycopy(nonZeroFloats, negativeCount, arr, negativeCount
-            + zerosCount, positiveCount);
-    System.arraycopy(nonZeroChars, negativeCount, s, negativeCount
-            + zerosCount, positiveCount);
+    System.arraycopy(nonZeroFloats, negativeCount, arr,
+            negativeCount + zerosCount, positiveCount);
+    System.arraycopy(nonZeroChars, negativeCount, s,
+            negativeCount + zerosCount, positiveCount);
   }
 
   /**
@@ -613,10 +618,10 @@ public class QuickSort
     /*
      * Copy sorted positive values after the negatives and zeros
      */
-    System.arraycopy(nonZeroInts, negativeCount, arr, negativeCount
-            + zerosCount, positiveCount);
-    System.arraycopy(nonZeroChars, negativeCount, s, negativeCount
-            + zerosCount, positiveCount);
+    System.arraycopy(nonZeroInts, negativeCount, arr,
+            negativeCount + zerosCount, positiveCount);
+    System.arraycopy(nonZeroChars, negativeCount, s,
+            negativeCount + zerosCount, positiveCount);
   }
 
   /**