public class Roaring64Bitmap extends java.lang.Object implements java.io.Externalizable, LongBitmapDataProvider
ImmutableLongBitmapDataProvider.RoaringOfLong| 构造器和说明 |
|---|
Roaring64Bitmap() |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
add(long... dat)
Set all the specified values to true.
|
void |
add(long rangeStart,
long rangeEnd)
Add to the current bitmap all longs in [rangeStart,rangeEnd).
|
void |
addInt(int x) |
void |
addLong(long x)
Add the value to the container (set the value to "true"), whether it already appears or not.
|
void |
and(Roaring64Bitmap x2)
In-place bitwise AND (intersection) operation.
|
void |
andNot(Roaring64Bitmap x2)
In-place bitwise ANDNOT (difference) operation.
|
static Roaring64Bitmap |
bitmapOf(long... dat)
Generate a bitmap with the specified values set to true.
|
void |
clear()
reset to an empty bitmap; result occupies as much space a newly created bitmap.
|
Roaring64Bitmap |
clone() |
boolean |
contains(long x)
Checks whether the value in included, which is equivalent to checking if the corresponding bit
is set (get in BitSet class).
|
void |
deserialize(java.nio.ByteBuffer in)
Deserialize (retrieve) this bitmap.
|
void |
deserialize(java.io.DataInput in)
Deserialize (retrieve) this bitmap.
|
boolean |
equals(java.lang.Object obj) |
void |
flip(long x)
Add the value if it is not already present, otherwise remove it.
|
void |
flip(long rangeStart,
long rangeEnd)
Complements the bits in the given range, from rangeStart (inclusive) rangeEnd (exclusive).
|
void |
forAllInRange(long start,
int length,
RelativeRangeConsumer rrc)
Consume presence information for all values in the range [start, start + length).
|
void |
forEach(LongConsumer lc)
Visit all values in the bitmap and pass them to the consumer
|
void |
forEachInRange(long start,
int length,
LongConsumer lc)
Consume each value present in the range [start, start + length).
|
int |
getIntCardinality() |
long |
getLongCardinality()
Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
|
PeekableLongIterator |
getLongIterator()
For better performance, consider the Use the
forEach method. |
PeekableLongIterator |
getLongIteratorFrom(long minval)
Produce an iterator over the values in this bitmap starting from `minval`.
|
long |
getLongSizeInBytes()
Estimate of the memory usage of this data structure.
|
PeekableLongIterator |
getReverseLongIterator() |
PeekableLongIterator |
getReverseLongIteratorFrom(long maxval)
Produce an iterator over the values in this bitmap starting from `maxval`.
|
int |
getSizeInBytes()
Estimate of the memory usage of this data structure.
|
int |
hashCode() |
boolean |
isEmpty()
Checks whether the bitmap is empty.
|
java.util.Iterator<java.lang.Long> |
iterator()
For better performance, consider the Use the
forEach method. |
ImmutableLongBitmapDataProvider |
limit(long x)
Create a new bitmap of the same class, containing at most maxcardinality integers.
|
void |
or(Roaring64Bitmap x2)
In-place bitwise OR (union) operation.
|
long |
rankLong(long id)
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 |
removeLong(long x)
If present remove the specified integers (effectively, sets its bit value to false)
|
boolean |
runOptimize()
Use a run-length encoding where it is estimated as more space efficient
|
long |
select(long j)
Return the jth value stored in this bitmap.
|
void |
serialize(java.nio.ByteBuffer byteBuffer)
Serialize this bitmap, please make sure the size of the serialized bytes is
smaller enough that ByteBuffer can hold it.
|
void |
serialize(java.io.DataOutput out)
Serialize this bitmap.
|
long |
serializedSizeInBytes()
Report the number of bytes required to serialize this bitmap.
|
long[] |
toArray()
Return the set values as an array, if the cardinality is smaller than 2147483648.
|
java.lang.String |
toString()
A string describing the bitmap.
|
void |
trim()
remove the allocated unused memory space
|
void |
writeExternal(java.io.ObjectOutput out)
Roaring64NavigableMap are serializable. |
void |
xor(Roaring64Bitmap x2)
In-place bitwise XOR (symmetric difference) operation.
|
reverseStream, streampublic void addInt(int x)
public void addLong(long x)
Long.toUnsignedString(long, int). We order the numbers
like 0, 1, ..., 9223372036854775807, -9223372036854775808, -9223372036854775807,..., -1.addLong 在接口中 LongBitmapDataProviderx - long valuepublic long getLongCardinality()
getLongCardinality 在接口中 ImmutableLongBitmapDataProviderpublic int getIntCardinality()
throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException - if the cardinality does not fit in an intpublic long select(long j)
throws java.lang.IllegalArgumentException
select 在接口中 ImmutableLongBitmapDataProviderj - index of the valuejava.lang.IllegalArgumentException - if j is out of the bounds of the bitmap cardinalitypublic java.util.Iterator<java.lang.Long> iterator()
forEach method.public void forEach(LongConsumer lc)
ImmutableLongBitmapDataProvider
bitmap.forEach(new LongConsumer() {
{@literal @}Override
public void accept(long value) {
// do something here
}});
}
forEach 在接口中 ImmutableLongBitmapDataProviderlc - the consumerpublic void forAllInRange(long 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(long start,
int length,
LongConsumer lc)
start - Lower bound of values to consume.length - Maximum number of values to consume.lc - Code to be executed for each present value.public long rankLong(long id)
ImmutableLongBitmapDataProviderrankLong 在接口中 ImmutableLongBitmapDataProviderid - upper limitpublic void or(Roaring64Bitmap x2)
x2 - other bitmappublic void xor(Roaring64Bitmap x2)
x2 - other bitmappublic void and(Roaring64Bitmap x2)
x2 - other bitmappublic void andNot(Roaring64Bitmap x2)
x2 - other bitmappublic void flip(long rangeStart,
long rangeEnd)
rangeStart - inclusive beginning of range, in [0, 0xffffffffffffffff]rangeEnd - exclusive ending of range, in [0, 0xffffffffffffffff + 1]public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
Roaring64NavigableMap are serializable. However, contrary to RoaringBitmap, the
serialization format is not well-defined: for now, it is strongly coupled with Java standard
serialization. Just like the serialization may be incompatible between various Java versions,
Roaring64NavigableMap are subject to incompatibilities. Moreover, even on a given Java
versions, the serialization format may change from one RoaringBitmap version to anotherwriteExternal 在接口中 java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException
readExternal 在接口中 java.io.Externalizablejava.io.IOExceptionpublic java.lang.String toString()
toString 在类中 java.lang.Objectpublic PeekableLongIterator getLongIterator()
forEach method.getLongIterator 在接口中 ImmutableLongBitmapDataProviderpublic PeekableLongIterator getLongIteratorFrom(long minval)
minval - the lower bound of the iterator returnedpublic boolean contains(long x)
ImmutableLongBitmapDataProvidercontains 在接口中 ImmutableLongBitmapDataProviderx - long valuepublic int getSizeInBytes()
ImmutableLongBitmapDataProvidergetSizeInBytes 在接口中 ImmutableLongBitmapDataProviderpublic long getLongSizeInBytes()
ImmutableLongBitmapDataProvidergetLongSizeInBytes 在接口中 ImmutableLongBitmapDataProviderpublic boolean isEmpty()
ImmutableLongBitmapDataProviderisEmpty 在接口中 ImmutableLongBitmapDataProviderpublic ImmutableLongBitmapDataProvider limit(long x)
ImmutableLongBitmapDataProviderlimit 在接口中 ImmutableLongBitmapDataProviderx - maximal cardinalitypublic boolean runOptimize()
public void serialize(java.io.DataOutput out)
throws java.io.IOException
runOptimize() before serialization to improve compression.
The current bitmap is not modified.serialize 在接口中 ImmutableLongBitmapDataProviderout - the DataOutput streamjava.io.IOException - Signals that an I/O exception has occurred.public void serialize(java.nio.ByteBuffer byteBuffer)
throws java.io.IOException
byteBuffer - the ByteBufferjava.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 in)
throws java.io.IOException
in - the ByteBuffer streamjava.io.IOException - Signals that an I/O exception has occurred.public long serializedSizeInBytes()
ImmutableLongBitmapDataProviderserializedSizeInBytes 在接口中 ImmutableLongBitmapDataProviderpublic void clear()
public long[] toArray()
toArray 在接口中 ImmutableLongBitmapDataProviderpublic static Roaring64Bitmap bitmapOf(long... dat)
dat - set valuespublic void add(long... dat)
dat - set valuespublic void add(long rangeStart,
long rangeEnd)
rangeStart - inclusive beginning of rangerangeEnd - exclusive ending of rangepublic PeekableLongIterator getReverseLongIterator()
getReverseLongIterator 在接口中 ImmutableLongBitmapDataProviderpublic PeekableLongIterator getReverseLongIteratorFrom(long maxval)
maxval - the upper bound of the iterator returnedpublic void removeLong(long x)
LongBitmapDataProviderremoveLong 在接口中 LongBitmapDataProviderx - long value representing the index in a bitmappublic void trim()
trim 在接口中 LongBitmapDataProviderpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals 在类中 java.lang.Objectpublic void flip(long x)
x - long valuepublic Roaring64Bitmap clone()
clone 在类中 java.lang.Object