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)
Deprecated.
Use
of(int) instead. |
CharacterChromosome(ISeq<CharacterGene> genes)
Deprecated.
Visibility will be changed to
protected . |
CharacterChromosome(String genes)
Deprecated.
Use
of(String) instead. |
CharacterChromosome(String genes,
CharSeq validCharacters)
Deprecated.
Use
of(String, org.jenetics.util.CharSeq) instead. |
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 . |
static CharacterChromosome |
of(int length)
Create a new chromosome with the
CharacterGene.DEFAULT_CHARACTERS
char set as valid characters. |
static CharacterChromosome |
of(String alleles)
Create a new chromosome from the given genes (given as string).
|
static CharacterChromosome |
of(String alleles,
CharSeq validChars)
Create a new chromosome from the given genes (given as string).
|
CharacterChromosome |
subSequence(int start,
int end) |
String |
toString() |
getGene, getGene, indexOf, isValid, iterator, length, toSeq
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
length
public 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
@Deprecated public CharacterChromosome(ISeq<CharacterGene> genes)
protected
.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(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.@Deprecated public CharacterChromosome(int length)
of(int)
instead.CharacterGene.DEFAULT_CHARACTERS
char set as valid characters.length
- the length
of the new chromosome.IllegalArgumentException
- if the length
is smaller than
one.@Deprecated public CharacterChromosome(String genes, CharSeq validCharacters)
of(String, org.jenetics.util.CharSeq)
instead.genes
- the character genes.validCharacters
- the valid characters.IllegalArgumentException
- if the genes string is empty.@Deprecated public CharacterChromosome(String genes)
of(String)
instead.genes
- the character genes.IllegalArgumentException
- if the genes string is empty.@Deprecated public Factory<CharacterChromosome> asFactory()
Array
class.public char charAt(int index)
charAt
in interface CharSequence
public CharacterChromosome subSequence(int start, int end)
subSequence
in interface CharSequence
public CharacterChromosome newInstance(ISeq<CharacterGene> genes)
Chromosome
Chromosome
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 CharSequence
toString
in class AbstractChromosome<CharacterGene>
public static CharacterChromosome of(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 static CharacterChromosome of(String alleles, CharSeq validChars)
alleles
- the character genes.validChars
- the valid characters.IllegalArgumentException
- if the genes string is empty.public static CharacterChromosome of(String alleles)
alleles
- the character genes.IllegalArgumentException
- if the genes string is empty.public static Function<Chromosome<CharacterGene>,CharacterGene> Gene(int index)
© 2007-2014 Franz Wilhelmstötter (2014-03-07 19:35)