@Test public void testAscDouble() { final int maxSize = 1000; final int rounds = 1000; final Random rnd = new Random(0x11223344); for (int round = 0; round < rounds; round++) { final double[] input = generateRandom(maxSize, rnd); final IntBinaryOperator comparator = (a, b) -> Double.compare(input[a], input[b]); final int start = rnd.nextInt(input.length - 1); final int length = (input.length - start); int[] order = IndirectSort.mergesort(start, length, comparator); assertOrder(order, length, comparator); } }
public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } private  IndirectSort(); }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } private  IndirectSort(); static int[] mergesort(int start, int length, IntBinaryOperator comparator); static int[] mergesort(
      T[] input, int start, int length, Comparator<? super T> comparator); }
IndirectSort { public static int[] mergesort(int start, int length, IntBinaryOperator comparator) { final int[] src = createOrderArray(start, length); if (length > 1) { final int[] dst = (int[]) src.clone(); topDownMergeSort(src, dst, 0, length, comparator); return dst; } return src; } private  IndirectSort(); static int[] mergesort(int start, int length, IntBinaryOperator comparator); static int[] mergesort(
      T[] input, int start, int length, Comparator<? super T> comparator);  }