public class Gene
extends java.lang.Object
This implementation uses integer values to store the genes values (only 0/1). It is used to store DNF rules, so that each variable can get more than one value at a time. Each gene is an array of integer values.
Constructor and Description |
---|
Gene(int length)
Create new instances of gene
|
Modifier and Type | Method and Description |
---|---|
int |
getGeneElem(int pos)
Retuns the value of the gene indicated
|
int |
getGeneLength()
Retuns the gene lenght of the chromosome
|
void |
NoTakeInitGene()
Initialise the variable which does not take part in the rule
|
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)
Create new instances of gene
length
- Number of possible values of the variablepublic void NoTakeInitGene()
Initialise the variable which does not take part in the rule
public int getGeneElem(int pos)
Retuns the value of the gene indicated
pos
- Position indicates a gene of a variablepublic void setGeneElem(int pos, int value)
Sets the value of the indicated gene of the chromosome
pos
- Position indicates a gene of a variablevalue
- The value to insert in the gene indicated in posicionpublic int getGeneLength()
Retuns the gene lenght of the chromosome
public void Print(java.lang.String nFile)
Prints the gene
nFile
- Files to write the chromosome