public class Gene
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ANTECEDENT |
static int |
CONSEQUENT |
static int |
EQUAL |
static int |
MAJOR |
static int |
MINOR |
static int |
NOT_INVOLVED
It is used for representing and handling a Gene throughout the evolutionary learning
|
static int |
UNEQUAL |
Constructor and Description |
---|
Gene()
It creates a new gene
|
Modifier and Type | Method and Description |
---|---|
Gene |
copy()
It allows to clone correctly a gene
|
boolean |
equals(Gene g) |
int |
getActAs()
It returns whether a gene is involved in the chromosome being considered.
|
int |
getAttr() |
int |
getOperator()
It returns the operator used.
|
double |
getValue()
It returns the value stored in a gene
|
boolean |
isCover(int var,
double value) |
int |
randAct() |
int |
randOperatorNominal() |
int |
randOperatorNumeric() |
void |
setActAs(int ac)
It sets whether a gene is involved in the chromosome being considered.
|
void |
setAttr(int var) |
void |
setOperator(int operator)
It sets the type of operator used in a gene
|
void |
setValue(double value)
It sets the value stored in a gene
|
java.lang.String |
toString()
It returns a string representation of a gene
|
public static final int NOT_INVOLVED
It is used for representing and handling a Gene throughout the evolutionary learning
public static final int ANTECEDENT
public static final int CONSEQUENT
public static final int MINOR
public static final int MAJOR
public static final int EQUAL
public static final int UNEQUAL
public Gene copy()
It allows to clone correctly a gene
public int getActAs()
It returns whether a gene is involved in the chromosome being considered. In case it is involved, returns if it acts as antecedent or consequent
public void setActAs(int ac)
It sets whether a gene is involved in the chromosome being considered. In case it is involved, the user must specify if it acts as antecedent or consequent
ac
- The constant value indicating the "role" played by the genepublic boolean equals(Gene g)
public java.lang.String toString()
It returns a string representation of a gene
toString
in class java.lang.Object
public int getAttr()
public void setAttr(int var)
public int randAct()
public int randOperatorNumeric()
public int randOperatorNominal()
public boolean isCover(int var, double value)
public int getOperator()
It returns the operator used. In case it is numeric attribute, returns if it is mayor or minor than the value In case it is nominal attribute, returns if it equal or unequal respect to value
public void setOperator(int operator)
It sets the type of operator used in a gene
operator
- The value indicating the type operatorpublic double getValue()
It returns the value stored in a gene
public void setValue(double value)
It sets the value stored in a gene
value
- stored in a gene