public final class PermutationChromosome<T> extends AbstractChromosome<EnumGene<T>> implements Serializable
AbstractChromosome
has been overridden so
that no invalid permutation will be created._genes, _valid
Constructor and Description |
---|
PermutationChromosome(ISeq<EnumGene<T>> genes) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
ISeq<T> |
getValidAlleles() |
int |
hashCode() |
boolean |
isValid()
Check if this chromosome represents still a valid permutation.
|
PermutationChromosome<T> |
newInstance()
Create a new, random chromosome.
|
PermutationChromosome<T> |
newInstance(ISeq<EnumGene<T>> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes . |
static <T> PermutationChromosome<T> |
of(ISeq<? extends T> alleles)
Create a new, random chromosome with the given valid alleles.
|
static <T> PermutationChromosome<T> |
of(T... alleles)
Create a new, random chromosome with the given valid alleles.
|
static PermutationChromosome<Integer> |
ofInteger(int length)
Create a integer permutation chromosome with the given length.
|
static PermutationChromosome<Integer> |
ofInteger(int start,
int end)
Create a integer permutation chromosome with the given length.
|
String |
toString() |
getGene, iterator, length, toSeq
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getGene
forEach, spliterator
public PermutationChromosome(ISeq<EnumGene<T>> genes)
public ISeq<T> getValidAlleles()
public boolean isValid()
isValid
in interface Verifiable
isValid
in class AbstractChromosome<EnumGene<T>>
public PermutationChromosome<T> newInstance()
newInstance
in interface Factory<Chromosome<EnumGene<T>>>
public PermutationChromosome<T> newInstance(ISeq<EnumGene<T>> genes)
Chromosome
Chromosome
of specific type
and the given genes
.newInstance
in interface Chromosome<EnumGene<T>>
genes
- the genes of the new chromosome. The given genes array is
not copied.Chromosome
of the same type with the given genes.public int hashCode()
hashCode
in class AbstractChromosome<EnumGene<T>>
public static <T> PermutationChromosome<T> of(ISeq<? extends T> alleles)
T
- the gene type of the chromosomealleles
- the valid alleles used for this permutation arrays.@SafeVarargs public static <T> PermutationChromosome<T> of(T... alleles)
T
- the gene type of the chromosomealleles
- the valid alleles used for this permutation arrays.public static PermutationChromosome<Integer> ofInteger(int length)
length
- the chromosome length.public static PermutationChromosome<Integer> ofInteger(int start, int end)
start
- the start of the integer range (inclusively) of the returned
chromosome.end
- the end of the integer range (exclusively) of the returned
chromosome.IllegalArgumentException
- if end <= start
© 2007-2014 Franz Wilhelmstötter (2014-12-28 10:45)