X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FQuickSort.java;h=cedf656ebe7850c95c447b8d5b26b1fdb30a6bce;hb=c3280dffcb908ebb0e6b1ddc252a63c6ae20c623;hp=e3bb5146c463e73a9f5add1cf96322222ddc6aad;hpb=b666699aebbcd7dbe3288187d67cf4f7aa521ce6;p=jalview.git diff --git a/src/jalview/util/QuickSort.java b/src/jalview/util/QuickSort.java index e3bb514..cedf656 100755 --- a/src/jalview/util/QuickSort.java +++ b/src/jalview/util/QuickSort.java @@ -20,29 +20,64 @@ */ package jalview.util; +/** + * A class to perform efficient sorting of arrays of objects based on arrays of + * scores or other attributes. For example, residues by frequency. + * + * @author gmcarstairs + * + */ public class QuickSort { + /** + * Sorts both arrays with respect to ascending order of the items in the first + * array. + * + * @param arr + * @param s + */ public static void sort(int[] arr, Object[] s) { sort(arr, 0, arr.length - 1, s); } + /** + * Sorts both arrays with respect to ascending order of the items in the first + * array. + * + * @param arr + * @param s + */ public static void sort(float[] arr, Object[] s) { sort(arr, 0, arr.length - 1, s); } + /** + * Sorts both arrays with respect to ascending order of the items in the first + * array. + * + * @param arr + * @param s + */ public static void sort(double[] arr, Object[] s) { sort(arr, 0, arr.length - 1, s); } + /** + * Sorts both arrays with respect to descending order of the items in the + * first array. + * + * @param arr + * @param s + */ public static void sort(String[] arr, Object[] s) { stringSort(arr, 0, arr.length - 1, s); } - public static void stringSort(String[] arr, int p, int r, Object[] s) + static void stringSort(String[] arr, int p, int r, Object[] s) { int q; @@ -54,7 +89,7 @@ public class QuickSort } } - public static void sort(float[] arr, int p, int r, Object[] s) + static void sort(float[] arr, int p, int r, Object[] s) { int q; @@ -66,7 +101,7 @@ public class QuickSort } } - public static void sort(double[] arr, int p, int r, Object[] s) + static void sort(double[] arr, int p, int r, Object[] s) { int q; @@ -78,7 +113,7 @@ public class QuickSort } } - public static void sort(int[] arr, int p, int r, Object[] s) + static void sort(int[] arr, int p, int r, Object[] s) { int q; @@ -90,7 +125,7 @@ public class QuickSort } } - private static int partition(float[] arr, int p, int r, Object[] s) + static int partition(float[] arr, int p, int r, Object[] s) { float x = arr[p]; int i = p - 1; @@ -125,7 +160,7 @@ public class QuickSort } } - private static int partition(int[] arr, int p, int r, Object[] s) + static int partition(int[] arr, int p, int r, Object[] s) { int x = arr[p]; int i = p - 1; @@ -160,7 +195,7 @@ public class QuickSort } } - private static int partition(double[] arr, int p, int r, Object[] s) + static int partition(double[] arr, int p, int r, Object[] s) { double x = arr[p]; int i = p - 1; @@ -195,7 +230,7 @@ public class QuickSort } } - private static int stringPartition(String[] arr, int p, int r, Object[] s) + static int stringPartition(String[] arr, int p, int r, Object[] s) { String x = arr[p]; int i = p - 1;