All Packages Class Hierarchy This Package Previous Next Index
Class evolution.pack.PackableGeneImpl
java.lang.Object
|
+----evolution.pack.PackableGeneImpl
- public class PackableGeneImpl
- extends Object
- implements PackableGene
Full implementation of PackableGene
based on a Code
.
-
data
- My genetic data
-
PackableGeneImpl(Code)
- Construct from
Code
-
PackableGeneImpl(int, RandomGenerator)
- Construct new random gene.
-
mutate(float, RandomGenerator)
- Mutate myself with a given probability.
-
toCode()
- Convert to
Code
.
data
protected Code data
- My genetic data
PackableGeneImpl
public PackableGeneImpl(int size,
RandomGenerator rg) throws NoRandomGeneratorException
- Construct new random gene.
- Throws: NoRandomGeneratorException
- if the
RandomGenerator
is nil
PackableGeneImpl
public PackableGeneImpl(Code b) throws NilException
- Construct from
Code
- Throws: NilException
- if the argument is nil
mutate
public Gene mutate(float prob,
RandomGenerator rg) throws NoRandomGeneratorException
- Mutate myself with a given probability.
In this implementation, a mutation of the gene is defined
as the flip of exactly one of its bits.
- Parameters:
- prob - the mutation probability
- rg - the RandomGenerator to use
- Returns:
- myself
- Throws: NoRandomGeneratorException
- if
rg = nil
toCode
public Code toCode()
- Convert to
Code
.
All Packages Class Hierarchy This Package Previous Next Index