public class BinaryReal extends Binary
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_PRECISION
Defines the default number of bits used for binary coded variables.
|
bits_, numberOfBits_
Constructor and Description |
---|
BinaryReal()
Constructor.
|
BinaryReal(BinaryReal variable)
Copy constructor
|
BinaryReal(int numberOfBits,
double lowerBound,
double upperBound)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
decode()
Decodes the real value encoded in the binary string represented
by the
BinaryReal object. |
Variable |
deepCopy()
Creates an exact copy of a
BinaryReal object. |
double |
getLowerBound()
Returns the lower bound of the variable.
|
double |
getUpperBound()
Returns the upper bound of the variable.
|
double |
getValue()
Returns the double value of the variable.
|
void |
setLowerBound(double lowerBound)
Sets the lower bound of the variable.
|
void |
setUpperBound(double upperBound)
Sets the upper bound of the variable.
|
java.lang.String |
toString()
Returns a string representing the object.
|
getIth, getNumberOfBits, hammingDistance, setIth
getVariableType, setValue
public static final int DEFAULT_PRECISION
public BinaryReal()
public BinaryReal(int numberOfBits, double lowerBound, double upperBound)
numberOfBits
- Length of the binary string.lowerBound
- The lower limit for the variableupperBound
- The upper limit for the variable.public BinaryReal(BinaryReal variable)
variable
- The variable to copypublic void decode()
BinaryReal
object. The decoded value is stores in the
value_
field and can be accessed by the method
getValue
.public double getValue()
public Variable deepCopy()
BinaryReal
object.public double getLowerBound()
getLowerBound
in class Variable
public void setLowerBound(double lowerBound)
setLowerBound
in class Variable
lowerBound
- the lower bound.public double getUpperBound()
getUpperBound
in class Variable
public void setUpperBound(double upperBound)
setUpperBound
in class Variable
upperBound
- the upper bound.