|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jgap.BaseGene
public abstract class BaseGene
Abstract base class for all genes. Provides default implementations.
| Field Summary | |
|---|---|
static double |
DELTA
Delta, useful for comparing doubles and floats. |
static java.lang.String |
S_APPLICATION_DATA
Constants for toString() |
| Fields inherited from interface org.jgap.Gene |
|---|
PERSISTENT_FIELD_DELIMITER |
| Constructor Summary | |
|---|---|
BaseGene(Configuration a_configuration)
|
|
| Method Summary | |
|---|---|
void |
cleanup()
Executed by the genetic engine when this Gene instance is no longer needed and should perform any necessary resource cleanup. |
protected int |
compareApplicationData(java.lang.Object a_appdata1,
java.lang.Object a_appdata2)
|
protected java.lang.String |
decode(java.lang.String a_string)
|
protected java.lang.String |
encode(java.lang.String a_string)
|
boolean |
equals(java.lang.Object a_other)
Compares this Gene with the given object and returns true if the other object is a Gene of the same type and has the same value (allele) as this Gene. |
java.lang.Object |
getAllele()
Retrieves the allele value represented by this Gene. |
java.lang.Object |
getApplicationData()
Retrieves the application-specific data that is attached to this Gene. |
java.lang.String |
getBusinessKey()
|
Configuration |
getConfiguration()
|
IGeneConstraintChecker |
getConstraintChecker()
|
double |
getEnergy()
|
protected abstract java.lang.Object |
getInternalValue()
Each Gene implementation holds its own m_value object keeping the allele value. |
int |
hashCode()
Retrieves the hash code value for a Gene. |
boolean |
isCompareApplicationData()
|
Gene |
newGene()
Provides implementation-independent means for creating new Gene instances. |
protected abstract Gene |
newGeneInternal()
|
void |
setApplicationData(java.lang.Object a_newData)
This sets the application-specific data that is attached to this Gene. |
void |
setCompareApplicationData(boolean a_doCompare)
Should we also consider the application data when comparing? |
void |
setConstraintChecker(IGeneConstraintChecker a_constraintChecker)
Sets the constraint checker to be used for this gene whenever method setAllele(Object) is called. |
void |
setEnergy(double a_energy)
Sets the energy of the gene |
int |
size()
|
java.lang.String |
toString()
Retrieves a string representation of this Gene's value that may be useful for display purposes. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jgap.Gene |
|---|
applyMutation, getPersistentRepresentation, setAllele, setToRandomValue, setValueFromPersistentRepresentation |
| Methods inherited from interface java.lang.Comparable |
|---|
compareTo |
| Field Detail |
|---|
public static final double DELTA
public static final java.lang.String S_APPLICATION_DATA
| Constructor Detail |
|---|
public BaseGene(Configuration a_configuration)
throws InvalidConfigurationException
a_configuration - the configuration to use
InvalidConfigurationException| Method Detail |
|---|
public java.lang.Object getAllele()
getAllele in interface Genepublic int hashCode()
hashCode in class java.lang.Objectpublic void cleanup()
cleanup in interface Genepublic java.lang.String toString()
toString in interface GenetoString in class java.lang.Objectpublic int size()
size in interface Genepublic boolean equals(java.lang.Object a_other)
equals in class java.lang.Objecta_other - the object to compare to this Gene for equality
protected abstract java.lang.Object getInternalValue()
BooleanGene for example)
public double getEnergy()
getEnergy in interface Genepublic void setEnergy(double a_energy)
setEnergy in interface Genea_energy - the energy to setpublic void setApplicationData(java.lang.Object a_newData)
setApplicationData in interface Genea_newData - the new application-specific data to attach to this
Genepublic java.lang.Object getApplicationData()
getApplicationData in interface Genepublic void setCompareApplicationData(boolean a_doCompare)
setCompareApplicationData in interface Genea_doCompare - true: consider application data in method compareTopublic boolean isCompareApplicationData()
isCompareApplicationData in interface Gene
protected int compareApplicationData(java.lang.Object a_appdata1,
java.lang.Object a_appdata2)
public void setConstraintChecker(IGeneConstraintChecker a_constraintChecker)
setConstraintChecker in interface Genea_constraintChecker - the constraint checker to be setpublic IGeneConstraintChecker getConstraintChecker()
public Gene newGene()
newGene in interface Geneprotected abstract Gene newGeneInternal()
public Configuration getConfiguration()
getConfiguration in interface Genepublic java.lang.String getBusinessKey()
getBusinessKey in interface IBusinessKeyprotected java.lang.String encode(java.lang.String a_string)
protected java.lang.String decode(java.lang.String a_string)
|
JGAP | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||