Package org.roaringbitmap.longlong
Interface ImmutableLongBitmapDataProvider
-
- All Known Subinterfaces:
LongBitmapDataProvider
- All Known Implementing Classes:
Roaring64NavigableMap
public interface ImmutableLongBitmapDataProvider
Interface representing an immutable bitmap.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description 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
forEach(LongConsumer lc)
Visit all values in the bitmap and pass them to the consumer.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 theforEach
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.boolean
isEmpty()
Checks whether the bitmap is empty.ImmutableLongBitmapDataProvider
limit(long x)
Create a new bitmap of the same class, containing at most maxcardinality integers.long
rankLong(long x)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).long
select(long j)
Return the jth value stored in this bitmap.void
serialize(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.
-
-
-
Method Detail
-
contains
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).- Parameters:
x
- long value- Returns:
- whether the long value is included.
-
getLongCardinality
long getLongCardinality()
Returns the number of distinct integers added to the bitmap (e.g., number of bits set). This returns a full 64-bit result.- Returns:
- the cardinality
-
forEach
void forEach(LongConsumer lc)
Visit all values in the bitmap and pass them to the consumer. * Usage:bitmap.forEach(new LongConsumer() { {@literal @}Override public void accept(long value) { // do something here }});
}- Parameters:
lc
- the consumer
-
getLongIterator
LongIterator getLongIterator()
For better performance, consider the Use theforEach
method.- Returns:
- a custom iterator over set bits, the bits are traversed in ascending sorted order
-
getReverseLongIterator
LongIterator getReverseLongIterator()
- Returns:
- a custom iterator over set bits, the bits are traversed in descending sorted order
-
getSizeInBytes
int getSizeInBytes()
Estimate of the memory usage of this data structure. Internally, this is computed as a 64-bit counter.- Returns:
- estimated memory usage.
-
getLongSizeInBytes
long getLongSizeInBytes()
Estimate of the memory usage of this data structure. Provides full 64-bit number.- Returns:
- estimated memory usage.
-
isEmpty
boolean isEmpty()
Checks whether the bitmap is empty.- Returns:
- true if this bitmap contains no set bit
-
limit
ImmutableLongBitmapDataProvider limit(long x)
Create a new bitmap of the same class, containing at most maxcardinality integers.- Parameters:
x
- maximal cardinality- Returns:
- a new bitmap with cardinality no more than maxcardinality
-
rankLong
long rankLong(long x)
Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()). The value is a full 64-bit value.- Parameters:
x
- upper limit- Returns:
- the rank
-
select
long select(long j)
Return the jth value stored in this bitmap.- Parameters:
j
- index of the value- Returns:
- the value
-
serialize
void serialize(DataOutput out) throws IOException
Serialize this bitmap. The current bitmap is not modified.- Parameters:
out
- the DataOutput stream- Throws:
IOException
- Signals that an I/O exception has occurred.
-
serializedSizeInBytes
long serializedSizeInBytes()
Report the number of bytes required to serialize this bitmap. This is the number of bytes written out when using the serialize method. When using the writeExternal method, the count will be higher due to the overhead of Java serialization.- Returns:
- the size in bytes
-
toArray
long[] toArray()
Return the set values as an array. The integer values are in sorted order.- Returns:
- array representing the set values.
-
-