public class RoaringBitmap extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable, java.lang.Iterable<java.lang.Integer>, java.io.Externalizable, ImmutableBitmapDataProvider, BitmapDataProvider, AppendableStorage<Container>
import org.roaringbitmap.*;
//...
RoaringBitmap rr = RoaringBitmap.bitmapOf(1,2,3,1000);
RoaringBitmap rr2 = new RoaringBitmap();
for(int k = 4000; k<4255;++k) rr2.add(k);
RoaringBitmap rror = RoaringBitmap.or(rr, rr2);
//...
DataOutputStream wheretoserialize = ...
rr.runOptimize(); // can help compression
rr.serialize(wheretoserialize);
Integers are added in unsigned sorted order. That is, they are treated as unsigned integers (see
Java 8's Integer.toUnsignedLong function).
Up to 4294967296 integers
can be stored.ImmutableBitmapDataProvider.RoaringOfInt| 限定符和类型 | 字段和说明 |
|---|---|
RoaringArray |
highLowContainer |
| 构造器和说明 |
|---|
RoaringBitmap()
Create an empty bitmap
|
RoaringBitmap(ImmutableRoaringBitmap rb)
Create a RoaringBitmap from a MutableRoaringBitmap or ImmutableRoaringBitmap.
|
RoaringBitmap(RoaringArray highLowContainer)
Wrap an existing high low container
|
| 限定符和类型 | 方法和说明 |
|---|---|
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)
已过时。
use the version where longs specify the range
|
void |
add(long rangeStart,
long rangeEnd)
Add to the current bitmap all integers in [rangeStart,rangeEnd).
|
static RoaringBitmap |
add(RoaringBitmap rb,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range
|
static RoaringBitmap |
add(RoaringBitmap rb,
long rangeStart,
long rangeEnd)
Generate a new bitmap with all integers in [rangeStart,rangeEnd) added.
|
void |
addN(int[] dat,
int offset,
int n)
Set the specified values to true, within given boundaries.
|
static RoaringBitmap |
addOffset(RoaringBitmap x,
long offset)
Generate a copy of the provided bitmap, but with
all its values incremented by offset.
|
static RoaringBitmap |
and(java.util.Iterator<? extends RoaringBitmap> bitmaps,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range. Negative range end are illegal.
|
static RoaringBitmap |
and(java.util.Iterator<? extends RoaringBitmap> bitmaps,
long rangeStart,
long rangeEnd)
Computes AND between input bitmaps in the given range, from rangeStart (inclusive) to rangeEnd
(exclusive)
|
void |
and(RoaringBitmap x2)
In-place bitwise AND (intersection) operation.
|
static RoaringBitmap |
and(RoaringBitmap x1,
RoaringBitmap x2)
Bitwise AND (intersection) operation.
|
static int |
andCardinality(RoaringBitmap x1,
RoaringBitmap x2)
Cardinality of Bitwise AND (intersection) operation.
|
void |
andNot(RoaringBitmap x2)
In-place bitwise ANDNOT (difference) operation.
|
static RoaringBitmap |
andNot(RoaringBitmap x1,
RoaringBitmap x2)
Bitwise ANDNOT (difference) operation.
|
static RoaringBitmap |
andNot(RoaringBitmap x1,
RoaringBitmap x2,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range. Negative values for range
endpoints are not allowed.
|
static RoaringBitmap |
andNot(RoaringBitmap x1,
RoaringBitmap x2,
long rangeStart,
long rangeEnd)
Bitwise ANDNOT (difference) operation for the given range, rangeStart (inclusive) and rangeEnd
(exclusive).
|
static int |
andNotCardinality(RoaringBitmap x1,
RoaringBitmap x2)
Cardinality of the bitwise ANDNOT (left difference) operation.
|
void |
append(char key,
Container container)
Appends the key and container to the storage, throws if the key is less
than the current mark.
|
static RoaringBitmap |
bitmapOf(int... dat)
Generate a bitmap with the specified values set to true.
|
static RoaringBitmap |
bitmapOfRange(long min,
long max) |
static RoaringBitmap |
bitmapOfUnordered(int... data)
Efficiently builds a RoaringBitmap from unordered data
|
boolean |
cardinalityExceeds(long threshold)
Returns true if the bitmap's cardinality exceeds the threshold.
|
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.
|
RoaringBitmap |
clone() |
boolean |
contains(int x)
Checks whether the value is included, which is equivalent to checking if the corresponding bit
is set (get in BitSet class).
|
boolean |
contains(long minimum,
long supremum)
Checks if the bitmap contains the range.
|
boolean |
contains(RoaringBitmap subset)
Checks whether the parameter is a subset of this RoaringBitmap or not
|
void |
deserialize(java.nio.ByteBuffer bbf)
Deserialize (retrieve) this bitmap.
|
void |
deserialize(java.io.DataInput in)
Deserialize (retrieve) this bitmap.
|
void |
deserialize(java.io.DataInput in,
byte[] buffer)
Deserialize (retrieve) this bitmap.
|
boolean |
equals(java.lang.Object o) |
int |
first()
Get the first (smallest) integer in this RoaringBitmap,
that is, returns the minimum of the set.
|
void |
flip(int x)
Add the value if it is not already present, otherwise remove it.
|
void |
flip(int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range
|
void |
flip(long rangeStart,
long rangeEnd)
Modifies the current bitmap by complementing the bits in the given range, from rangeStart
(inclusive) rangeEnd (exclusive).
|
static RoaringBitmap |
flip(RoaringBitmap rb,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range
|
static RoaringBitmap |
flip(RoaringBitmap bm,
long rangeStart,
long rangeEnd)
Complements the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
|
void |
forAllInRange(int start,
int length,
RelativeRangeConsumer rrc)
Consume presence information for all values in the range [start, start + length).
|
void |
forEach(IntConsumer ic)
Visit all values in the bitmap and pass them to the consumer
|
void |
forEachInRange(int start,
int length,
IntConsumer ic)
Consume each value present in the range [start, start + length).
|
RoaringBatchIterator |
getBatchIterator()
This iterator may be faster than others
|
int |
getCardinality()
Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
|
ContainerPointer |
getContainerPointer()
Return a low-level container pointer that can be used to access the underlying data structure.
|
PeekableIntIterator |
getIntIterator()
For better performance, consider the Use the
forEach method. |
long |
getLongCardinality()
Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
|
long |
getLongSizeInBytes()
Estimate of the memory usage of this data structure.
|
IntIterator |
getReverseIntIterator() |
int |
getSizeInBytes()
Estimate of the memory usage of this data structure.
|
int |
hashCode()
Compute the hashCode() of this bitmap.
|
boolean |
hasRunCompression()
Check whether this bitmap has had its runs compressed.
|
boolean |
intersects(long minimum,
long supremum)
Checks if the range intersects with the bitmap.
|
static boolean |
intersects(RoaringBitmap x1,
RoaringBitmap x2)
Checks whether the two bitmaps intersect.
|
boolean |
isEmpty()
Checks whether the bitmap is empty.
|
boolean |
isHammingSimilar(RoaringBitmap other,
int tolerance)
Returns true if the other bitmap has no more than tolerance bits
differing from this bitmap.
|
java.util.Iterator<java.lang.Integer> |
iterator()
iterate over the positions of the true values.
|
int |
last()
Get the last (largest) integer in this RoaringBitmap,
that is, returns the maximum of the set.
|
protected void |
lazyor(RoaringBitmap x2) |
protected static RoaringBitmap |
lazyor(RoaringBitmap x1,
RoaringBitmap x2) |
protected static RoaringBitmap |
lazyorfromlazyinputs(RoaringBitmap x1,
RoaringBitmap x2) |
RoaringBitmap |
limit(int maxcardinality)
Create a new Roaring bitmap containing at most maxcardinality integers.
|
static long |
maximumSerializedSize(long cardinality,
long universe_size)
Assume that one wants to store "cardinality" integers in [0, universe_size), this function
returns an upper bound on the serialized size in bytes.
|
protected void |
naivelazyor(RoaringBitmap x2) |
long |
nextAbsentValue(int fromValue)
Returns the first absent value equal to or larger than the provided
value (interpreted as an unsigned integer).
|
long |
nextValue(int fromValue)
Returns the first value equal to or larger than the provided value
(interpreted as an unsigned integer).
|
static RoaringBitmap |
or(java.util.Iterator<? extends RoaringBitmap> bitmaps)
Compute overall OR between bitmaps.
|
static RoaringBitmap |
or(java.util.Iterator<? extends RoaringBitmap> bitmaps,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range.
Negative range points are forbidden.
|
static RoaringBitmap |
or(java.util.Iterator<? extends RoaringBitmap> bitmaps,
long rangeStart,
long rangeEnd)
Computes OR between input bitmaps in the given range, from rangeStart (inclusive) to rangeEnd
(exclusive)
|
static RoaringBitmap |
or(RoaringBitmap... bitmaps)
Compute overall OR between bitmaps.
|
void |
or(RoaringBitmap x2)
In-place bitwise OR (union) operation.
|
static RoaringBitmap |
or(RoaringBitmap x1,
RoaringBitmap x2)
Bitwise OR (union) operation.
|
static int |
orCardinality(RoaringBitmap x1,
RoaringBitmap x2)
Cardinality of the bitwise OR (union) operation.
|
void |
orNot(RoaringBitmap other,
long rangeEnd)
In-place bitwise ORNOT operation.
|
static RoaringBitmap |
orNot(RoaringBitmap x1,
RoaringBitmap x2,
long rangeEnd)
Bitwise ORNOT operation for the given range, rangeStart (inclusive) and rangeEnd
(exclusive).
|
long |
previousAbsentValue(int fromValue)
Returns the first absent value less than or equal to the provided
value (interpreted as an unsigned integer).
|
long |
previousValue(int fromValue)
Returns the first value less than or equal to the provided value
(interpreted as an unsigned integer).
|
long |
rangeCardinality(long start,
long end)
Computes the number of values in the interval [start,end) where
start is included and end excluded.
|
int |
rank(int x)
Rank returns the number of integers that are smaller or equal to x (rank(infinity) would be
getCardinality()).
|
long |
rankLong(int x)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be
GetCardinality()).
|
void |
readExternal(java.io.ObjectInput in) |
void |
remove(int x)
If present remove the specified integer (effectively, sets its bit value to false)
|
void |
remove(int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range
|
void |
remove(long rangeStart,
long rangeEnd)
Remove from the current bitmap all integers in [rangeStart,rangeEnd).
|
static RoaringBitmap |
remove(RoaringBitmap rb,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range
|
static RoaringBitmap |
remove(RoaringBitmap rb,
long rangeStart,
long rangeEnd)
Generate a new bitmap with all integers in [rangeStart,rangeEnd) removed.
|
boolean |
removeRunCompression()
Remove run-length encoding even when it is more space efficient
|
protected void |
repairAfterLazy() |
boolean |
runOptimize()
Use a run-length encoding where it is more space efficient
|
int |
select(int j)
Return the jth value stored in this bitmap.
|
void |
serialize(java.nio.ByteBuffer buffer)
Serialize this bitmap to a ByteBuffer.
|
void |
serialize(java.io.DataOutput out)
Serialize this bitmap.
|
int |
serializedSizeInBytes()
Report the number of bytes required to serialize this bitmap.
|
int[] |
toArray()
Return the set values as an array, if the cardinality is smaller than 2147483648.
|
MutableRoaringBitmap |
toMutableRoaringBitmap()
Convert (copies) to a mutable roaring bitmap.
|
java.lang.String |
toString()
A string describing the bitmap.
|
void |
trim()
Recover allocated but unused memory.
|
void |
writeExternal(java.io.ObjectOutput out) |
static RoaringBitmap |
xor(java.util.Iterator<? extends RoaringBitmap> bitmaps,
int rangeStart,
int rangeEnd)
已过时。
use the version where longs specify the range.
Negative values not allowed for rangeStart and rangeEnd
|
static RoaringBitmap |
xor(java.util.Iterator<? extends RoaringBitmap> bitmaps,
long rangeStart,
long rangeEnd)
Computes XOR between input bitmaps in the given range, from rangeStart (inclusive) to rangeEnd
(exclusive)
|
void |
xor(RoaringBitmap x2)
In-place bitwise XOR (symmetric difference) operation.
|
static RoaringBitmap |
xor(RoaringBitmap x1,
RoaringBitmap x2)
Bitwise XOR (symmetric difference) operation.
|
static int |
xorCardinality(RoaringBitmap x1,
RoaringBitmap x2)
Cardinality of the bitwise XOR (symmetric difference) operation.
|
reverseStream, streampublic RoaringArray highLowContainer
public RoaringBitmap()
public RoaringBitmap(RoaringArray highLowContainer)
public RoaringBitmap(ImmutableRoaringBitmap rb)
rb - the original bitmappublic static RoaringBitmap addOffset(RoaringBitmap x, long offset)
x - source bitmapoffset - incrementpublic static RoaringBitmap add(RoaringBitmap rb, long rangeStart, long rangeEnd)
rb - initial bitmap (will not be modified)rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated public static RoaringBitmap add(RoaringBitmap rb, int rangeStart, int rangeEnd)
rb - initial bitmap (will not be modified)rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic static RoaringBitmap and(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmapFastAggregation.and(RoaringBitmap...)public static int andCardinality(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmapFastAggregation.and(RoaringBitmap...)public static RoaringBitmap andNot(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic void add(int... dat)
dat - set valuespublic void addN(int[] dat,
int offset,
int n)
dat - set valuesoffset - from which index the values should be set to truen - how many values should be set to truepublic static RoaringBitmap bitmapOf(int... dat)
dat - set valuespublic static RoaringBitmap bitmapOfUnordered(int... data)
data - unsorted datapublic static RoaringBitmap bitmapOfRange(long min, long max)
add(long, long)public static RoaringBitmap flip(RoaringBitmap bm, long rangeStart, long rangeEnd)
bm - bitmap being negatedrangeStart - inclusive beginning of range, in [0, 0xffffffff]rangeEnd - exclusive ending of range, in [0, 0xffffffff + 1]@Deprecated public static RoaringBitmap flip(RoaringBitmap rb, int rangeStart, int rangeEnd)
rb - bitmap being negatedrangeStart - inclusive beginning of range, in [0, 0xffffffff]rangeEnd - exclusive ending of range, in [0, 0xffffffff + 1]public static boolean intersects(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmapprotected static RoaringBitmap lazyor(RoaringBitmap x1, RoaringBitmap x2)
protected static RoaringBitmap lazyorfromlazyinputs(RoaringBitmap x1, RoaringBitmap x2)
public static RoaringBitmap or(java.util.Iterator<? extends RoaringBitmap> bitmaps)
FastAggregation.or(java.util.Iterator<? extends org.bitlap.roaringbitmap.RoaringBitmap>))bitmaps - input bitmapspublic static RoaringBitmap or(RoaringBitmap... bitmaps)
FastAggregation.or(java.util.Iterator<? extends org.bitlap.roaringbitmap.RoaringBitmap>))bitmaps - input bitmapspublic static RoaringBitmap or(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmapFastAggregation.or(RoaringBitmap...),
FastAggregation.horizontal_or(RoaringBitmap...)public static int orCardinality(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmapFastAggregation.or(RoaringBitmap...),
FastAggregation.horizontal_or(RoaringBitmap...)public static int xorCardinality(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic static int andNotCardinality(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmappublic static RoaringBitmap remove(RoaringBitmap rb, long rangeStart, long rangeEnd)
rb - initial bitmap (will not be modified)rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated public static RoaringBitmap remove(RoaringBitmap rb, int rangeStart, int rangeEnd)
rb - initial bitmap (will not be modified)rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic static RoaringBitmap xor(RoaringBitmap x1, RoaringBitmap x2)
x1 - first bitmapx2 - other bitmapFastAggregation.xor(RoaringBitmap...),
FastAggregation.horizontal_xor(RoaringBitmap...)public void add(int x)
Integer.compareUnsigned(int, int).
We order the numbers like 0, 1, ..., 2147483647, -2147483648, -2147483647,..., -1.add 在接口中 BitmapDataProviderx - integer valuepublic void add(long rangeStart,
long rangeEnd)
add 在接口中 BitmapDataProviderrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated
public void add(int rangeStart,
int rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic boolean intersects(long minimum,
long supremum)
minimum - the inclusive unsigned lower bound of the rangesupremum - the exclusive unsigned upper bound of the rangepublic void and(RoaringBitmap x2)
x2 - other bitmappublic static RoaringBitmap and(java.util.Iterator<? extends RoaringBitmap> bitmaps, long rangeStart, long rangeEnd)
bitmaps - input bitmaps, these are not modifiedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated public static RoaringBitmap and(java.util.Iterator<? extends RoaringBitmap> bitmaps, int rangeStart, int rangeEnd)
bitmaps - input bitmaps, these are not modifiedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic void andNot(RoaringBitmap x2)
x2 - other bitmappublic static RoaringBitmap andNot(RoaringBitmap x1, RoaringBitmap x2, long rangeStart, long rangeEnd)
x1 - first bitmapx2 - other bitmaprangeStart - starting point of the range (inclusive)rangeEnd - end point of the range (exclusive)@Deprecated public static RoaringBitmap andNot(RoaringBitmap x1, RoaringBitmap x2, int rangeStart, int rangeEnd)
x1 - first bitmapx2 - other bitmaprangeStart - starting point of the range (inclusive)rangeEnd - end point of the range (exclusive)public void orNot(RoaringBitmap other, long rangeEnd)
other - the other bitmaprangeEnd - end point of the range (exclusive).public static RoaringBitmap orNot(RoaringBitmap x1, RoaringBitmap x2, long rangeEnd)
x1 - first bitmapx2 - other bitmaprangeEnd - end point of the range (exclusive)public boolean checkedAdd(int x)
x - integer valuepublic boolean checkedRemove(int x)
x - integer value representing the index in a bitmappublic void clear()
public RoaringBitmap clone()
clone 在类中 java.lang.Objectpublic boolean contains(int x)
contains 在接口中 ImmutableBitmapDataProviderx - integer valuepublic boolean contains(long minimum,
long supremum)
minimum - the inclusive lower bound of the rangesupremum - the exclusive upper bound of the rangepublic void deserialize(java.io.DataInput in,
byte[] buffer)
throws java.io.IOException
in - the DataInput streambuffer - The buffer gets overwritten with data during deserialization. You can pass a NULL
reference as a buffer. A buffer containing at least 8192 bytes might be ideal for
performance. It is recommended to reuse the buffer between calls to deserialize (in a
single-threaded context) for best performance.java.io.IOException - Signals that an I/O exception has occurred.public void deserialize(java.io.DataInput in)
throws java.io.IOException
in - the DataInput streamjava.io.IOException - Signals that an I/O exception has occurred.public void deserialize(java.nio.ByteBuffer bbf)
throws java.io.IOException
bbf - the byte buffer (can be mapped, direct, array backed etc.java.io.IOException - Signals that an I/O exception has occurred.public boolean equals(java.lang.Object o)
equals 在类中 java.lang.Objectpublic boolean isHammingSimilar(RoaringBitmap other, int tolerance)
other - the bitmap to compare totolerance - the maximum number of bits that may differpublic void flip(int x)
x - integer valuepublic void flip(long rangeStart,
long rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated
public void flip(int rangeStart,
int rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic long getLongCardinality()
getLongCardinality 在接口中 ImmutableBitmapDataProviderpublic int getCardinality()
ImmutableBitmapDataProvidergetCardinality 在接口中 ImmutableBitmapDataProviderpublic boolean cardinalityExceeds(long threshold)
threshold - thresholdpublic void forEach(IntConsumer ic)
ImmutableBitmapDataProvider
bitmap.forEach(new IntConsumer() {
{@literal @}Override
public void accept(int value) {
// do something here
}});
}
forEach 在接口中 ImmutableBitmapDataProvideric - the consumerpublic void forAllInRange(int start,
int length,
RelativeRangeConsumer rrc)
start - Lower bound of values to consume.length - Maximum number of values to consume.rrc - Code to be executed for each present or absent value.public void forEachInRange(int start,
int length,
IntConsumer ic)
start - Lower bound of values to consume.length - Maximum number of values to consume.ic - Code to be executed for each present value.public ContainerPointer getContainerPointer()
public PeekableIntIterator getIntIterator()
forEach method.getIntIterator 在接口中 ImmutableBitmapDataProviderpublic IntIterator getReverseIntIterator()
getReverseIntIterator 在接口中 ImmutableBitmapDataProviderpublic RoaringBatchIterator getBatchIterator()
ImmutableBitmapDataProvidergetBatchIterator 在接口中 ImmutableBitmapDataProviderpublic long getLongSizeInBytes()
getLongSizeInBytes 在接口中 ImmutableBitmapDataProviderpublic int getSizeInBytes()
getSizeInBytes 在接口中 ImmutableBitmapDataProviderpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic boolean hasRunCompression()
public boolean isEmpty()
isEmpty 在接口中 ImmutableBitmapDataProviderpublic java.util.Iterator<java.lang.Integer> iterator()
iterator 在接口中 java.lang.Iterable<java.lang.Integer>protected void lazyor(RoaringBitmap x2)
protected void naivelazyor(RoaringBitmap x2)
public RoaringBitmap limit(int maxcardinality)
limit 在接口中 ImmutableBitmapDataProvidermaxcardinality - maximal cardinalitypublic void or(RoaringBitmap x2)
x2 - other bitmappublic static RoaringBitmap or(java.util.Iterator<? extends RoaringBitmap> bitmaps, long rangeStart, long rangeEnd)
bitmaps - input bitmaps, these are not modifiedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated public static RoaringBitmap or(java.util.Iterator<? extends RoaringBitmap> bitmaps, int rangeStart, int rangeEnd)
bitmaps - input bitmaps, these are not modifiedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic long rankLong(int x)
rankLong 在接口中 ImmutableBitmapDataProviderx - upper limitpublic long rangeCardinality(long start,
long end)
ImmutableBitmapDataProviderrangeCardinality 在接口中 ImmutableBitmapDataProviderstart - lower limit (included)end - upper limit (excluded)public int rank(int x)
ImmutableBitmapDataProviderrank 在接口中 ImmutableBitmapDataProviderx - upper limitpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal 在接口中 java.io.Externalizablejava.io.IOExceptionpublic void remove(int x)
remove 在接口中 BitmapDataProviderx - integer value representing the index in a bitmappublic void remove(long rangeStart,
long rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated
public void remove(int rangeStart,
int rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic boolean removeRunCompression()
protected void repairAfterLazy()
public boolean runOptimize()
public boolean contains(RoaringBitmap subset)
subset - the potential subsetpublic int select(int j)
select 在接口中 ImmutableBitmapDataProviderj - index of the valuepublic long nextValue(int fromValue)
ImmutableBitmapDataProvider-1 is returned. It is not necessarily a
computationally effective way to iterate through the values.nextValue 在接口中 ImmutableBitmapDataProviderfromValue - the lower bound (inclusive)-1 if there is no such valuepublic long previousValue(int fromValue)
ImmutableBitmapDataProvider-1 is returned. It is not an efficient
way to iterate through the values backwards.previousValue 在接口中 ImmutableBitmapDataProviderfromValue - the upper bound (inclusive)-1 if there is no such valuepublic long nextAbsentValue(int fromValue)
ImmutableBitmapDataProvidernextAbsentValue 在接口中 ImmutableBitmapDataProviderfromValue - the lower bound (inclusive)public long previousAbsentValue(int fromValue)
ImmutableBitmapDataProviderpreviousAbsentValue 在接口中 ImmutableBitmapDataProviderfromValue - the lower bound (inclusive)public int first()
first 在接口中 ImmutableBitmapDataProviderjava.util.NoSuchElementException - if emptypublic int last()
last 在接口中 ImmutableBitmapDataProviderjava.util.NoSuchElementException - if emptypublic void serialize(java.io.DataOutput out)
throws java.io.IOException
runOptimize() before serialization to improve compression.
The current bitmap is not modified.
There is a distinct and dedicated method to serialize to a ByteBuffer.
Note: Java's data structures are in big endian format. Roaring serializes to a little endian
format, so the bytes are flipped by the library during serialization to ensure that what is
stored is in little endian---despite Java's big endianness. You can defeat this process by
reflipping the bytes again in a custom DataOutput which could lead to serialized Roaring
objects with an incorrect byte order.serialize 在接口中 ImmutableBitmapDataProviderout - the DataOutput streamjava.io.IOException - Signals that an I/O exception has occurred.public void serialize(java.nio.ByteBuffer buffer)
ImmutableBitmapDataProvider
byte[] array = new byte[mrb.serializedSizeInBytes()];
mrb.serialize(ByteBuffer.wrap(array));
serialize 在接口中 ImmutableBitmapDataProviderbuffer - the ByteBufferpublic static long maximumSerializedSize(long cardinality,
long universe_size)
cardinality - maximal cardinalityuniverse_size - maximal valuepublic int serializedSizeInBytes()
serializedSizeInBytes 在接口中 ImmutableBitmapDataProviderpublic int[] toArray()
toArray 在接口中 ImmutableBitmapDataProviderpublic void append(char key,
Container container)
AppendableStorageappend 在接口中 AppendableStorage<Container>key - the key to appendcontainer - the data to appendpublic MutableRoaringBitmap toMutableRoaringBitmap()
public java.lang.String toString()
toString 在类中 java.lang.Objectpublic void trim()
trim 在接口中 BitmapDataProviderpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal 在接口中 java.io.Externalizablejava.io.IOExceptionpublic void xor(RoaringBitmap x2)
x2 - other bitmappublic static RoaringBitmap xor(java.util.Iterator<? extends RoaringBitmap> bitmaps, long rangeStart, long rangeEnd)
bitmaps - input bitmaps, these are not modifiedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range@Deprecated public static RoaringBitmap xor(java.util.Iterator<? extends RoaringBitmap> bitmaps, int rangeStart, int rangeEnd)
bitmaps - input bitmaps, these are not modifiedrangeStart - inclusive beginning of rangerangeEnd - exclusive ending of range