|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmetal.core.Variable
jmetal.encodings.variable.Binary
public class Binary
This class implements a generic binary string encodings.variable.It can be used as a base class other binary string based classes (e.g., binary coded integer or real variables).
Field Summary | |
---|---|
java.util.BitSet |
bits_
Stores the bits constituting the binary string. |
protected int |
numberOfBits_
Store the length of the binary string |
Constructor Summary | |
---|---|
Binary()
Default constructor. |
|
Binary(Binary variable)
Copy constructor. |
|
Binary(int numberOfBits)
Constructor |
Method Summary | |
---|---|
void |
decode()
This method is intended to be used in subclass of Binary ,
for examples the classes, BinaryReal and BinaryInt |
Variable |
deepCopy()
Creates an exact copy of a Binary object |
boolean |
getIth(int bit)
Returns the value of the ith bit. |
int |
getNumberOfBits()
Returns the length of the binary string. |
int |
hammingDistance(Binary other)
Obtain the hamming distance between two binary strings |
void |
setIth(int bit,
boolean value)
Sets the value of the ith bit. |
java.lang.String |
toString()
|
Methods inherited from class jmetal.core.Variable |
---|
getLowerBound, getUpperBound, getValue, getVariableType, setLowerBound, setUpperBound, setValue |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.util.BitSet bits_
protected int numberOfBits_
Constructor Detail |
---|
public Binary()
public Binary(int numberOfBits)
numberOfBits
- Length of the bit stringpublic Binary(Binary variable)
variable
- The Binary encodings.variable to copy.Method Detail |
---|
public void decode()
Binary
,
for examples the classes, BinaryReal
and BinaryInt.
In this classes, the method allows to decode the
value enconded in the binary string. As generic variables do not encode any
value, this method do noting
public Variable deepCopy()
deepCopy
in class Variable
public int getNumberOfBits()
public boolean getIth(int bit)
bit
- The bit to retrieve
public void setIth(int bit, boolean value)
bit
- The bit to setpublic int hammingDistance(Binary other)
other
- The binary string to compare
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |