Constructor and Description |
---|
BitArray()
Construct a new bit array.
|
BitArray(int capacity,
boolean set)
Construct a new bit array and an initial value.
|
BitArray(long[] a,
int l)
Construct a new bit array with the specified backing array.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
public BitArray()
public BitArray(int capacity, boolean set)
capacity
- initial number of bitsset
- sets or clears all valuespublic BitArray(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 bittrue
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)Copyright © 2005–2015 BaseX Team. All rights reserved.