|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgap.Gene
Genes represent the discrete components of a potential solution (the Chromosome). This
abstract class exists so that custom gene implementations can be easily plugged-in, which can
add a great deal of flexibility and convenience for many applications. Note that it's very
important that implementations of this interface also implement the equals()
method. Without a proper implementation of equals()
, some genetic operations
will fail to work properly. Innovation ID is used as a historical marker and aids in
crossover and determining "distance" between 2 chromosomes for speciation. Not the difference
between compareTo()
and distance()
:compareTo()
is used by container classes to sort genes by innovation ID, distance()
is the
genetic distance between genes with the same innovation ID.
Constructor Summary | |
protected |
Gene()
for hibernate |
|
Gene(java.lang.Long anInnovationId)
Create new gene. |
Method Summary | |
int |
compareTo(java.lang.Object o)
Comparison based on innovation ID. |
boolean |
equals(java.lang.Object o)
|
java.lang.Long |
getInnovationId()
Innovation ID is analagous to the locus of a real gene. |
int |
hashCode()
Uses hash of innovation ID. |
protected void |
setInnovationId(java.lang.Long aInnovationId)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
protected Gene()
public Gene(java.lang.Long anInnovationId)
anInnovationId
- Method Detail |
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
Comparable.compareTo(java.lang.Object)
public boolean equals(java.lang.Object o)
Object.equals(Object)
public java.lang.Long getInnovationId()
public int hashCode()
Object.hashCode()
protected void setInnovationId(java.lang.Long aInnovationId)
aInnovationId
- public java.lang.String toString()
Object.toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |