public class Roaring64NavigableMap extends java.lang.Object implements java.io.Externalizable, LongBitmapDataProvider
ImmutableLongBitmapDataProvider.RoaringOfLong| 构造器和说明 |
|---|
Roaring64NavigableMap()
By default, we consider longs are unsigned longs: normal longs: 0 is the lowest possible long.
|
Roaring64NavigableMap(BitmapDataProviderSupplier supplier)
By default, longs are managed as unsigned longs and cardinalities are cached.
|
Roaring64NavigableMap(boolean signedLongs)
By default, use RoaringBitmap as underlyings
BitmapDataProvider |
Roaring64NavigableMap(boolean signedLongs,
BitmapDataProviderSupplier supplier)
By default, we activating cardinalities caching.
|
Roaring64NavigableMap(boolean signedLongs,
boolean cacheCardinalities)
By default, use RoaringBitmap as underlyings
BitmapDataProvider |
Roaring64NavigableMap(boolean signedLongs,
boolean cacheCardinalities,
BitmapDataProviderSupplier supplier) |
| 限定符和类型 | 方法和说明 |
|---|---|
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)
Add the integer value to the container (set the value to "true"), whether it already appears or
not.
|
void |
addLong(long x)
Add the value to the container (set the value to "true"), whether it already appears or not.
|
void |
and(Roaring64NavigableMap x2)
In-place bitwise AND (intersection) operation.
|
void |
andNot(Roaring64NavigableMap x2)
In-place bitwise ANDNOT (difference) operation.
|
static Roaring64NavigableMap |
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.
|
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.io.DataInput in)
Deserialize (retrieve) this bitmap.
|
protected int |
ensureCumulatives(int high) |
boolean |
equals(java.lang.Object obj) |
void |
flip(long x)
Add the value if it is not already present, otherwise remove it.
|
void |
forEach(LongConsumer lc)
Visit all values in the bitmap and pass them to the consumer
|
int |
getIntCardinality() |
long |
getLongCardinality()
Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
|
LongIterator |
getLongIterator()
For better performance, consider the Use the
forEach method. |
long |
getLongSizeInBytes()
Estimate of the memory usage of this data structure.
|
LongIterator |
getReverseLongIterator() |
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 |
naivelazyor(Roaring64NavigableMap x2)
In-place bitwise OR (union) operation without maintaining cardinality.
|
void |
or(Roaring64NavigableMap 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)
|
void |
repairAfterLazy()
to be used with naivelazyor
|
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.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.
|
protected LongIterator |
toIterator(java.util.Iterator<java.util.Map.Entry<java.lang.Integer,BitmapDataProvider>> it,
boolean reversed) |
java.lang.String |
toString()
A string describing the bitmap.
|
void |
trim()
Recover allocated but unused memory.
|
void |
writeExternal(java.io.ObjectOutput out)
Roaring64NavigableMap are serializable. |
void |
xor(Roaring64NavigableMap x2)
In-place bitwise XOR (symmetric difference) operation.
|
reverseStream, streampublic Roaring64NavigableMap()
public Roaring64NavigableMap(boolean signedLongs)
BitmapDataProvidersignedLongs - true if longs has to be ordered as plain java longs. False to handle them as
unsigned 64bits long (as RoaringBitmap with unsigned integers)public Roaring64NavigableMap(boolean signedLongs,
boolean cacheCardinalities)
BitmapDataProvidersignedLongs - true if longs has to be ordered as plain java longs. False to handle them as
unsigned 64bits long (as RoaringBitmap with unsigned integers)cacheCardinalities - true if cardinalities have to be cached. It will prevent many
iteration along the NavigableMappublic Roaring64NavigableMap(BitmapDataProviderSupplier supplier)
supplier - provide the logic to instantiate new BitmapDataProvider, typically
instantiated once per high.public Roaring64NavigableMap(boolean signedLongs,
BitmapDataProviderSupplier supplier)
signedLongs - true if longs has to be ordered as plain java longs. False to handle them as
unsigned 64bits long (as RoaringBitmap with unsigned integers)supplier - provide the logic to instantiate new BitmapDataProvider, typically
instantiated once per high.public Roaring64NavigableMap(boolean signedLongs,
boolean cacheCardinalities,
BitmapDataProviderSupplier supplier)
signedLongs - true if longs has to be ordered as plain java longs. False to handle them as
unsigned 64bits long (as RoaringBitmap with unsigned integers)cacheCardinalities - true if cardinalities have to be cached. It will prevent many
iteration along the NavigableMapsupplier - provide the logic to instantiate new BitmapDataProvider, typically
instantiated once per high.public void addLong(long x)
Long.compareUnsigned(long, long). We order the numbers
like 0, 1, ..., 9223372036854775807, -9223372036854775808, -9223372036854775807,..., -1.addLong 在接口中 LongBitmapDataProviderx - long valuepublic void addInt(int x)
Integer.compareUnsigned(int, int). We order the numbers
like 0, 1, ..., 2147483647, -2147483648, -2147483647,..., -1.x - integer 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 long rankLong(long id)
ImmutableLongBitmapDataProviderrankLong 在接口中 ImmutableLongBitmapDataProviderid - upper limitprotected int ensureCumulatives(int high)
high - for which high bucket should we compute the cardinalitypublic void naivelazyor(Roaring64NavigableMap x2)
x2 - other bitmappublic void or(Roaring64NavigableMap x2)
x2 - other bitmappublic void xor(Roaring64NavigableMap x2)
x2 - other bitmappublic void and(Roaring64NavigableMap x2)
x2 - other bitmappublic void andNot(Roaring64NavigableMap x2)
x2 - other bitmappublic 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,
java.lang.ClassNotFoundException
readExternal 在接口中 java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic java.lang.String toString()
toString 在类中 java.lang.Objectpublic LongIterator getLongIterator()
forEach method.getLongIterator 在接口中 ImmutableLongBitmapDataProviderprotected LongIterator toIterator(java.util.Iterator<java.util.Map.Entry<java.lang.Integer,BitmapDataProvider>> it, boolean reversed)
public 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 void repairAfterLazy()
public 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 deserialize(java.io.DataInput in)
throws java.io.IOException
in - the DataInput streamjava.io.IOException - Signals that an I/O exception has occurred.public long serializedSizeInBytes()
ImmutableLongBitmapDataProviderserializedSizeInBytes 在接口中 ImmutableLongBitmapDataProviderpublic void clear()
public long[] toArray()
toArray 在接口中 ImmutableLongBitmapDataProviderpublic static Roaring64NavigableMap 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 LongIterator getReverseLongIterator()
getReverseLongIterator 在接口中 ImmutableLongBitmapDataProviderpublic void removeLong(long x)
LongBitmapDataProviderremoveLong 在接口中 LongBitmapDataProviderx - long value representing the index in a bitmappublic void trim()
LongBitmapDataProvidertrim 在接口中 LongBitmapDataProviderpublic int hashCode()
hashCode 在类中 java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals 在类中 java.lang.Objectpublic void flip(long x)
x - long value