@Test public void isValid() { final ISeq<Integer> alleles = IntStream.range(0, 100) .boxed() .collect(ISeq.toISeq()); final ISeq<EnumGene<Integer>> genes = IntStream.of(Combinatorics.subset(100, 10)) .mapToObj(i -> EnumGene.of(i, alleles)) .collect(ISeq.toISeq()); final PermutationChromosome<Integer> ch = new PermutationChromosome<>(genes); Assert.assertTrue(ch.isValid()); Assert.assertEquals(ch.length(), 10); }
@Override public boolean isValid() { if (_valid == null) { final byte[] check = Bits.newArray(_validAlleles.length()); _valid = _genes.forAll(g -> !getAndSet(check, g.alleleIndex())); } return _valid; }
PermutationChromosome extends AbstractChromosome<EnumGene<T>> implements Serializable { @Override public boolean isValid() { if (_valid == null) { final byte[] check = Bits.newArray(_validAlleles.length()); _valid = _genes.forAll(g -> !getAndSet(check, g.alleleIndex())); } return _valid; } }
PermutationChromosome extends AbstractChromosome<EnumGene<T>> implements Serializable { @Override public boolean isValid() { if (_valid == null) { final byte[] check = Bits.newArray(_validAlleles.length()); _valid = _genes.forAll(g -> !getAndSet(check, g.alleleIndex())); } return _valid; } private  PermutationChromosome(
		final ISeq<EnumGene<T>> genes,
		final Boolean valid
	);  PermutationChromosome(final ISeq<EnumGene<T>> genes); }
PermutationChromosome extends AbstractChromosome<EnumGene<T>> implements Serializable { @Override public boolean isValid() { if (_valid == null) { final byte[] check = Bits.newArray(_validAlleles.length()); _valid = _genes.forAll(g -> !getAndSet(check, g.alleleIndex())); } return _valid; } private  PermutationChromosome(
		final ISeq<EnumGene<T>> genes,
		final Boolean valid
	);  PermutationChromosome(final ISeq<EnumGene<T>> genes); ISeq<T> validAlleles(); @Override boolean isValid(); @Override PermutationChromosome<T> newInstance(); @Override PermutationChromosome<T> newInstance(final ISeq<EnumGene<T>> genes); @Override String toString(); static PermutationChromosome<T> of(
		final ISeq<? extends T> alleles,
		final int length
	); static PermutationChromosome<T> of(final ISeq<? extends T> alleles); @SafeVarargs static PermutationChromosome<T> of(final T... alleles); static PermutationChromosome<Integer> ofInteger(final int length); static PermutationChromosome<Integer> ofInteger(final int start, final int end); static PermutationChromosome<Integer> ofInteger(final IntRange range, final int length); }
PermutationChromosome extends AbstractChromosome<EnumGene<T>> implements Serializable { @Override public boolean isValid() { if (_valid == null) { final byte[] check = Bits.newArray(_validAlleles.length()); _valid = _genes.forAll(g -> !getAndSet(check, g.alleleIndex())); } return _valid; } private  PermutationChromosome(
		final ISeq<EnumGene<T>> genes,
		final Boolean valid
	);  PermutationChromosome(final ISeq<EnumGene<T>> genes); ISeq<T> validAlleles(); @Override boolean isValid(); @Override PermutationChromosome<T> newInstance(); @Override PermutationChromosome<T> newInstance(final ISeq<EnumGene<T>> genes); @Override String toString(); static PermutationChromosome<T> of(
		final ISeq<? extends T> alleles,
		final int length
	); static PermutationChromosome<T> of(final ISeq<? extends T> alleles); @SafeVarargs static PermutationChromosome<T> of(final T... alleles); static PermutationChromosome<Integer> ofInteger(final int length); static PermutationChromosome<Integer> ofInteger(final int start, final int end); static PermutationChromosome<Integer> ofInteger(final IntRange range, final int length);  }