public final class SingleThreadedFlatBitSetFrame extends Object implements BitSetFrame
BitSetFrame.Bits| Modifier and Type | Field and Description |
|---|---|
static long |
ALL_ONES |
NOT_FOUND| Constructor and Description |
|---|
SingleThreadedFlatBitSetFrame(long logicalSize)
Creates a new
SingleThreadedFlatBitSetFrame of the given logical size |
| Modifier and Type | Method and Description |
|---|---|
BitSetAlgorithm |
algorithm() |
<T> long |
cardinality(Access<T> access,
T handle,
long offset)
Returns the number of bits set to
true in the bit set. |
<T> void |
clear(Access<T> access,
T handle,
long offset,
long bitIndex)
Sets the bit specified by the index to
false. |
<T> void |
clearAll(Access<T> access,
T handle,
long offset)
Equivalent to
clearRange(0, logicalSize()). |
<T> boolean |
clearIfSet(Access<T> access,
T handle,
long offset,
long bitIndex)
Clears the bit at the specified index (sets it to
false). |
<T> long |
clearNextNContinuousSetBits(Access<T> access,
T handle,
long offset,
long fromIndex,
int numberOfBits)
Finds the next
numberOfBits consecutive bits set to true,
starting from the specified fromIndex. |
<T> long |
clearNextSetBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Finds and clears the first bit that is set to
true
that occurs on or after the specified starting index. |
<T> long |
clearPreviousNContinuousSetBits(Access<T> access,
T handle,
long offset,
long fromIndex,
int numberOfBits)
Finds the previous
numberOfBits consecutive bits
set to true, starting from the specified fromIndex. |
<T> long |
clearPreviousSetBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Finds and clears the nearest bit that is set to
true
that occurs on or before the specified starting index. |
<T> void |
clearRange(Access<T> access,
T handle,
long offset,
long fromIndex,
long exclusiveToIndex)
Sets the bits from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to false. |
<T> void |
flip(Access<T> access,
T handle,
long offset,
long bitIndex)
Sets the bit at the specified index to the complement of its
current value.
|
<T> void |
flipRange(Access<T> access,
T handle,
long offset,
long fromIndex,
long exclusiveToIndex)
Sets each bit from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to the complement of its current
value. |
<T> boolean |
get(Access<T> access,
T handle,
long offset,
long bitIndex)
Returns the value of the bit with the specified index.
|
<T> boolean |
isRangeClear(Access<T> access,
T handle,
long offset,
long fromIndex,
long exclusiveToIndex)
Checks if each bit from the specified
fromIndex (inclusive) to the specified exclusiveToIndex is set to false. |
<T> boolean |
isRangeSet(Access<T> access,
T handle,
long offset,
long fromIndex,
long exclusiveToIndex)
Checks if each bit from the specified
fromIndex (inclusive) to the specified exclusiveToIndex is set to true. |
long |
logicalSize()
Number of bits in this frame.
|
<T> long |
nextClearBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Returns the index of the first bit that is set to
false
that occurs on or after the specified starting index. |
<T> long |
nextSetBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Returns the index of the first bit that is set to
true
that occurs on or after the specified starting index. |
<T> long |
previousClearBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Returns the index of the nearest bit that is set to
false
that occurs on or before the specified starting index. |
<T> long |
previousSetBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Returns the index of the nearest bit that is set to
true
that occurs on or before the specified starting index. |
<T> void |
set(Access<T> access,
T handle,
long offset,
long bitIndex)
Sets the bit at the specified index to
true. |
<T> void |
setAll(Access<T> access,
T handle,
long offset)
Equivalent to
setRange(0, logicalSize()). |
BitSetFrame.Bits |
setBits()
Returns an iteration of set bits in direct order
(from 0 to the end of the bit set).
|
<T> boolean |
setIfClear(Access<T> access,
T handle,
long offset,
long bitIndex)
Sets the bit at the specified index to
true. |
<T> long |
setNextClearBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Finds and sets to
true the first bit that is set to false
that occurs on or after the specified starting index. |
<T> long |
setNextNContinuousClearBits(Access<T> access,
T handle,
long offset,
long fromIndex,
int numberOfBits)
Finds the next
numberOfBits consecutive bits set to false,
starting from the specified fromIndex. |
<T> long |
setPreviousClearBit(Access<T> access,
T handle,
long offset,
long fromIndex)
Finds and sets to
true the nearest bit that is set
to false that occurs on or before the specified starting index. |
<T> long |
setPreviousNContinuousClearBits(Access<T> access,
T handle,
long offset,
long fromIndex,
int numberOfBits)
Finds the previous
numberOfBits consecutive bits
set to false, starting from the specified fromIndex. |
<T> void |
setRange(Access<T> access,
T handle,
long offset,
long fromIndex,
long exclusiveToIndex)
Sets the bits from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to true. |
long |
sizeInBytes()
Number of bytes taken by this frame.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisClear, isSet, set, setRangepublic static final long ALL_ONES
public SingleThreadedFlatBitSetFrame(long logicalSize)
SingleThreadedFlatBitSetFrame of the given logical sizelogicalSize - the logical bit set size, should be long-aligned
(i. e. a multiple of 8)IllegalArgumentException - is the given logicalSize is not a multiple of 8
or non-positivepublic <T> void flip(Access<T> access, T handle, long offset, long bitIndex)
BitSetFrameflip in interface BitSetFramebitIndex - the index of the bit to flippublic <T> void flipRange(Access<T> access, T handle, long offset, long fromIndex, long exclusiveToIndex)
BitSetFramefromIndex (inclusive) to the
specified toIndex (exclusive) to the complement of its current
value.flipRange in interface BitSetFramefromIndex - index of the first bit to flipexclusiveToIndex - index after the last bit to flippublic <T> void set(Access<T> access, T handle, long offset, long bitIndex)
BitSetFrametrue.set in interface BitSetFramebitIndex - the bit indexpublic <T> boolean setIfClear(Access<T> access, T handle, long offset, long bitIndex)
BitSetFrametrue.setIfClear in interface BitSetFramebitIndex - the bit indextrue if the bit was zeroOut, or false if the bit was already setpublic <T> void setRange(Access<T> access, T handle, long offset, long fromIndex, long exclusiveToIndex)
BitSetFramefromIndex (inclusive) to the
specified toIndex (exclusive) to true.setRange in interface BitSetFramefromIndex - index of the first bit to be setexclusiveToIndex - index after the last bit to be setpublic <T> void setAll(Access<T> access, T handle, long offset)
BitSetFramesetRange(0, logicalSize()).setAll in interface BitSetFramepublic <T> void clear(Access<T> access, T handle, long offset, long bitIndex)
BitSetFramefalse.clear in interface BitSetFramebitIndex - the index of the bit to be clearedpublic <T> boolean clearIfSet(Access<T> access, T handle, long offset, long bitIndex)
BitSetFramefalse).clearIfSet in interface BitSetFramebitIndex - a bit indexpublic <T> void clearRange(Access<T> access, T handle, long offset, long fromIndex, long exclusiveToIndex)
BitSetFramefromIndex (inclusive) to the
specified toIndex (exclusive) to false.clearRange in interface BitSetFramefromIndex - index of the first bit to be clearedexclusiveToIndex - index after the last bit to be clearedpublic <T> boolean isRangeSet(Access<T> access, T handle, long offset, long fromIndex, long exclusiveToIndex)
BitSetFramefromIndex (inclusive) to the specified exclusiveToIndex is set to true.isRangeSet in interface BitSetFramefromIndex - index of the first bit to checkexclusiveToIndex - index after the last bit to checktrue if all bits in the specified range are set to true,
false otherwisepublic <T> boolean isRangeClear(Access<T> access, T handle, long offset, long fromIndex, long exclusiveToIndex)
BitSetFramefromIndex (inclusive) to the specified exclusiveToIndex is set to false.isRangeClear in interface BitSetFramefromIndex - index of the first bit to checkexclusiveToIndex - index after the last bit to checktrue if all bits in the specified range are set to false,
false otherwisepublic <T> void clearAll(Access<T> access, T handle, long offset)
BitSetFrameclearRange(0, logicalSize()).clearAll in interface BitSetFramepublic <T> boolean get(Access<T> access, T handle, long offset, long bitIndex)
BitSetFrametrue if the bit with the index bitIndex
is currently set in this DirectBitSet; otherwise, the result
is false.get in interface BitSetFramebitIndex - the bit indexpublic <T> long nextSetBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFrametrue
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.nextSetBit in interface BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.clearNextSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public BitSetFrame.Bits setBits()
BitSetFramesetBits in interface BitSetFramepublic BitSetAlgorithm algorithm()
algorithm in interface BitSetFramepublic <T> long clearNextSetBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFrametrue
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.clearNextSetBit in interface BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.nextSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public <T> long nextClearBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFramefalse
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.nextClearBit in interface BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.setNextClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public <T> long setNextClearBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFrametrue 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 BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.nextClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public <T> long previousSetBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFrametrue
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.previousSetBit in interface BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.clearPreviousSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public <T> long clearPreviousSetBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFrametrue
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 BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.previousSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public <T> long previousClearBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFramefalse
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 BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.setPreviousClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public <T> long setPreviousClearBit(Access<T> access, T handle, long offset, long fromIndex)
BitSetFrametrue 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 BitSetFramefromIndex - the index to start checking from (inclusive)-1 if there is no such bitBitSetFrame.previousClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)public long logicalSize()
BitSetFramelogicalSize() - 1.logicalSize in interface BitSetFramepublic long sizeInBytes()
BitSetFramesizeInBytes in interface BitSetFramepublic <T> long cardinality(Access<T> access, T handle, long offset)
BitSetFrametrue in the bit set.cardinality in interface BitSetFramepublic <T> long setNextNContinuousClearBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
BitSetFramenumberOfBits 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 BitSetFramefromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous clear bits to search and set-1 if there is no such rangeIllegalArgumentException - if numberOfBits is negativepublic <T> long clearNextNContinuousSetBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
BitSetFramenumberOfBits 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 BitSetFramefromIndex - 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 rangeIllegalArgumentException - if numberOfBits is out of range 0 <
numberOfBits && numberOfBits <= 64public <T> long setPreviousNContinuousClearBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
BitSetFramenumberOfBits 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 BitSetFramefromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous clear bits to search and set-1 if there is no such rangepublic <T> long clearPreviousNContinuousSetBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
BitSetFramenumberOfBits 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 BitSetFramefromIndex - 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 rangeCopyright © 2022. All rights reserved.