public final class HugeBitSet
extends java.lang.Object
Note that the maximum size of a HugeBitSet is 2**32 - 1 bits.
| Constructor and Description |
|---|
HugeBitSet() |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear all the bits in the HugeBitSet.
|
boolean |
clear(int index)
Clear the specified bit in the HugeBitSet.
|
boolean |
get(int index)
Test if the specified bit is set in the HugeBitSet.
|
boolean |
isSet(int index)
Test if the specified bit is set in the HugeBitSet.
|
void |
justSet(int index)
Set the specified bit in the HugeBitSet without returning the former state.
|
int |
length()
Get the maximum number of bits currently allocated in this HugeBitSet.
|
int |
nextClearBit(int index)
Returns the index of the first bit that is set to
false
that occurs on or after the specified starting index. |
int |
nextSetBit(int index)
Returns the index of the first bit that is set to
true
that occurs on or after the specified starting index. |
int |
previousClearBit(int index)
Returns the index of the first bit that is set to
false
that occurs on or prior the specified starting index. |
int |
previousSetBit(int index)
Returns the index of the first bit that is set to
true
that occurs on or before the specified starting index. |
boolean |
set(int index)
Set the specified bit in the HugeBitSet.
|
java.lang.String |
toString()
Generate a String describing this HugeBitSet.
|
public boolean set(int index)
index - zero-based int index of the bit to setpublic void justSet(int index)
index - zero-based int index of the bit to setpublic boolean clear(int index)
index - zero-based int index of the bit to setpublic void clear()
public boolean get(int index)
index - zero-based index of bit to testpublic boolean isSet(int index)
index - zero-based index of bit to testpublic java.lang.String toString()
toString in class java.lang.Objectpublic int length()
public int nextSetBit(int index)
true
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.
To iterate over the true bits in a BitSet,
use the following loop:
for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
// operate on index i here
}index - the index to start checking from (inclusive).java.lang.IndexOutOfBoundsException - if the specified index is negative.public int nextClearBit(int index)
false
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.
To iterate over the false bits in a BitSet,
use the following loop:
for (int i = bs.nextClearBit(0); i >= 0; i = bs.nextClearBit(i+1)) {
// operate on index i here
}index - the index to start checking from (inclusive).java.lang.IndexOutOfBoundsException - if the specified index is negative.public int previousSetBit(int index)
true
that occurs on or before the specified starting index. If no such
bit exists then -1 is returned.
To iterate over the true bits in a BitSet,
use the following loop:
for (int i = bs.previousSetBit(Integer.MAX_VALUE); i >= 0; i = bs.previousSetBit(i-1)) {
// operate on index i here
}index - the index to start checking from (inclusive).java.lang.IndexOutOfBoundsException - if the specified index is negative.public int previousClearBit(int index)
false
that occurs on or prior the specified starting index. If no such
bit exists then -1 is returned.
To iterate over the false bits in a BitSet,
use the following loop:
for (int i = bs.previousClearBit(Integer.MAX_VALUE); i >= 0; i = bs.previousClearBit(i+1)) {
// operate on index i here
}index - the index to start checking from (inclusive).java.lang.IndexOutOfBoundsException - if the specified index is negative.