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.
|
| Modifier and Type | Method and Description |
|---|---|
char |
charValue()
Return the
char value of this character gene. |
int |
compareTo(CharacterGene that) |
CharacterGene |
copy() |
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 c)
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.
|
String |
toString() |
Text |
toText() |
static CharacterGene |
valueOf() |
static CharacterGene |
valueOf(Character character)
Create a new character gene from the given character.
|
static CharacterGene |
valueOf(Character character,
CharSeq validCharacters)
Create a new CharacterGene from the give character.
|
static CharacterGene |
valueOf(CharSeq validCharacters)
Create a new CharacterGene with a randomly chosen character from the
set of valid characters.
|
public static final CharSeq DEFAULT_CHARACTERS
public static final Function<CharacterGene,Character> Allele
public static final Function<CharacterGene,CharSeq> ValidCharacters
public boolean isValid()
VerifiableisValid in interface Verifiablepublic Character getAllele()
GenegetAllele in interface Gene<Character,CharacterGene>public char charValue()
char value of this character gene.char value.public boolean isValidCharacter(Character c)
c - The character to test.public CharSeq getValidCharacters()
CharSeq of valid characters.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()
Genegene.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 valueOf(CharSeq validCharacters)
validCharacters - the valid characters for this gene.NullPointerException - if the validCharacters are
null.public static CharacterGene valueOf(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.public static CharacterGene valueOf()
public static CharacterGene valueOf(Character character, CharSeq validCharacters)
character - The allele.NullPointerException - if one of the arguments is null.IllegalArgumentException - if the validCharacters are empty.© 2007-2013 Franz Wilhelmstötter (2013-12-18 20:17)