public final class CharacterGene extends Object implements Gene<Character,CharacterGene>, Comparable<CharacterGene>, Realtime, XMLSerializable
Modifier and Type | Field and Description |
---|---|
static Function<CharacterGene,Character> |
Allele
Converter for accessing the allele from a given gene.
|
static CharSeq |
DEFAULT_CHARACTERS
The default character set used by this gene.
|
static Function<CharacterGene,CharSeq> |
ValidCharacters
Converter for accessing the valid characters from a given gene.
|
Constructor and Description |
---|
CharacterGene(Character character,
CharSeq validChars)
Create a new character gene from the given
character and the
given set of valid characters. |
Modifier and Type | Method and Description |
---|---|
char |
charValue()
Return the
char value of this character gene. |
int |
compareTo(CharacterGene that) |
CharacterGene |
copy()
Deprecated.
|
boolean |
equals(Object obj) |
Character |
getAllele()
Return the allele of this gene.
|
CharSeq |
getValidCharacters()
Retunr a (unmodifiable) set of valid characters.
|
int |
hashCode() |
boolean |
isValid()
Check if this object is valid.
|
boolean |
isValidCharacter(Character character)
Test, if the given character is valid.
|
CharacterGene |
newInstance()
Return a new, random gene of the same type than this gene.
|
CharacterGene |
newInstance(Character character)
Create a new character gene from the given character.
|
static CharacterGene |
of()
Create a new random character gene, chosen from the
DEFAULT_CHARACTERS . |
static CharacterGene |
of(Character character)
Create a new character gene from the given character.
|
static CharacterGene |
of(char character,
CharSeq validCharacters)
Create a new CharacterGene from the give character.
|
static CharacterGene |
of(CharSeq validCharacters)
Create a new CharacterGene with a randomly chosen character from the
set of valid characters.
|
String |
toString() |
Text |
toText() |
static CharacterGene |
valueOf()
Deprecated.
Use
of() instead. |
static CharacterGene |
valueOf(Character character)
Deprecated.
Use
of(Character) instead. |
static CharacterGene |
valueOf(Character character,
CharSeq validCharacters)
Deprecated.
Use
of(char, org.jenetics.util.CharSeq) instead. |
static CharacterGene |
valueOf(CharSeq validCharacters)
Deprecated.
Use
of(org.jenetics.util.CharSeq) instead. |
public static final CharSeq DEFAULT_CHARACTERS
public static final Function<CharacterGene,Character> Allele
public static final Function<CharacterGene,CharSeq> ValidCharacters
public CharacterGene(Character character, CharSeq validChars)
character
and the
given set of valid characters.character
- the char this gene representsvalidChars
- the set of valid characters.NullPointerException
- if one of the arguments is null
.public boolean isValid()
Verifiable
isValid
in interface Verifiable
public Character getAllele()
Gene
getAllele
in interface Gene<Character,CharacterGene>
public char charValue()
char
value of this character gene.char
value.public boolean isValidCharacter(Character character)
character
- The character to test.public CharSeq getValidCharacters()
CharSeq
of valid characters.@Deprecated public CharacterGene copy()
public int compareTo(CharacterGene that)
compareTo
in interface Comparable<CharacterGene>
that
- The other gene to compare.Character.compareTo(java.lang.Character)
public CharacterGene newInstance()
Gene
gene.getClass() ==
gene.newInstance().getClass()
.newInstance
in interface Gene<Character,CharacterGene>
newInstance
in interface Factory<CharacterGene>
public CharacterGene newInstance(Character character)
getValidCharacters()
, an invalid gene will be
created.character
- the character value of the created gene.NullPointerException
- if the given character
is
null
.public static CharacterGene of(CharSeq validCharacters)
validCharacters
- the valid characters for this gene.NullPointerException
- if the validCharacters
are
null
.@Deprecated public static CharacterGene valueOf(CharSeq validCharacters)
of(org.jenetics.util.CharSeq)
instead.public static CharacterGene of(Character character)
DEFAULT_CHARACTERS
, an invalid gene will be
created.character
- the character value of the created gene.NullPointerException
- if the given character
is
null
.@Deprecated public static CharacterGene valueOf(Character character)
of(Character)
instead.public static CharacterGene of()
DEFAULT_CHARACTERS
.@Deprecated public static CharacterGene valueOf()
of()
instead.public static CharacterGene of(char character, CharSeq validCharacters)
character
- The allele.NullPointerException
- if one of the arguments is null
.IllegalArgumentException
- if the validCharacters
are empty.@Deprecated public static CharacterGene valueOf(Character character, CharSeq validCharacters)
of(char, org.jenetics.util.CharSeq)
instead.© 2007-2014 Franz Wilhelmstötter (2014-03-07 19:35)