IntegerChromosome extends AbstractBoundedChromosome<Integer, IntegerGene> implements
			NumericChromosome<Integer, IntegerGene>,
			Serializable { public static IntegerChromosome of(final IntegerGene... genes) { checkGeneRange(Stream.of(genes).map(IntegerGene::range)); return new IntegerChromosome(ISeq.of(genes), IntRange.of(genes.length)); } protected  IntegerChromosome(
		final ISeq<IntegerGene> genes,
		final IntRange lengthRange
	); @Override IntegerChromosome newInstance(final ISeq<IntegerGene> genes); @Override IntegerChromosome newInstance(); IntegerChromosome map(final Function<? super int[], int[]> f); IntStream intStream(); int[] toArray(final int[] array); int[] toArray(); static IntegerChromosome of(final IntegerGene... genes); static IntegerChromosome of(final Iterable<IntegerGene> genes); static IntegerChromosome of(
		final int min,
		final int max,
		final IntRange lengthRange
	); static IntegerChromosome of(
		final int min,
		final int max,
		final int length
	); static IntegerChromosome of(
		final IntRange range,
		final IntRange lengthRange
	); static IntegerChromosome of(final IntRange range, final int length); static IntegerChromosome of(final int min, final int max); static IntegerChromosome of(final IntRange range);  }
@Test(invocationCount = 20, successPercentage = 95) public void newInstanceDistribution() { using(new Random(12345), r -> { final int min = 0; final int max = 10000000; final MinMax<Integer> mm = MinMax.of(); final Histogram<Integer> histogram = Histogram.ofInteger(min, max, 10); for (int i = 0; i < 1000; ++i) { final IntegerChromosome chromosome = IntegerChromosome.of(min, max, 500); chromosome.forEach(g -> { mm.accept(g.allele()); histogram.accept(g.allele()); }); } Assert.assertTrue(mm.min().compareTo(0) >= 0); Assert.assertTrue(mm.max().compareTo(100) <= 100); assertUniformDistribution(histogram); }); }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofAmbiguousGenes1() { IntegerChromosome.of( IntegerGene.of(1, 2), IntegerGene.of(3, 4), IntegerGene.of(5, 6) ); }
@Test(expectedExceptions = IllegalArgumentException.class) public void ofAmbiguousGenes2() { IntegerChromosome.of( ISeq.of( IntegerGene.of(1, 2), IntegerGene.of(3, 4), IntegerGene.of(5, 6) ) ); }