| Modifier and Type | Class and Description |
|---|---|
protected class |
ReusableBitSet.Bits |
| Modifier and Type | Field and Description |
|---|---|
protected Access |
access |
protected BitSetFrame |
frame |
protected Object |
handle |
protected long |
offset |
| Constructor and Description |
|---|
ReusableBitSet(BitSetFrame frame,
Access<T> access,
T handle,
long offset) |
| Modifier and Type | Method and Description |
|---|---|
long |
cardinality()
Returns the number of bits set to
true in this DirectBitSet. |
void |
clear(long bitIndex)
Sets the bit specified by the index to
false. |
void |
clearAll()
Sets all of the bits in this BitSet to
false. |
boolean |
clearIfSet(long bitIndex)
Clears the bit at the specified index (sets it to
false). |
long |
clearNextNContinuousSetBits(long fromIndex,
int numberOfBits)
Finds the next
numberOfBits consecutive bits set to true,
starting from the specified fromIndex. |
long |
clearNextSetBit(long fromIndex)
Finds and clears the first bit that is set to
true
that occurs on or after the specified starting index. |
long |
clearPreviousNContinuousSetBits(long fromIndex,
int numberOfBits)
Finds the previous
numberOfBits consecutive bits
set to true, starting from the specified fromIndex. |
long |
clearPreviousSetBit(long fromIndex)
Finds and clears the nearest bit that is set to
true
that occurs on or before the specified starting index. |
void |
clearRange(long fromIndex,
long toIndex)
Sets the bits from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to false. |
void |
flip(long bitIndex)
Sets the bit at the specified index to the complement of its
current value.
|
void |
flipRange(long fromIndex,
long toIndex)
Sets each bit from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to the complement of its current
value. |
boolean |
get(long bitIndex)
Returns the value of the bit with the specified index.
|
boolean |
isRangeClear(long fromIndex,
long toIndex) |
boolean |
isRangeSet(long fromIndex,
long toIndex) |
long |
logicalSize()
Returns the number of bits of space actually in use by this BitSet to represent bit values.
|
long |
nextClearBit(long fromIndex)
Returns the index of the first bit that is set to
false
that occurs on or after the specified starting index. |
long |
nextSetBit(long fromIndex)
Returns the index of the first bit that is set to
true
that occurs on or after the specified starting index. |
long |
previousClearBit(long fromIndex)
Returns the index of the nearest bit that is set to
false
that occurs on or before the specified starting index. |
long |
previousSetBit(long fromIndex)
Returns the index of the nearest bit that is set to
true
that occurs on or before the specified starting index. |
<T> ReusableBitSet |
reuse(BitSetFrame frame,
Access<T> access,
T handle,
long offset) |
void |
set(long bitIndex)
Sets the bit at the specified index to
true. |
void |
setAll()
Sets all bits,
bs.setAll() is equivalent
of bs.set(0, bs.size(). |
ReusableBitSet.Bits |
setBits()
Returns an iteration of set bits in direct order
(from 0 to the end of the bit set).
|
boolean |
setIfClear(long bitIndex)
Sets the bit at the specified index to
true. |
long |
setNextClearBit(long fromIndex)
Finds and sets to
true the first bit that is set to false
that occurs on or after the specified starting index. |
long |
setNextNContinuousClearBits(long fromIndex,
int numberOfBits)
Finds the next
numberOfBits consecutive bits set to false,
starting from the specified fromIndex. |
void |
setOffset(long offset) |
long |
setPreviousClearBit(long fromIndex)
Finds and sets to
true the nearest bit that is set
to false that occurs on or before the specified starting index. |
long |
setPreviousNContinuousClearBits(long fromIndex,
int numberOfBits)
Finds the previous
numberOfBits consecutive bits
set to false, starting from the specified fromIndex. |
void |
setRange(long fromIndex,
long toIndex)
Sets the bits from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to true. |
protected BitSetFrame frame
protected Access access
protected Object handle
protected long offset
public ReusableBitSet(BitSetFrame frame, Access<T> access, T handle, long offset)
public final <T> ReusableBitSet reuse(BitSetFrame frame, Access<T> access, T handle, long offset)
public void setOffset(long offset)
public void flip(long bitIndex)
BitSetpublic void flipRange(long fromIndex,
long toIndex)
BitSetfromIndex (inclusive) to the
specified toIndex (exclusive) to the complement of its current
value.public void set(long bitIndex)
BitSettrue.public boolean setIfClear(long bitIndex)
BitSettrue.setIfClear in interface BitSetbitIndex - a bit indexpublic boolean clearIfSet(long bitIndex)
BitSetfalse).clearIfSet in interface BitSetbitIndex - a bit indexpublic void setRange(long fromIndex,
long toIndex)
BitSetfromIndex (inclusive) to the
specified toIndex (exclusive) to true.public boolean isRangeSet(long fromIndex,
long toIndex)
isRangeSet in interface BitSetpublic void setAll()
BitSetbs.setAll() is equivalent
of bs.set(0, bs.size().public void clear(long bitIndex)
BitSetfalse.public void clearRange(long fromIndex,
long toIndex)
BitSetfromIndex (inclusive) to the
specified toIndex (exclusive) to false.clearRange in interface BitSetfromIndex - index of the first bit to be clearedtoIndex - index after the last bit to be clearedpublic boolean isRangeClear(long fromIndex,
long toIndex)
isRangeClear in interface BitSetpublic void clearAll()
BitSetfalse.public boolean get(long bitIndex)
BitSettrue if the bit with the index bitIndex
is currently set in this DirectBitSet; otherwise, the result
is false.public long nextSetBit(long fromIndex)
BitSettrue
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 DirectBitSet,
use the following loop:
for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
// operate on index i here
}nextSetBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there
is no such bitBitSet.clearNextSetBit(long)public long nextClearBit(long fromIndex)
BitSetfalse
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.nextClearBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSet.setNextClearBit(long)public long previousSetBit(long fromIndex)
BitSettrue
that occurs on or before the specified starting index.
If no such bit exists, or if -1 is given as the
starting index, then -1 is returned.
To iterate over the true bits in a DirectBitSet,
use the following loop:
for (int i = bs.size(); (i = bs.previousSetBit(i-1)) >= 0; ) {
// operate on index i here
}previousSetBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there
is no such bitBitSet.clearPreviousSetBit(long)public long previousClearBit(long fromIndex)
BitSetfalse
that occurs on or before the specified starting index.
If no such bit exists, or if -1 is given as the
starting index, then -1 is returned.previousClearBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there
is no such bitBitSet.setPreviousClearBit(long)public long logicalSize()
BitSetsize() - 1.logicalSize in interface BitSetpublic long cardinality()
BitSettrue in this DirectBitSet.cardinality in interface BitSettrue in this DirectBitSetpublic long setNextClearBit(long fromIndex)
BitSettrue the first bit that is set to false
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.setNextClearBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSet.nextClearBit(long)public long clearNextSetBit(long fromIndex)
BitSettrue
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.clearNextSetBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there
is no such bitBitSet.nextSetBit(long)public long setPreviousClearBit(long fromIndex)
BitSettrue the nearest bit that is set
to false that occurs on or before the specified starting index.
If no such bit exists, or if -1 is given as the
starting index, then -1 is returned.setPreviousClearBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there
is no such bitBitSet.previousClearBit(long)public long clearPreviousSetBit(long fromIndex)
BitSettrue
that occurs on or before the specified starting index.
If no such bit exists, or if -1 is given as the
starting index, then -1 is returned.clearPreviousSetBit in interface BitSetfromIndex - the index to start checking from (inclusive)-1 if there
is no such bitBitSet.previousSetBit(long)public long setNextNContinuousClearBits(long fromIndex,
int numberOfBits)
BitSetnumberOfBits consecutive bits set to false,
starting from the specified fromIndex. Then all bits of the found
range are set to true. The first index of the found block
is returned. If there is no such range of clear bits, -1
is returned.
fromIndex could be the first index of the found range, thus
setNextNContinuousClearBits(i, 1) is exact equivalent of
setNextClearBit(i).
setNextNContinuousClearBits in interface BitSetfromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous clear bits to search and set-1 if there is no such rangepublic long clearNextNContinuousSetBits(long fromIndex,
int numberOfBits)
BitSetnumberOfBits consecutive bits set to true,
starting from the specified fromIndex. Then all bits of the found
range are set to false. The first index of the found block
is returned. If there is no such range of true bits, -1
is returned.
fromIndex could be the first index of the found range, thus
clearNextNContinuousSetBits(i, 1) is exact equivalent of
clearNextSetBit(i).
clearNextNContinuousSetBits in interface BitSetfromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous set bits to search and cleartrue bits, or -1 if there is no such rangepublic long setPreviousNContinuousClearBits(long fromIndex,
int numberOfBits)
BitSetnumberOfBits consecutive bits
set to false, starting from the specified fromIndex.
Then all bits of the found range are set to true.
The first index of the found block is returned. If there is no such
range of clear bits, or if -1 is given as the starting index,
-1 is returned.
fromIndex could be the last index of the found range, thus
setPreviousNContinuousClearBits(i, 1) is exact equivalent of
setPreviousClearBit(i).
setPreviousNContinuousClearBits in interface BitSetfromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous clear bits to search and set-1 if there is no such rangepublic long clearPreviousNContinuousSetBits(long fromIndex,
int numberOfBits)
BitSetnumberOfBits consecutive bits
set to true, starting from the specified fromIndex.
Then all bits of the found range are set to false.
The first index of the found block is returned. If there is no such
range of true bits, or if -1 is given as the starting
index, -1 is returned.
fromIndex could be the last index of the found range, thus
clearPreviousNContinuousSetBits(i, 1) is exact equivalent of
clearPreviousSetBit(i).
clearPreviousNContinuousSetBits in interface BitSetfromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous set bits to search and cleartrue bits, or -1 if there is no such rangepublic ReusableBitSet.Bits setBits()
BitSetCopyright © 2018. All rights reserved.