public class FastRankRoaringBitmap extends RoaringBitmap
RoaringBitmap
to provide better performance for .rank and .select
operations, at the cost of maintain a cache of cardinalities.
On RoaringBitmap.select(int)
and RoaringBitmap.rank(int)
operations,
RoaringBitmap
needs to iterate along all underlying buckets to cumulate their
cardinalities. This may lead to sub-optimal performance for application doing a large amount of
.rank/.select over read-only RoaringBitmap
, especially if the RoaringBitmap
holds
a large number of underlying buckets.
This implementation will discard the cache of cardinality on any write operations, and it will
memoize the computed cardinalities on any .rank or .select operationConstructor and Description |
---|
FastRankRoaringBitmap() |
Modifier and Type | Method and Description |
---|---|
void |
add(int... dat)
Set all the specified values to true.
|
void |
add(int x)
Add the value to the container (set the value to "true"), whether it already appears or not.
|
void |
add(int rangeStart,
int rangeEnd)
Deprecated.
|
void |
add(long rangeStart,
long rangeEnd)
Add to the current bitmap all integers in [rangeStart,rangeEnd).
|
void |
and(RoaringBitmap x2)
In-place bitwise AND (intersection) operation.
|
void |
andNot(RoaringBitmap x2)
In-place bitwise ANDNOT (difference) operation.
|
boolean |
checkedAdd(int x)
Add the value to the container (set the value to "true"), whether it already appears or not.
|
boolean |
checkedRemove(int x)
If present remove the specified integer (effectively, sets its bit value to false)
|
void |
clear()
reset to an empty bitmap; result occupies as much space a newly created bitmap.
|
void |
flip(int x)
Add the value if it is not already present, otherwise remove it.
|
void |
flip(int rangeStart,
int rangeEnd)
Deprecated.
|
void |
flip(long rangeStart,
long rangeEnd)
Modifies the current bitmap by complementing the bits in the given range, from rangeStart
(inclusive) rangeEnd (exclusive).
|
void |
or(RoaringBitmap x2)
In-place bitwise OR (union) operation.
|
long |
rankLong(int x)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be
GetCardinality()).
|
void |
remove(int x)
If present remove the specified integer (effectively, sets its bit value to false)
|
void |
remove(int rangeStart,
int rangeEnd)
Deprecated.
|
void |
remove(long rangeStart,
long rangeEnd)
Remove from the current bitmap all integers in [rangeStart,rangeEnd).
|
int |
select(int j)
Return the jth value stored in this bitmap.
|
void |
xor(RoaringBitmap x2)
In-place bitwise XOR (symmetric difference) operation.
|
add, add, and, and, and, andCardinality, andNot, andNot, andNot, andNotCardinality, bitmapOf, bitmapOfUnordered, clone, contains, contains, deserialize, equals, first, flip, flip, forEach, getCardinality, getContainerPointer, getIntIterator, getLongCardinality, getLongSizeInBytes, getReverseIntIterator, getSizeInBytes, hashCode, hasRunCompression, intersects, isEmpty, isHammingSimilar, iterator, last, lazyor, lazyor, lazyorfromlazyinputs, limit, maximumSerializedSize, naivelazyor, or, or, or, or, or, orCardinality, rank, readExternal, remove, remove, removeRunCompression, repairAfterLazy, runOptimize, serialize, serializedSizeInBytes, toArray, toMutableRoaringBitmap, toString, trim, writeExternal, xor, xor, xor, xorCardinality
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
public void add(long rangeStart, long rangeEnd)
RoaringBitmap
add
in class RoaringBitmap
rangeStart
- inclusive beginning of rangerangeEnd
- exclusive ending of rangepublic void add(int x)
RoaringBitmap
Integer.compareUnsigned(int, int)
.
We order the numbers like 0, 1, ..., 2147483647, -2147483648, -2147483647,..., -1.add
in interface BitmapDataProvider
add
in class RoaringBitmap
x
- integer valuepublic void add(int... dat)
RoaringBitmap
add
in class RoaringBitmap
dat
- set values@Deprecated public void add(int rangeStart, int rangeEnd)
RoaringBitmap
add
in class RoaringBitmap
rangeStart
- inclusive beginning of rangerangeEnd
- exclusive ending of rangepublic void clear()
RoaringBitmap
clear
in class RoaringBitmap
public void flip(int x)
RoaringBitmap
flip
in class RoaringBitmap
x
- integer value@Deprecated public void flip(int rangeStart, int rangeEnd)
RoaringBitmap
flip
in class RoaringBitmap
rangeStart
- inclusive beginning of rangerangeEnd
- exclusive ending of rangepublic void flip(long rangeStart, long rangeEnd)
RoaringBitmap
flip
in class RoaringBitmap
rangeStart
- inclusive beginning of rangerangeEnd
- exclusive ending of rangepublic void and(RoaringBitmap x2)
RoaringBitmap
and
in class RoaringBitmap
x2
- other bitmappublic void andNot(RoaringBitmap x2)
RoaringBitmap
andNot
in class RoaringBitmap
x2
- other bitmap@Deprecated public void remove(int rangeStart, int rangeEnd)
RoaringBitmap
remove
in class RoaringBitmap
rangeStart
- inclusive beginning of rangerangeEnd
- exclusive ending of rangepublic void remove(int x)
RoaringBitmap
remove
in interface BitmapDataProvider
remove
in class RoaringBitmap
x
- integer value representing the index in a bitmappublic void remove(long rangeStart, long rangeEnd)
RoaringBitmap
remove
in class RoaringBitmap
rangeStart
- inclusive beginning of rangerangeEnd
- exclusive ending of rangepublic boolean checkedAdd(int x)
RoaringBitmap
checkedAdd
in class RoaringBitmap
x
- integer valuepublic boolean checkedRemove(int x)
RoaringBitmap
checkedRemove
in class RoaringBitmap
x
- integer value representing the index in a bitmappublic void or(RoaringBitmap x2)
RoaringBitmap
or
in class RoaringBitmap
x2
- other bitmappublic void xor(RoaringBitmap x2)
RoaringBitmap
xor
in class RoaringBitmap
x2
- other bitmappublic long rankLong(int x)
RoaringBitmap
rankLong
in interface ImmutableBitmapDataProvider
rankLong
in class RoaringBitmap
x
- upper limitpublic int select(int j)
RoaringBitmap
select
in interface ImmutableBitmapDataProvider
select
in class RoaringBitmap
j
- index of the valueCopyright © 2018. All rights reserved.