public class CharacterChromosome extends AbstractChromosome<CharacterGene> implements CharSequence, XMLSerializable
| Modifier and Type | Field and Description |
|---|---|
static Function<Chromosome<CharacterGene>,CharacterGene> |
Gene
|
static Function<Chromosome<CharacterGene>,ISeq<CharacterGene>> |
Genes
Return a
Function which returns the gene array from this
Chromosome. |
_genes, _valid| Constructor and Description |
|---|
CharacterChromosome(CharSeq validCharacters,
int length)
Create a new chromosome with the
validCharacters char set as
valid characters. |
CharacterChromosome(int length)
Create a new chromosome with the
CharacterGene.DEFAULT_CHARACTERS
char set as valid characters. |
CharacterChromosome(ISeq<CharacterGene> genes)
Create a new chromosome from the given
genes array. |
CharacterChromosome(String genes)
Create a new chromosome from the given genes (given as string).
|
CharacterChromosome(String genes,
CharSeq validCharacters)
Create a new chromosome from the given genes (given as string).
|
| Modifier and Type | Method and Description |
|---|---|
Factory<CharacterChromosome> |
asFactory()
Deprecated.
No longer needed after adding new factory methods to the
Array class. |
char |
charAt(int index) |
boolean |
equals(Object obj) |
static Function<Chromosome<CharacterGene>,CharacterGene> |
Gene(int index)
|
int |
hashCode() |
CharacterChromosome |
newInstance()
Create a new, random chromosome.
|
CharacterChromosome |
newInstance(ISeq<CharacterGene> genes)
A factory method which creates a new
Chromosome of specific type
and the given genes. |
CharacterChromosome |
subSequence(int start,
int end) |
String |
toString() |
getGene, getGene, indexOf, isValid, iterator, length, toSeqclone, finalize, getClass, notify, notifyAll, wait, wait, waitlengthpublic static final Function<Chromosome<CharacterGene>,ISeq<CharacterGene>> Genes
Function which returns the gene array from this
Chromosome.public static final Function<Chromosome<CharacterGene>,CharacterGene> Gene
public CharacterChromosome(int length)
CharacterGene.DEFAULT_CHARACTERS
char set as valid characters.length - the length of the new chromosome.IllegalArgumentException - if the length is smaller than
one.public CharacterChromosome(CharSeq validCharacters, int length)
validCharacters char set as
valid characters.validCharacters - the valid characters for this chromosome.length - the length of the new chromosome.NullPointerException - if the validCharacters is
null.IllegalArgumentException - if the length is smaller than
one.public CharacterChromosome(ISeq<CharacterGene> genes)
genes array. The genes
array is copied, so changes to the given genes array doesn't effect the
genes of this chromosome.genes - the genes that form the chromosome.NullPointerException - if the given gene array is null.IllegalArgumentException - if the length of the gene array is
smaller than one.public CharacterChromosome(String genes, CharSeq validCharacters)
genes - the character genes.validCharacters - the valid characters.IllegalArgumentException - if not all genes are in the set of valid
characters or the genes string is empty.public CharacterChromosome(String genes)
genes - the character genes.IllegalArgumentException - if not all genes are in the set of valid
characters or the genes is an empty string.@Deprecated public Factory<CharacterChromosome> asFactory()
Array class.public char charAt(int index)
charAt in interface CharSequencepublic CharacterChromosome subSequence(int start, int end)
subSequence in interface CharSequencepublic CharacterChromosome newInstance(ISeq<CharacterGene> genes)
ChromosomeChromosome of specific type
and the given genes.newInstance in interface Chromosome<CharacterGene>genes - the genes of the new chromosome. The given genes array is
not copied.Chromosome of the same type with the given genes.NullPointerException - if the given gene array is null.public CharacterChromosome newInstance()
newInstance in interface Factory<Chromosome<CharacterGene>>public int hashCode()
hashCode in class AbstractChromosome<CharacterGene>public boolean equals(Object obj)
equals in class AbstractChromosome<CharacterGene>public String toString()
toString in interface CharSequencetoString in class AbstractChromosome<CharacterGene>public static final Function<Chromosome<CharacterGene>,CharacterGene> Gene(int index)
© 2007-2013 Franz Wilhelmstötter (2013-12-18 20:17)