public class Gene
extends java.lang.Object
This implementation uses boolean values to store the genes values. It is used to store DNF rules, so that each variable can can get more than one value at a time. Each gene is an array of boolean values, false indicates that the value is not present, true indicates that the value is present
Constructor and Description |
---|
Gene(int lenght)
Creates new instance of gene
|
Modifier and Type | Method and Description |
---|---|
boolean |
getGeneElem(int pos)
Retuns the value of the gene indicated
|
int |
getGeneLenght()
Retuns the gene lenght of the chromosome
|
void |
NoTakeInitGene()
Non-intervene Initialization of an existing gene
|
void |
Print(java.lang.String nFile)
Prints the gene
|
void |
RndInitGene()
Random initialization of an existing gene
|
void |
setGeneElem(int pos,
boolean value)
Sets the value of the indicated gene of the chromosome
|
public Gene(int lenght)
Creates new instance of gene
lenght
- Number of posibles values for the variablepublic void RndInitGene()
Random initialization of an existing gene
public void NoTakeInitGene()
Non-intervene Initialization of an existing gene
public boolean getGeneElem(int pos)
Retuns the value of the gene indicated
pos
- Position of the genepublic void setGeneElem(int pos, boolean value)
Sets the value of the indicated gene of the chromosome
pos
- Position of the genevalue
- Value of the genepublic int getGeneLenght()
Retuns the gene lenght of the chromosome
public void Print(java.lang.String nFile)
Prints the gene
nFile
- Name of the file to write the gene