|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jgap.impl.NumberGene
org.jgap.impl.IntegerGene
A Gene implementation that supports an integer values for its allele. Upper and lower bounds may optionally be provided to restrict the range of legal values allowed by this Gene instance.
| Field Summary |
| Fields inherited from interface org.jgap.Gene |
PERSISTENT_FIELD_DELIMITER |
| Constructor Summary | |
IntegerGene()
Constructs a new IntegerGene with default settings. |
|
IntegerGene(int a_lowerBounds,
int a_upperBounds)
Constructs a new IntegerGene with the specified lower and upper bounds for values (alleles) of this Gene instance. |
|
| Method Summary | |
void |
applyMutation(int index,
double a_percentage)
See interface Gene for description |
java.lang.String |
getPersistentRepresentation()
Retrieves a string representation of this Gene that includes any information required to reconstruct it at a later time, such as its value and internal state. |
int |
intValue()
Retrieves the int value of this Gene, which may be more convenient in some cases than the more general getAllele() method. |
Gene |
newGene()
Provides an implementation-independent means for creating new Gene instances. |
void |
setToRandomValue(RandomGenerator a_numberGenerator)
Sets the value (allele) of this Gene to a random Integer value between the lower and upper bounds (if any) of this Gene. |
void |
setValueFromPersistentRepresentation(java.lang.String a_representation)
Sets the value and internal state of this Gene from the string representation returned by a previous invocation of the getPersistentRepresentation() method. |
| Methods inherited from class org.jgap.impl.NumberGene |
cleanup, compareTo, equals, getAllele, getConstraintChecker, hashCode, setAllele, setConstraintChecker, size, toString |
| Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jgap.Gene |
cleanup, getAllele, setAllele, size, toString |
| Methods inherited from interface java.lang.Comparable |
compareTo |
| Constructor Detail |
public IntegerGene()
public IntegerGene(int a_lowerBounds,
int a_upperBounds)
a_lowerBounds - The lowest value that this Gene may possess,
inclusive.a_upperBounds - The highest value that this Gene may possess,
inclusive.| Method Detail |
public Gene newGene()
It should be noted that nothing is guaranteed about the actual value of the returned Gene and it should therefore be considered to be undefined.
newGene in interface Gene
public java.lang.String getPersistentRepresentation()
throws java.lang.UnsupportedOperationException
getPersistentRepresentation in interface Genejava.lang.UnsupportedOperationException - to indicate that no implementation
is provided for this method.
public void setValueFromPersistentRepresentation(java.lang.String a_representation)
throws UnsupportedRepresentationException
setValueFromPersistentRepresentation in interface Genea_representation - the string representation retrieved from a
prior call to the getPersistentRepresentation()
method.
java.lang.UnsupportedOperationException - to indicate that no implementation
is provided for this method.
UnsupportedRepresentationException - if this Gene implementation
does not support the given string representation.public int intValue()
public void setToRandomValue(RandomGenerator a_numberGenerator)
setToRandomValue in interface Genea_numberGenerator - The random number generator that should be
used to create any random values. It's important
to use this generator to maintain the user's
flexibility to configure the genetic engine
to use the random number generator of their
choice.
public void applyMutation(int index,
double a_percentage)
applyMutation in interface GeneapplyMutation in class NumberGeneindex - ignored (because there is only 1 atomic element)a_percentage - percentage of mutation (greater than -1 and smaller
than 1).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||