Package org.roaringbitmap
Class RangeBitmap
java.lang.Object
org.roaringbitmap.RangeBitmap
A 2D bitmap which associates values with a row index and can perform range queries.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder for constructing immutable RangeBitmaps -
Method Summary
Modifier and TypeMethodDescriptionstatic RangeBitmap.Appender
appender(long maxValue)
Append values to the RangeBitmap before sealing it, defaults to on heap ByteBuffers.static RangeBitmap.Appender
appender(long maxValue, IntFunction<ByteBuffer> bufferSupplier, Consumer<ByteBuffer> cleaner)
Append values to the RangeBitmap before sealing it.between(long min, long max)
Returns a RoaringBitmap of rows which have a value in between the thresholds.long
betweenCardinality(long min, long max)
Returns the number of rows which have a value in between the thresholds.long
betweenCardinality(long min, long max, RoaringBitmap context)
Returns the number of rows which have a value in between the thresholds.gt(long threshold)
Returns a RoaringBitmap of rows which have a value greater than the threshold.gt(long threshold, RoaringBitmap context)
Returns a RoaringBitmap of rows which have a value greater than the threshold, and intersect with the context bitmap, which will not be modified.long
gtCardinality(long threshold)
Returns the number of rows which have a value greater than the threshold.long
gtCardinality(long threshold, RoaringBitmap context)
Returns the number of rows which have a value greater than the threshold, and intersect with the context bitmap, which will not be modified.gte(long threshold)
Returns a RoaringBitmap of rows which have a value greater than or equal to the threshold.gte(long threshold, RoaringBitmap context)
Returns a RoaringBitmap of rows which have a value greater than or equal to the threshold, and intersect with the context bitmap, which will not be modified.long
gteCardinality(long threshold)
Returns the number of rows which have a value greater than or equal to the threshold.long
gteCardinality(long threshold, RoaringBitmap context)
Returns the number of rows which have a value greater than or equal to the threshold, and intersect with the context bitmap, which will not be modified.lt(long threshold)
Returns a RoaringBitmap of rows which have a value less than the threshold.lt(long threshold, RoaringBitmap context)
Returns a RoaringBitmap of rows which have a value less than the threshold, and intersect with the context bitmap, which will not be modified.long
ltCardinality(long threshold)
Returns the number of rows which have a value less than the threshold.long
ltCardinality(long threshold, RoaringBitmap context)
Returns the number of rows which have a value less than the threshold, and intersect with the context bitmap, which will not be modified.lte(long threshold)
Returns a RoaringBitmap of rows which have a value less than or equal to the threshold.lte(long threshold, RoaringBitmap context)
Returns a RoaringBitmap of rows which have a value less than or equal to the threshold, and intersect with the context bitmap, which will not be modified.long
lteCardinality(long threshold)
Returns the number of rows which have a value less than or equal to the threshold.long
lteCardinality(long threshold, RoaringBitmap context)
Returns the number of rows which have a value less than or equal to the threshold, and intersect with the context bitmap, which will not be modified.static RangeBitmap
map(ByteBuffer buffer)
Maps the RangeBitmap from the buffer with minimal allocation.
-
Method Details
-
appender
public static RangeBitmap.Appender appender(long maxValue, IntFunction<ByteBuffer> bufferSupplier, Consumer<ByteBuffer> cleaner)Append values to the RangeBitmap before sealing it.- Parameters:
maxValue
- the maximum value to be appended, values larger than this value will be rejected.bufferSupplier
- provides ByteBuffers.- Returns:
- an appender.
-
appender
Append values to the RangeBitmap before sealing it, defaults to on heap ByteBuffers.- Parameters:
maxValue
- the maximum value to be appended, values larger than this value will be rejected.- Returns:
- an appender.
-
map
Maps the RangeBitmap from the buffer with minimal allocation. The buffer must not be reused while the mapped RangeBitmap is live.- Parameters:
buffer
- a buffer containing a serialized RangeBitmap.- Returns:
- a RangeBitmap backed by the buffer.
-
between
Returns a RoaringBitmap of rows which have a value in between the thresholds.- Parameters:
min
- the inclusive minimum value.max
- the inclusive maximum value.- Returns:
- a bitmap of matching rows.
-
betweenCardinality
public long betweenCardinality(long min, long max)Returns the number of rows which have a value in between the thresholds.- Parameters:
min
- the inclusive minimum value.max
- the inclusive maximum value.- Returns:
- the number of matching rows.
-
betweenCardinality
Returns the number of rows which have a value in between the thresholds.- Parameters:
min
- the inclusive minimum value.max
- the inclusive maximum value.context
- to be intersected with.- Returns:
- the number of matching rows.
-
lte
Returns a RoaringBitmap of rows which have a value less than or equal to the threshold.- Parameters:
threshold
- the inclusive maximum value.- Returns:
- a bitmap of matching rows.
-
lte
Returns a RoaringBitmap of rows which have a value less than or equal to the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the inclusive maximum value.context
- to be intersected with.- Returns:
- a bitmap of matching rows.
-
lteCardinality
public long lteCardinality(long threshold)Returns the number of rows which have a value less than or equal to the threshold.- Parameters:
threshold
- the inclusive maximum value.- Returns:
- the number of matching rows.
-
lteCardinality
Returns the number of rows which have a value less than or equal to the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the inclusive maximum value.context
- to be intersected with.- Returns:
- the number of matching rows.
-
lt
Returns a RoaringBitmap of rows which have a value less than the threshold.- Parameters:
threshold
- the exclusive maximum value.- Returns:
- a bitmap of matching rows.
-
lt
Returns a RoaringBitmap of rows which have a value less than the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the exclusive maximum value.context
- to be intersected with.- Returns:
- a bitmap of matching rows which intersect .
-
ltCardinality
public long ltCardinality(long threshold)Returns the number of rows which have a value less than the threshold.- Parameters:
threshold
- the exclusive maximum value.- Returns:
- the number of matching rows.
-
ltCardinality
Returns the number of rows which have a value less than the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the exclusive maximum value.context
- to be intersected with.- Returns:
- the number of matching rows which intersect .
-
gt
Returns a RoaringBitmap of rows which have a value greater than the threshold.- Parameters:
threshold
- the exclusive minimum value.- Returns:
- a bitmap of matching rows.
-
gt
Returns a RoaringBitmap of rows which have a value greater than the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the exclusive minimum value.context
- to be intersected with.- Returns:
- a bitmap of matching rows.
-
gtCardinality
public long gtCardinality(long threshold)Returns the number of rows which have a value greater than the threshold.- Parameters:
threshold
- the exclusive minimum value.- Returns:
- the number of matching rows.
-
gtCardinality
Returns the number of rows which have a value greater than the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the exclusive minimum value.context
- to be intersected with.- Returns:
- the number of matching rows.
-
gte
Returns a RoaringBitmap of rows which have a value greater than or equal to the threshold.- Parameters:
threshold
- the inclusive minimum value.- Returns:
- a bitmap of matching rows.
-
gte
Returns a RoaringBitmap of rows which have a value greater than or equal to the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the inclusive minimum value.context
- to be intersected with.- Returns:
- a bitmap of matching rows.
-
gteCardinality
public long gteCardinality(long threshold)Returns the number of rows which have a value greater than or equal to the threshold.- Parameters:
threshold
- the inclusive minimum value.- Returns:
- the number of matching rows.
-
gteCardinality
Returns the number of rows which have a value greater than or equal to the threshold, and intersect with the context bitmap, which will not be modified.- Parameters:
threshold
- the inclusive minimum value.context
- to be intersected with.- Returns:
- the number of matching rows.
-