Package org.roaringbitmap.buffer
Interface PointableRoaringArray
-
- All Superinterfaces:
java.lang.Cloneable
- All Known Implementing Classes:
ImmutableRoaringArray
,MutableRoaringArray
public interface PointableRoaringArray extends java.lang.Cloneable
Generic interface for the array underlying roaring bitmap classes.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
advanceUntil(char x, int pos)
Find the smallest integer index larger than pos such that getKeyAtIndex(index)>=x.PointableRoaringArray
clone()
Create an independent copy of the underlying arrayboolean
containsForContainerAtIndex(int i, char x)
This checks whether the container at index i has the value x.int
first()
Gets the first value in the arrayint
getCardinality(int i)
Returns the cardinality of the container at the given index.MappeableContainer
getContainerAtIndex(int i)
int
getContainerIndex(char x)
Returns either the index of the container corresponding to key x, or a negative value.MappeableContainerPointer
getContainerPointer()
MappeableContainerPointer
getContainerPointer(int startIndex)
int
getIndex(char x)
char
getKeyAtIndex(int i)
boolean
hasRunCompression()
Check whether this bitmap has had its runs compressed.int
last()
Gets the last value in the arrayvoid
serialize(java.io.DataOutput out)
Serialize.void
serialize(java.nio.ByteBuffer buffer)
Serialize.int
serializedSizeInBytes()
int
size()
-
-
-
Method Detail
-
advanceUntil
int advanceUntil(char x, int pos)
Find the smallest integer index larger than pos such that getKeyAtIndex(index)>=x. If none can be found, return size.- Parameters:
x
- minimal valuepos
- index to exceed- Returns:
- the smallest index greater than pos such that getKeyAtIndex(index) is at least as large as min, or size if it is not possible.
-
clone
PointableRoaringArray clone()
Create an independent copy of the underlying array- Returns:
- a copy
-
containsForContainerAtIndex
boolean containsForContainerAtIndex(int i, char x)
This checks whether the container at index i has the value x. This can be faster than calling "getContainerAtIndex" and then calling contains.- Parameters:
i
- container index (assumed to be non-negative)x
- 16-bit value to check- Returns:
- whether the container contains at index i contains x
-
getCardinality
int getCardinality(int i)
Returns the cardinality of the container at the given index. This method is expected to be fast.- Parameters:
i
- index- Returns:
- the cardinality
-
getContainerIndex
int getContainerIndex(char x)
Returns either the index of the container corresponding to key x, or a negative value.- Parameters:
x
- 16-bit key- Returns:
- index of container (negative value if no container found)
-
getContainerAtIndex
MappeableContainer getContainerAtIndex(int i)
- Parameters:
i
- index- Returns:
- matching container
-
getContainerPointer
MappeableContainerPointer getContainerPointer()
- Returns:
- a ContainerPointer to iterator over the array
-
getContainerPointer
MappeableContainerPointer getContainerPointer(int startIndex)
- Parameters:
startIndex
- starting index- Returns:
- a ContainerPointer to iterator over the array initially positioned at startIndex
-
getIndex
int getIndex(char x)
- Parameters:
x
- 16-bit key- Returns:
- corresponding index
-
getKeyAtIndex
char getKeyAtIndex(int i)
- Parameters:
i
- the index- Returns:
- 16-bit key at the index
-
hasRunCompression
boolean hasRunCompression()
Check whether this bitmap has had its runs compressed.- Returns:
- whether this bitmap has run compression
-
serialize
void serialize(java.io.DataOutput out) throws java.io.IOException
Serialize. The current bitmap is not modified.- Parameters:
out
- the DataOutput stream- Throws:
java.io.IOException
- Signals that an I/O exception has occurred.
-
serialize
void serialize(java.nio.ByteBuffer buffer)
Serialize. The current bitmap is not modified.- Parameters:
buffer
- the buffer to serialize to
-
serializedSizeInBytes
int serializedSizeInBytes()
- Returns:
- the size that the data structure occupies on disk
-
size
int size()
- Returns:
- number of keys
-
first
int first()
Gets the first value in the array- Returns:
- te first value in the array
-
last
int last()
Gets the last value in the array- Returns:
- te last value in the array
-
-