Package org.roaringbitmap.buffer
Interface PointableRoaringArray
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
ImmutableRoaringArray
,MutableRoaringArray
Generic interface for the array underlying roaring bitmap classes.
-
Method Summary
Modifier and TypeMethodDescriptionint
advanceUntil
(char x, int pos) Find the smallest integer index larger than pos such that getKeyAtIndex(index)>=x.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 smallest unsigned (first) integer in the array.int
Gets the smallest signed integer in the array.int
getCardinality
(int i) Returns the cardinality of the container at the given index.getContainerAtIndex
(int i) int
getContainerIndex
(char x) Returns either the index of the container corresponding to key x, or a negative value.getContainerPointer
(int startIndex) int
getIndex
(char x) char
getKeyAtIndex
(int i) boolean
Check whether this bitmap has had its runs compressed.int
last()
Gets the largest unsigned (last) integer in the array.int
Gets the largest signed integer in the array.void
serialize
(DataOutput out) Serialize.void
serialize
(ByteBuffer buffer) Serialize.int
int
size()
-
Method Details
-
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
- Parameters:
i
- index- Returns:
- matching container
-
getContainerPointer
MappeableContainerPointer getContainerPointer()- Returns:
- a ContainerPointer to iterator over the array
-
getContainerPointer
- 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
Serialize. The current bitmap is not modified.- Parameters:
out
- the DataOutput stream- Throws:
IOException
- Signals that an I/O exception has occurred.
-
serialize
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 smallest unsigned (first) integer in the array.- Returns:
- the smallest unsigned (first) integer in the array
-
last
int last()Gets the largest unsigned (last) integer in the array.- Returns:
- the largest unsigned (last) integer in the array
-
firstSigned
int firstSigned()Gets the smallest signed integer in the array.- Returns:
- the smallest signed integer in the array
-
lastSigned
int lastSigned()Gets the largest signed integer in the array.- Returns:
- the largest signed integer in the array
-