java.lang.Object
org.bitlap.roaringbitmap.RoaringBitmap
org.bitlap.roaringbitmap.FastRankRoaringBitmap
- 所有已实现的接口:
Externalizable,Serializable,Cloneable,Iterable<Integer>,AppendableStorage<Container>,BitmapDataProvider,ImmutableBitmapDataProvider
This extends
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 operation- 另请参阅:
-
嵌套类概要
从接口继承的嵌套类/接口 org.bitlap.roaringbitmap.ImmutableBitmapDataProvider
ImmutableBitmapDataProvider.RoaringOfInt -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidadd(int x) Add the value to the container (set the value to "true"), whether it already appears or not.voidadd(int... dat) Set all the specified values to true.voidadd(int rangeStart, int rangeEnd) 已过时。voidadd(long rangeStart, long rangeEnd) Add to the current bitmap all integers in [rangeStart,rangeEnd).voidand(RoaringBitmap x2) In-place bitwise AND (intersection) operation.voidandNot(RoaringBitmap x2) In-place bitwise ANDNOT (difference) operation.booleancheckedAdd(int x) Add the value to the container (set the value to "true"), whether it already appears or not.booleancheckedRemove(int x) If present remove the specified integer (effectively, sets its bit value to false)voidclear()reset to an empty bitmap; result occupies as much space a newly created bitmap.voidflip(int x) Add the value if it is not already present, otherwise remove it.voidflip(int rangeStart, int rangeEnd) 已过时。voidflip(long rangeStart, long rangeEnd) Modifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).Get a special iterator that allows .peekNextRank efficientlylongEstimate of the memory usage of this data structure.voidor(RoaringBitmap x2) In-place bitwise OR (union) operation.longrankLong(int x) Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).voidremove(int x) If present remove the specified integer (effectively, sets its bit value to false)voidremove(int rangeStart, int rangeEnd) 已过时。voidremove(long rangeStart, long rangeEnd) Remove from the current bitmap all integers in [rangeStart,rangeEnd).intselect(int j) Return the jth value stored in this bitmap.voidxor(RoaringBitmap x2) In-place bitwise XOR (symmetric difference) operation.从类继承的方法 org.bitlap.roaringbitmap.RoaringBitmap
add, add, addN, addOffset, and, and, and, andCardinality, andNot, andNot, andNot, andNotCardinality, append, bitmapOf, bitmapOfRange, bitmapOfUnordered, cardinalityExceeds, clone, contains, contains, contains, deserialize, deserialize, deserialize, equals, first, flip, flip, forAllInRange, forEach, forEachInRange, getBatchIterator, getCardinality, getContainerPointer, getHighLowContainer, getIntIterator, getLongCardinality, getReverseIntIterator, getSizeInBytes, hashCode, hasRunCompression, intersects, intersects, isEmpty, isHammingSimilar, iterator, last, lazyor, lazyor, lazyorfromlazyinputs, limit, maximumSerializedSize, naivelazyor, nextAbsentValue, nextValue, or, or, or, or, or, orCardinality, orNot, orNot, previousAbsentValue, previousValue, rangeCardinality, rank, readExternal, remove, remove, removeRunCompression, repairAfterLazy, runOptimize, serialize, serialize, serializedSizeInBytes, toArray, toMutableRoaringBitmap, toString, trim, writeExternal, xor, xor, xor, xorCardinality从接口继承的方法 org.bitlap.roaringbitmap.ImmutableBitmapDataProvider
reverseStream, stream从接口继承的方法 java.lang.Iterable
forEach, spliterator
-
构造器详细资料
-
FastRankRoaringBitmap
public FastRankRoaringBitmap() -
FastRankRoaringBitmap
-
-
方法详细资料
-
add
public void add(long rangeStart, long rangeEnd) 从类复制的说明:RoaringBitmapAdd to the current bitmap all integers in [rangeStart,rangeEnd).- 指定者:
add在接口中BitmapDataProvider- 覆盖:
add在类中RoaringBitmap- 参数:
rangeStart- inclusive beginning of rangerangeEnd- exclusive ending of range
-
add
public void add(int x) 从类复制的说明:RoaringBitmapAdd the value to the container (set the value to "true"), whether it already appears or not. Java lacks native unsigned integers but the x argument is considered to be unsigned. Within bitmaps, numbers are ordered according toInteger.compareUnsigned(int, int). We order the numbers like 0, 1, ..., 2147483647, -2147483648, -2147483647,..., -1.- 指定者:
add在接口中BitmapDataProvider- 覆盖:
add在类中RoaringBitmap- 参数:
x- integer value
-
add
public void add(int... dat) 从类复制的说明:RoaringBitmapSet all the specified values to true. This can be expected to be slightly faster than calling "add" repeatedly. The provided integers values don't have to be in sorted order, but it may be preferable to sort them from a performance point of view.- 覆盖:
add在类中RoaringBitmap- 参数:
dat- set values
-
add
已过时。从类复制的说明:RoaringBitmapAdd to the current bitmap all integers in [rangeStart,rangeEnd).- 覆盖:
add在类中RoaringBitmap- 参数:
rangeStart- inclusive beginning of rangerangeEnd- exclusive ending of range
-
clear
public void clear()从类复制的说明:RoaringBitmapreset to an empty bitmap; result occupies as much space a newly created bitmap.- 覆盖:
clear在类中RoaringBitmap
-
flip
public void flip(int x) 从类复制的说明:RoaringBitmapAdd the value if it is not already present, otherwise remove it.- 覆盖:
flip在类中RoaringBitmap- 参数:
x- integer value
-
flip
已过时。从类复制的说明:RoaringBitmapModifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).- 覆盖:
flip在类中RoaringBitmap- 参数:
rangeStart- inclusive beginning of rangerangeEnd- exclusive ending of range
-
flip
public void flip(long rangeStart, long rangeEnd) 从类复制的说明:RoaringBitmapModifies the current bitmap by complementing the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).- 覆盖:
flip在类中RoaringBitmap- 参数:
rangeStart- inclusive beginning of rangerangeEnd- exclusive ending of range
-
and
从类复制的说明:RoaringBitmapIn-place bitwise AND (intersection) operation. The current bitmap is modified.- 覆盖:
and在类中RoaringBitmap- 参数:
x2- other bitmap
-
andNot
从类复制的说明:RoaringBitmapIn-place bitwise ANDNOT (difference) operation. The current bitmap is modified.- 覆盖:
andNot在类中RoaringBitmap- 参数:
x2- other bitmap
-
remove
已过时。从类复制的说明:RoaringBitmapRemove from the current bitmap all integers in [rangeStart,rangeEnd).- 覆盖:
remove在类中RoaringBitmap- 参数:
rangeStart- inclusive beginning of rangerangeEnd- exclusive ending of range
-
remove
public void remove(int x) 从类复制的说明:RoaringBitmapIf present remove the specified integer (effectively, sets its bit value to false)- 指定者:
remove在接口中BitmapDataProvider- 覆盖:
remove在类中RoaringBitmap- 参数:
x- integer value representing the index in a bitmap
-
remove
public void remove(long rangeStart, long rangeEnd) 从类复制的说明:RoaringBitmapRemove from the current bitmap all integers in [rangeStart,rangeEnd).- 覆盖:
remove在类中RoaringBitmap- 参数:
rangeStart- inclusive beginning of rangerangeEnd- exclusive ending of range
-
checkedAdd
public boolean checkedAdd(int x) 从类复制的说明:RoaringBitmapAdd the value to the container (set the value to "true"), whether it already appears or not.- 覆盖:
checkedAdd在类中RoaringBitmap- 参数:
x- integer value- 返回:
- true if the added int wasn't already contained in the bitmap. False otherwise.
-
checkedRemove
public boolean checkedRemove(int x) 从类复制的说明:RoaringBitmapIf present remove the specified integer (effectively, sets its bit value to false)- 覆盖:
checkedRemove在类中RoaringBitmap- 参数:
x- integer value representing the index in a bitmap- 返回:
- true if the unset bit was already in the bitmap
-
or
从类复制的说明:RoaringBitmapIn-place bitwise OR (union) operation. The current bitmap is modified.- 覆盖:
or在类中RoaringBitmap- 参数:
x2- other bitmap
-
xor
从类复制的说明:RoaringBitmapIn-place bitwise XOR (symmetric difference) operation. The current bitmap is modified.- 覆盖:
xor在类中RoaringBitmap- 参数:
x2- other bitmap
-
rankLong
public long rankLong(int x) 从类复制的说明:RoaringBitmapRank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()). If you provide the smallest value as a parameter, this function will return 1. If provide a value smaller than the smallest value, it will return 0.- 指定者:
rankLong在接口中ImmutableBitmapDataProvider- 覆盖:
rankLong在类中RoaringBitmap- 参数:
x- upper limit- 返回:
- the rank
- 另请参阅:
-
select
public int select(int j) 从类复制的说明:RoaringBitmapReturn the jth value stored in this bitmap. The provided value needs to be smaller than the cardinality otherwise an IllegalArgumentException exception is thrown. The smallest value is at index 0. Note that this function differs in convention from the rank function which returns 1 when ranking the smallest value.- 指定者:
select在接口中ImmutableBitmapDataProvider- 覆盖:
select在类中RoaringBitmap- 参数:
j- index of the value- 返回:
- the value
- 另请参阅:
-
getLongSizeInBytes
public long getLongSizeInBytes()从类复制的说明:RoaringBitmapEstimate of the memory usage of this data structure. This can be expected to be within 1% of the true memory usage in common usage scenarios. If exact measures are needed, we recommend using dedicated libraries such as ehcache-sizeofengine. In adversarial cases, this estimate may be 10x the actual memory usage. For example, if you insert a single random value in a bitmap, then over a 100 bytes may be used by the JVM whereas this function may return an estimate of 32 bytes. The same will be true in the "sparse" scenario where you have a small set of random-looking integers spanning a wide range of values. These are considered adversarial cases because, as a general rule, if your data looks like a set of random integers, Roaring bitmaps are probably not the right data structure. Note that you can serialize your Roaring Bitmaps to disk and then construct ImmutableRoaringBitmap instances from a ByteBuffer. In such cases, the Java heap usage will be significantly less than what is reported. If your main goal is to compress arrays of integers, there are other libraries that are maybe more appropriate such as JavaFastPFOR. Note, however, that in general, random integers (as produced by random number generators or hash functions) are not compressible. Trying to compress random data is an adversarial use case.- 指定者:
getLongSizeInBytes在接口中ImmutableBitmapDataProvider- 覆盖:
getLongSizeInBytes在类中RoaringBitmap- 返回:
- estimated memory usage.
- 另请参阅:
-
getIntRankIterator
Get a special iterator that allows .peekNextRank efficiently- 返回:
- iterator with fast rank access
-