|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.cilib.container.BitArray
public class BitArray
This class represents an array of bit values and is efficient as the values are packed together. Ideas for this class where taken from a C++ implementation.
Constructor Summary | |
---|---|
BitArray()
Create a BitArray with the initial number of bits
equal to 32. |
|
BitArray(BitArray copy)
Copy constructor. |
|
BitArray(int numberOfBits)
Create a BitArray with the initial number of bits specified
by the parameter numberOfBits . |
Method Summary | |
---|---|
void |
clear(int index)
Clear the bit (make it false) located at a specific index. |
boolean |
get(int index)
Return the state of the bit specified at index index . |
BitArray |
getClone()
Create a cloned copy of the current object and return it. |
int |
length()
This method returns the number of bits currently represented by the BitArray . |
void |
set(int index)
Sets the specified bit at index index to the true / on state. |
int |
size()
Returns the actual size used by the BitArray
The result returned will be the size + 1. |
double |
valueOf(int i,
int j)
Get the value of the bits between the provided indexes, i and j . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitArray()
BitArray
with the initial number of bits
equal to 32.
public BitArray(int numberOfBits)
BitArray
with the initial number of bits specified
by the parameter numberOfBits
.
numberOfBits
- The number of bits to set for this BitArray.public BitArray(BitArray copy)
copy
- The instance to copy.Method Detail |
---|
public BitArray getClone()
getClone
in interface Cloneable
Object.clone()
public boolean get(int index)
index
.
index
- The index of the specified bit.
index
.
IndexOutOfBoundsException
- If the specified index value is invalidpublic void set(int index)
index
to the true / on state.
index
- The index of the target bit
IndexOutOfBoundsException
- If the specified index value is invalidpublic void clear(int index)
index
- The index of the bit to be cleared.
IndexOutOfBoundsException
- If the specified index value is invalid.public int size()
BitArray
The result returned will be the size + 1.
public int length()
BitArray
. This is the "length" of the BitArray
BitArray
public double valueOf(int i, int j)
i
and j
.
i
- The start index.j
- The end index.
i
to j
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |