ParallelArrayBinarySort { public static void parallelBinarySort(final double[] keys, final double[] values) { Validate.notNull(keys, "x data"); Validate.notNull(values, "y data"); Validate.isTrue(keys.length == values.length); final int n = keys.length; dualArrayQuickSort(keys, values, 0, n - 1); }  static void parallelBinarySort(final double[] keys, final double[] values); static void parallelBinarySort(final float[] keys, final double[] values); static void parallelBinarySort(final int[] keys, final double[] values); static void parallelBinarySort(final long[] keys, final double[] values); static void parallelBinarySort(final float[] keys, final int[] values); static void parallelBinarySort(final int[] keys, final int[] values); static void parallelBinarySort(final long[] keys, final int[] values); static void parallelBinarySort(final double[] keys, final int[] values); static void parallelBinarySort(final T[] keys, final U[] values); static void parallelBinarySort(final double[] keys, final T[] values);  }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDoubleNullKeys() { double[] t = null; ParallelArrayBinarySort.parallelBinarySort(t, Y1D); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDoubleNullValues() { ParallelArrayBinarySort.parallelBinarySort(X1D, (double[]) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDoubleDifferentLengths() { ParallelArrayBinarySort.parallelBinarySort(X1D, new double[] {2, 4, 6 }); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDoubleObjectNullKeys() { ParallelArrayBinarySort.parallelBinarySort((double[]) null, Y1D); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDoubleObjectNullValues() { ParallelArrayBinarySort.parallelBinarySort(X1D, (Object[]) null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testDoubleObjectDifferentLengths() { ParallelArrayBinarySort.parallelBinarySort(X1D, new Object[] {2, 4, 6 }); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testObjectNullKeys() { ParallelArrayBinarySort.parallelBinarySort((String[]) null, Y3); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testObjectNullValues() { ParallelArrayBinarySort.parallelBinarySort(F1, null); }
@Test(expectedExceptions = IllegalArgumentException.class) public void testObjectDifferentLengths() { ParallelArrayBinarySort.parallelBinarySort(F1, new Double[] {2., 4., 6. }); }
@Test public void testIntsSortByDouble() { final int n = X1I.length; final int[] x2 = Arrays.copyOf(X2I, n); final double[] y2 = Arrays.copyOf(Y2D, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1I, x2)); assertTrue(Arrays.equals(Y1D, y2)); }
@Test public void testLongsSortByDouble() { final int n = X1L.length; final long[] x2 = Arrays.copyOf(X2L, n); final double[] y2 = Arrays.copyOf(Y2D, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1L, x2)); assertTrue(Arrays.equals(Y1D, y2)); }
@Test public void testFloatsSortByDouble() { final int n = X1F.length; final float[] x2 = Arrays.copyOf(X2F, n); final double[] y2 = Arrays.copyOf(Y2D, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1F, x2)); assertTrue(Arrays.equals(Y1D, y2)); }
@Test public void testDoublesSortByDouble() { final int n = X1D.length; final double[] x2 = Arrays.copyOf(X2D, n); final double[] y2 = Arrays.copyOf(Y2D, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1D, x2)); assertTrue(Arrays.equals(Y1D, y2)); }
@Test public void testIntsSortByInts() { final int n = X1I.length; final int[] x2 = Arrays.copyOf(X2I, n); final int[] y2 = Arrays.copyOf(Y2I, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1I, x2)); assertTrue(Arrays.equals(Y1I, y2)); }
@Test public void testLongsSortByInts() { final int n = X1L.length; final long[] x2 = Arrays.copyOf(X2L, n); final int[] y2 = Arrays.copyOf(Y2I, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1L, x2)); assertTrue(Arrays.equals(Y1I, y2)); }
@Test public void testFloatsSortByInts() { final int n = X1F.length; final float[] x2 = Arrays.copyOf(X2F, n); final int[] y2 = Arrays.copyOf(Y2I, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1F, x2)); assertTrue(Arrays.equals(Y1I, y2)); }
@Test public void testDoublesSortByInts() { final int n = X1D.length; final double[] x2 = Arrays.copyOf(X2D, n); final int[] y2 = Arrays.copyOf(Y2I, n); ParallelArrayBinarySort.parallelBinarySort(x2, y2); assertTrue(Arrays.equals(X1D, x2)); assertTrue(Arrays.equals(Y1I, y2)); }
@Test public void testObjects() { final int n = F2.length; final Float[] f2 = Arrays.copyOf(F2, n); final Double[] y4 = Arrays.copyOf(Y4, n); ParallelArrayBinarySort.parallelBinarySort(f2, y4); assertArrayEquals(F1, f2); assertArrayEquals(Y3, y4); }
@Test public void testDoubleObject() { final int n = X2D.length; final double[] x2 = Arrays.copyOf(X2D, n); final Double[] y4 = Arrays.copyOf(Y4, n); ParallelArrayBinarySort.parallelBinarySort(x2, y4); assertArrayEquals(X1D, x2, 0); assertArrayEquals(Y3, y4); }