|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.util.BitArray
public final class BitArray
Bit array that grows when needed. The implementation is similar to
BitSet
.
Constructor Summary | |
---|---|
BitArray()
Construct a new bit array. |
|
BitArray(int n)
Construct a new bit array with the specified number of bits. |
|
BitArray(long[] a,
int l)
Construct a new bit array with the specified backing array. |
Method Summary | |
---|---|
int |
cardinality()
Returns the number of bits set to true . |
void |
clear(int i)
Set the ith bit to 0. |
boolean |
get(int i)
Get the value of the ith bit. |
void |
init()
Initialize the bit array with an empty array. |
void |
init(long[] a,
int l)
Initialize the bit array with the specified backing array. |
int |
nextFree(int i)
Get the next bit set to 0, starting from the ith bit. |
int |
nextSet(int i)
Get the next bit set to 1, starting from the ith bit. |
void |
set(int i)
Set the ith bit to 1. |
long[] |
toArray()
The word array used to store the bits. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BitArray()
public BitArray(int n)
n
- initial number of bits (> 0)public BitArray(long[] a, int l)
a
- array with bitsl
- number of used bitsMethod Detail |
---|
public void init()
public void init(long[] a, int l)
a
- array with bitsl
- number of used bitspublic long[] toArray()
public int cardinality()
true
.
true
public boolean get(int i)
i
- index of the bit
true
if the ith bit is setpublic void set(int i)
i
- index of the bitpublic void clear(int i)
i
- index of the bitpublic int nextFree(int i)
i
- index from which to start the search (inclusive)
public int nextSet(int i)
i
- index from which to start the search (inclusive)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |