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