public class BitArray extends Object implements AutoCloseable
The direct bit set performs bitwise operations on a fixed count UnsafeHeapBytes instance.
Currently, all bytes are UnsafeHeapBytes, but theoretically UnsafeMappedBytes
could be used for durability as well.
| Modifier and Type | Method and Description |
|---|---|
static BitArray |
allocate(long bits)
Allocates a new direct bit set.
|
void |
close() |
BitArray |
copy()
Copies the bit set to a new memory address.
|
long |
count()
Returns the number of bits set in the bit set.
|
boolean |
get(long index)
Gets the bit at the given index.
|
BitArray |
resize(long size)
Resizes the bit array to a new count.
|
boolean |
set(long index)
Sets the bit at the given index.
|
long |
size()
Returns the total number of bits in the bit set.
|
String |
toString() |
public static BitArray allocate(long bits)
bits - The number of bits in the bit set.public boolean set(long index)
index - The index of the bit to set.public boolean get(long index)
index - The index of the bit to get.public long size()
public long count()
public BitArray resize(long size)
size - The new count.public BitArray copy()
public void close()
close in interface AutoCloseableCopyright © 2013–2018. All rights reserved.