public interface BitSetFrame
| Modifier and Type | Interface and Description |
|---|---|
static interface |
BitSetFrame.Bits
An iteration of bits in a bit set.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
NOT_FOUND
Returned if no entry is found
|
| 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 toIndex)
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 toIndex)
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.
|
default <T> boolean |
isClear(Access<T> access,
T handle,
long offset,
long bitIndex)
Synonym of
!get(long). |
<T> boolean |
isRangeClear(Access<T> access,
T handle,
long offset,
long fromIndex,
long toIndex)
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 toIndex)
Checks if each bit from the specified
fromIndex (inclusive) to the specified exclusiveToIndex is set to true. |
default <T> boolean |
isSet(Access<T> access,
T handle,
long offset,
long bitIndex)
Synonym of
#get). |
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. |
default <T> void |
set(Access<T> access,
T handle,
long offset,
long bitIndex,
boolean value)
Sets the bit at the specified index to the specified value.
|
<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 toIndex)
Sets the bits from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to true. |
default <T> void |
setRange(Access<T> access,
T handle,
long offset,
long fromIndex,
long toIndex,
boolean value)
Sets the bits from the specified
fromIndex (inclusive) to the
specified toIndex (exclusive) to the specified value. |
long |
sizeInBytes()
Number of bytes taken by this frame.
|
static final long NOT_FOUND
<T> void flip(Access<T> access, T handle, long offset, long bitIndex)
bitIndex - the index of the bit to flip<T> void flipRange(Access<T> access, T handle, long offset, long fromIndex, long toIndex)
fromIndex (inclusive) to the
specified toIndex (exclusive) to the complement of its current
value.fromIndex - index of the first bit to fliptoIndex - index after the last bit to flip<T> void set(Access<T> access, T handle, long offset, long bitIndex)
true.bitIndex - the bit index<T> boolean setIfClear(Access<T> access, T handle, long offset, long bitIndex)
true.bitIndex - the bit indextrue if the bit was zeroOut, or false if the bit was already set<T> boolean clearIfSet(Access<T> access, T handle, long offset, long bitIndex)
false).bitIndex - a bit indexdefault <T> void set(Access<T> access, T handle, long offset, long bitIndex, boolean value)
bitIndex - the bit indexvalue - the boolean value to set<T> void setRange(Access<T> access, T handle, long offset, long fromIndex, long toIndex)
fromIndex (inclusive) to the
specified toIndex (exclusive) to true.fromIndex - index of the first bit to be settoIndex - index after the last bit to be set<T> void setAll(Access<T> access, T handle, long offset)
setRange(0, logicalSize()).default <T> void setRange(Access<T> access, T handle, long offset, long fromIndex, long toIndex, boolean value)
fromIndex (inclusive) to the
specified toIndex (exclusive) to the specified value.fromIndex - index of the first bit to be settoIndex - index after the last bit to be setvalue - value to set the selected bits to<T> void clear(Access<T> access, T handle, long offset, long bitIndex)
false.bitIndex - the index of the bit to be cleared<T> void clearRange(Access<T> access, T handle, long offset, long fromIndex, long toIndex)
fromIndex (inclusive) to the
specified toIndex (exclusive) to false.fromIndex - index of the first bit to be clearedtoIndex - index after the last bit to be cleared<T> void clearAll(Access<T> access, T handle, long offset)
clearRange(0, logicalSize()).<T> boolean get(Access<T> access, T handle, long offset, long bitIndex)
true if the bit with the index bitIndex
is currently set in this DirectBitSet; otherwise, the result
is false.bitIndex - the bit indexdefault <T> boolean isSet(Access<T> access, T handle, long offset, long bitIndex)
#get).bitIndex - the bit index<T> boolean isRangeSet(Access<T> access, T handle, long offset, long fromIndex, long toIndex)
fromIndex (inclusive) to the specified exclusiveToIndex is set to true.fromIndex - index of the first bit to checktoIndex - index after the last bit to checktrue if all bits in the specified range are set to true,
false otherwisedefault <T> boolean isClear(Access<T> access, T handle, long offset, long bitIndex)
!get(long).bitIndex - the bit indextrue is the bit at the specified index is clear in this
bit set; if the bit is set to true then returns false<T> boolean isRangeClear(Access<T> access, T handle, long offset, long fromIndex, long toIndex)
fromIndex (inclusive) to the specified exclusiveToIndex is set to false.fromIndex - index of the first bit to checktoIndex - index after the last bit to checktrue if all bits in the specified range are set to false,
false otherwise<T> long nextSetBit(Access<T> access, T handle, long offset, long fromIndex)
true
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitclearNextSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long nextClearBit(Access<T> access, T handle, long offset, long fromIndex)
false
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitsetNextClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long previousSetBit(Access<T> access, T handle, long offset, long fromIndex)
true
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.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitclearPreviousSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long previousClearBit(Access<T> access, T handle, long offset, long fromIndex)
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.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitsetPreviousClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)long logicalSize()
logicalSize() - 1.long sizeInBytes()
<T> long cardinality(Access<T> access, T handle, long offset)
true in the bit set.<T> long setNextClearBit(Access<T> access, T handle, long offset, long fromIndex)
true 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.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitnextClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long clearNextSetBit(Access<T> access, T handle, long offset, long fromIndex)
true
that occurs on or after the specified starting index. If no such
bit exists then -1 is returned.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitnextSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long setPreviousClearBit(Access<T> access, T handle, long offset, long fromIndex)
true 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.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitpreviousClearBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long clearPreviousSetBit(Access<T> access, T handle, long offset, long fromIndex)
true
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.fromIndex - the index to start checking from (inclusive)-1 if there is no such bitpreviousSetBit(net.openhft.chronicle.algo.bytes.Access<T>, T, long, long)<T> long setNextNContinuousClearBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
numberOfBits 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).
fromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous clear bits to search and set-1 if there is no such rangeIndexOutOfBoundsException - if fromIndex is negativeIllegalArgumentException - if numberOfBits <= 0<T> long clearNextNContinuousSetBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
numberOfBits 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).
fromIndex - 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 rangeIndexOutOfBoundsException - if fromIndex is negativeIllegalArgumentException - if numberOfBits <= 0<T> long setPreviousNContinuousClearBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
numberOfBits 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).
fromIndex - the index to start checking from (inclusive)numberOfBits - how many continuous clear bits to search and set-1 if there is no such rangeIndexOutOfBoundsException - if fromIndex is less
than -1IllegalArgumentException - if numberOfBits <= 0<T> long clearPreviousNContinuousSetBits(Access<T> access, T handle, long offset, long fromIndex, int numberOfBits)
numberOfBits 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).
fromIndex - 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 rangeIndexOutOfBoundsException - if fromIndex is less
than -1IllegalArgumentException - if numberOfBits <= 0BitSetFrame.Bits setBits()
BitSetAlgorithm algorithm()
Copyright © 2018. All rights reserved.