java.lang.Object
org.bitlap.roaringbitmap.buffer.MutableRoaringArray
- 所有已实现的接口:
Externalizable,Serializable,Cloneable,AppendableStorage<MappeableContainer>,PointableRoaringArray
public final class MutableRoaringArray
extends Object
implements Cloneable, Externalizable, PointableRoaringArray, AppendableStorage<MappeableContainer>
Specialized array to store the containers used by a RoaringBitmap. This class is similar to
org.roaringbitmap.RoaringArray but meant to be used with memory mapping. This is not meant to be
used by end users.
Objects of this class reside in RAM.
- 另请参阅:
-
字段概要
字段修饰符和类型字段说明protected static final intprotected static final intprotected static final shortprotected static final short -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明intadvanceUntil(char x, int pos) Find the smallest integer index larger than pos such that getKeyAtIndex(index)>=x.voidappend(char key, MappeableContainer value) Appends the key and container to the storage, throws if the key is less than the current mark.protected voidappendCopiesAfter(PointableRoaringArray highLowContainer, char beforeStart) Append copies of the values AFTER a specified key (may or may not be present) to end.protected voidappendCopiesUntil(PointableRoaringArray highLowContainer, char stoppingKey) Append copies of the values from another array, from the startprotected voidappendCopy(char key, MappeableContainer value) protected voidappendCopy(PointableRoaringArray highLowContainer, int startingIndex, int end) Append copies of the values from another arrayprotected voidclear()clone()Create an independent copy of the underlying arraybooleancontainsForContainerAtIndex(int i, char x) This checks whether the container at index i has the value x.protected voidcopyRange(int begin, int end, int newBegin) voiddeserialize(DataInput in) Deserialize.voiddeserialize(ByteBuffer bbf) Deserialize (retrieve) this bitmap.booleanprotected voidextendArray(int k) intfirst()Gets the first value in the arrayintgetCardinality(int i) Returns the cardinality of the container at the given index.getContainerAtIndex(int i) intgetContainerIndex(char x) Returns either the index of the container corresponding to key x, or a negative value.getContainerPointer(int startIndex) intgetIndex(char x) chargetKeyAtIndex(int i) inthashCode()booleanCheck whether this bitmap has had its runs compressed.protected intprotected voidinsertNewKeyValueAt(int i, char key, MappeableContainer value) intlast()Gets the last value in the arrayvoidprotected voidremoveAtIndex(int i) protected voidremoveIndexRange(int begin, int end) protected voidreplaceKeyAndContainerAtIndex(int i, char key, MappeableContainer c) protected voidresize(int newLength) voidserialize(DataOutput out) Serialize.voidserialize(ByteBuffer buffer) Serialize.intReport the number of bytes required for serialization.protected voidsetContainerAtIndex(int i, MappeableContainer c) intsize()voidtrim()If possible, recover wasted memory.void
-
字段详细资料
-
INITIAL_CAPACITY
protected static final int INITIAL_CAPACITY- 另请参阅:
-
SERIAL_COOKIE_NO_RUNCONTAINER
protected static final short SERIAL_COOKIE_NO_RUNCONTAINER- 另请参阅:
-
SERIAL_COOKIE
protected static final short SERIAL_COOKIE- 另请参阅:
-
NO_OFFSET_THRESHOLD
protected static final int NO_OFFSET_THRESHOLD- 另请参阅:
-
-
构造器详细资料
-
MutableRoaringArray
protected MutableRoaringArray() -
MutableRoaringArray
public MutableRoaringArray(int initialCapacity)
-
-
方法详细资料
-
advanceUntil
public int advanceUntil(char x, int pos) 从接口复制的说明:PointableRoaringArrayFind the smallest integer index larger than pos such that getKeyAtIndex(index)>=x. If none can be found, return size.- 指定者:
advanceUntil在接口中PointableRoaringArray- 参数:
x- minimal valuepos- index to exceed- 返回:
- the smallest index greater than pos such that getKeyAtIndex(index) is at least as large as min, or size if it is not possible.
-
append
从接口复制的说明:AppendableStorageAppends the key and container to the storage, throws if the key is less than the current mark.- 指定者:
append在接口中AppendableStorage<MappeableContainer>- 参数:
key- the key to appendvalue- the data to append
-
appendCopiesAfter
Append copies of the values AFTER a specified key (may or may not be present) to end.- 参数:
highLowContainer- the other arraybeforeStart- given key is the largest key that we won't copy
-
appendCopiesUntil
Append copies of the values from another array, from the start- 参数:
highLowContainer- the other arraystoppingKey- any equal or larger key in other array will terminate copying
-
appendCopy
Append copies of the values from another array- 参数:
highLowContainer- other arraystartingIndex- starting index in the other arrayend- last index array in the other array
-
appendCopy
-
clear
protected void clear() -
trim
public void trim()If possible, recover wasted memory. -
clone
从接口复制的说明:PointableRoaringArrayCreate an independent copy of the underlying array- 指定者:
clone在接口中PointableRoaringArray- 覆盖:
clone在类中Object- 返回:
- a copy
-
copyRange
protected void copyRange(int begin, int end, int newBegin) -
deserialize
Deserialize.- 参数:
in- the DataInput stream- 抛出:
IOException- Signals that an I/O exception has occurred.
-
deserialize
Deserialize (retrieve) this bitmap. See format specification at https://github.com/RoaringBitmap/RoaringFormatSpec The current bitmap is overwritten. It is not necessary that limit() on the input ByteBuffer indicates the end of the serialized data. After loading this RoaringBitmap, you can advance to the rest of the data (if there is more) by setting bbf.position(bbf.position() + bitmap.serializedSizeInBytes()); Note that the input ByteBuffer is effectively copied (with the slice operation) so you should expect the provided ByteBuffer position/mark/limit/order to remain unchanged.- 参数:
bbf- the byte buffer (can be mapped, direct, array backed etc.
-
extendArray
protected void extendArray(int k) -
getCardinality
public int getCardinality(int i) 从接口复制的说明:PointableRoaringArrayReturns the cardinality of the container at the given index. This method is expected to be fast.- 指定者:
getCardinality在接口中PointableRoaringArray- 参数:
i- index- 返回:
- the cardinality
-
getContainerIndex
public int getContainerIndex(char x) 从接口复制的说明:PointableRoaringArrayReturns either the index of the container corresponding to key x, or a negative value.- 指定者:
getContainerIndex在接口中PointableRoaringArray- 参数:
x- 16-bit key- 返回:
- index of container (negative value if no container found)
-
getContainerAtIndex
- 指定者:
getContainerAtIndex在接口中PointableRoaringArray- 参数:
i- index- 返回:
- matching container
-
getContainerPointer
- 指定者:
getContainerPointer在接口中PointableRoaringArray- 返回:
- a ContainerPointer to iterator over the array
-
getContainerPointer
- 指定者:
getContainerPointer在接口中PointableRoaringArray- 参数:
startIndex- starting index- 返回:
- a ContainerPointer to iterator over the array initially positioned at startIndex
-
getIndex
public int getIndex(char x) - 指定者:
getIndex在接口中PointableRoaringArray- 参数:
x- 16-bit key- 返回:
- corresponding index
-
getKeyAtIndex
public char getKeyAtIndex(int i) - 指定者:
getKeyAtIndex在接口中PointableRoaringArray- 参数:
i- the index- 返回:
- 16-bit key at the index
-
equals
-
hashCode
public int hashCode() -
hasRunCompression
public boolean hasRunCompression()从接口复制的说明:PointableRoaringArrayCheck whether this bitmap has had its runs compressed.- 指定者:
hasRunCompression在接口中PointableRoaringArray- 返回:
- whether this bitmap has run compression
-
headerSize
protected int headerSize() -
insertNewKeyValueAt
-
readExternal
- 指定者:
readExternal在接口中Externalizable- 抛出:
IOExceptionClassNotFoundException
-
removeAtIndex
protected void removeAtIndex(int i) -
removeIndexRange
protected void removeIndexRange(int begin, int end) -
replaceKeyAndContainerAtIndex
-
resize
protected void resize(int newLength) -
serialize
Serialize. The current bitmap is not modified.- 指定者:
serialize在接口中PointableRoaringArray- 参数:
out- the DataOutput stream- 抛出:
IOException- Signals that an I/O exception has occurred.
-
serialize
Serialize. The current bitmap is not modified.- 指定者:
serialize在接口中PointableRoaringArray- 参数:
buffer- the ByteBuffer to write to
-
serializedSizeInBytes
public int serializedSizeInBytes()Report the number of bytes required for serialization.- 指定者:
serializedSizeInBytes在接口中PointableRoaringArray- 返回:
- the size in bytes
-
setContainerAtIndex
-
size
public int size()- 指定者:
size在接口中PointableRoaringArray- 返回:
- number of keys
-
writeExternal
- 指定者:
writeExternal在接口中Externalizable- 抛出:
IOException
-
containsForContainerAtIndex
public boolean containsForContainerAtIndex(int i, char x) 从接口复制的说明:PointableRoaringArrayThis checks whether the container at index i has the value x. This can be faster than calling "getContainerAtIndex" and then calling contains.- 指定者:
containsForContainerAtIndex在接口中PointableRoaringArray- 参数:
i- container index (assumed to be non-negative)x- 16-bit value to check- 返回:
- whether the container contains at index i contains x
-
first
public int first()从接口复制的说明:PointableRoaringArrayGets the first value in the array- 指定者:
first在接口中PointableRoaringArray- 返回:
- te first value in the array
-
last
public int last()从接口复制的说明:PointableRoaringArrayGets the last value in the array- 指定者:
last在接口中PointableRoaringArray- 返回:
- te last value in the array
-