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 length)
Creates new instance of gene
|
Modifier and Type | Method and Description |
---|---|
int |
getGeneElem(int pos)
Retuns the value of the gene indicated
|
int |
getGeneLength()
Retuns the gene length of the chromosome
|
void |
InitGeneRnd()
Random initialization of an existing gene
|
void |
noTakeInitGene()
Non-intervene Initialization of an existing gene
|
java.lang.String |
print()
Gets the genes of the variable
|
void |
print(java.lang.String nFile)
Prints the gene
|
void |
setGeneElem(int pos,
int value)
Sets the value of the indicated gene of the chromosome
|
public Gene(int length)
Creates new instance of gene
length
- Number of posibles values for the variablepublic void InitGeneRnd()
Random initialization of an existing gene
public void noTakeInitGene()
Non-intervene Initialization of an existing gene
public int getGeneElem(int pos)
Retuns the value of the gene indicated
pos
- Position of the genepublic void setGeneElem(int pos, int value)
Sets the value of the indicated gene of the chromosome
pos
- Position of the genevalue
- Value of the genepublic int getGeneLength()
Retuns the gene length of the chromosome
public void print(java.lang.String nFile)
Prints the gene
nFile
- Name of the file to write the genepublic java.lang.String print()
Gets the genes of the variable