@Test(dataProvider = "arraySize") public void revert(final Integer size) { final double[] probabilities = array(size, new Random()); final double[] reverted = ProbabilitySelector.sortAndRevert(probabilities); for (int i = 0; i < size; ++i) { Assert.assertEquals( probabilities[i] + reverted[i], size - 1.0 ); } }
static double[] sortAndRevert(final double[] array) { final int[] indexes = ProxySorter.sort(array); final double[] result = new double[array.length]; for (int i = 0; i < result.length; ++i) { result[indexes[i]] = array[indexes[result.length - 1 - i]]; } return result; }
ProbabilitySelector implements Selector<G, C> { static double[] sortAndRevert(final double[] array) { final int[] indexes = ProxySorter.sort(array); final double[] result = new double[array.length]; for (int i = 0; i < result.length; ++i) { result[indexes[i]] = array[indexes[result.length - 1 - i]]; } return result; } }
ProbabilitySelector implements Selector<G, C> { static double[] sortAndRevert(final double[] array) { final int[] indexes = ProxySorter.sort(array); final double[] result = new double[array.length]; for (int i = 0; i < result.length; ++i) { result[indexes[i]] = array[indexes[result.length - 1 - i]]; } return result; } protected  ProbabilitySelector(final boolean sorted); protected  ProbabilitySelector(); }
ProbabilitySelector implements Selector<G, C> { static double[] sortAndRevert(final double[] array) { final int[] indexes = ProxySorter.sort(array); final double[] result = new double[array.length]; for (int i = 0; i < result.length; ++i) { result[indexes[i]] = array[indexes[result.length - 1 - i]]; } return result; } protected  ProbabilitySelector(final boolean sorted); protected  ProbabilitySelector(); @Override ISeq<Phenotype<G, C>> select(
		final Seq<Phenotype<G, C>> population,
		final int count,
		final Optimize opt
	); }
ProbabilitySelector implements Selector<G, C> { static double[] sortAndRevert(final double[] array) { final int[] indexes = ProxySorter.sort(array); final double[] result = new double[array.length]; for (int i = 0; i < result.length; ++i) { result[indexes[i]] = array[indexes[result.length - 1 - i]]; } return result; } protected  ProbabilitySelector(final boolean sorted); protected  ProbabilitySelector(); @Override ISeq<Phenotype<G, C>> select(
		final Seq<Phenotype<G, C>> population,
		final int count,
		final Optimize opt
	);  }