*/
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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;
}
}
- 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;