java.lang.Object
org.bitlap.roaringbitmap.RoaringArray
- 所有已实现的接口:
Externalizable,Serializable,Cloneable,AppendableStorage<Container>
public final class RoaringArray
extends Object
implements Cloneable, Externalizable, AppendableStorage<Container>
Specialized array to store the containers used by a RoaringBitmap. This is not meant to be used
by end users.
- 另请参阅:
-
构造器概要
构造器构造器说明create RoaringArray with initial capacityRoaringArray(char[] keys, Container[] values, int size) create RoaringArrayRoaringArray(int initialCapacity) create RoaringArray -
方法概要
修饰符和类型方法说明intadvanceUntil(char x, int pos) Find the smallest integer index larger than pos such that array[index].key>=x.voidAppends the key and container to the storage, throws if the key is less than the current mark.voidappend(RoaringArray roaringArray) append a roaringArrayvoidappend(RoaringArray sa, int startingIndex, int end) Append the values from another array, no copy is made (use with care)voidclear()clearclone()voiddeserialize(DataInput in) Deserialize.voiddeserialize(DataInput in, byte[] buffer) Deserialize.voiddeserialize(ByteBuffer bbf) Deserialize (retrieve) this bitmap.booleanintfirst()Gets the first value in the arraygetContainer(char x) involves a binary searchgetContainerAtIndex(int i) intgetContainerIndex(char x) Create a ContainerPointer for this RoaringArraygetContainerPointer(int startIndex) Create a ContainerPointer for this RoaringArraychargetKeyAtIndex(int i) getKeyAtIndexchar[]getKeys()inthashCode()booleanhasRunContainerintheaderSizeintlast()Gets the last value in the arrayvoidvoidserialize(DataOutput out) Serialize.voidserialize(ByteBuffer buffer) Serialize.intReport the number of bytes required for serialization.voidsetContainerAtIndex(int i, Container c) intsize()voidtrim()If possible, recover wasted memory.void
-
构造器详细资料
-
RoaringArray
public RoaringArray()create RoaringArray with initial capacity -
RoaringArray
public RoaringArray(int initialCapacity) create RoaringArray- 参数:
initialCapacity- initialCapacity
-
RoaringArray
create RoaringArray- 参数:
keys- keysvalues- valuessize- size
-
-
方法详细资料
-
getKeys
public char[] getKeys() -
getValues
-
advanceUntil
public int advanceUntil(char x, int pos) Find the smallest integer index larger than pos such that array[index].key>=x. If none can be found, return size. Based on code by O. Kaser.- 参数:
x- minimal valuepos- index to exceed- 返回:
- the smallest index greater than pos such that array[index].key 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<Container>- 参数:
key- the key to appendvalue- the data to append
-
append
append a roaringArray- 参数:
roaringArray- roaringArray
-
append
Append the values from another array, no copy is made (use with care)- 参数:
sa- other arraystartingIndex- starting index in the other arrayend- endingIndex (exclusive) in the other array
-
clear
public void clear()clear -
trim
public void trim()If possible, recover wasted memory. -
clone
- 覆盖:
clone在类中Object- 抛出:
CloneNotSupportedException
-
deserialize
Deserialize. If the DataInput is available as a byte[] or a ByteBuffer, you could prefer relying ondeserialize(ByteBuffer). If the InputStream is >= 8kB, you could prefer relying ondeserialize(DataInput, byte[]);- 参数:
in- the DataInput stream- 抛出:
IOException- Signals that an I/O exception has occurred.InvalidRoaringFormat- if a Roaring Bitmap cookie is missing.
-
deserialize
Deserialize.- 参数:
in- the DataInput streambuffer- The buffer gets overwritten with data during deserialization. You can pass a NULL reference as a buffer. A buffer containing at least 8192 bytes might be ideal for performance. It is recommended to reuse the buffer between calls to deserialize (in a single-threaded context) for best performance.- 抛出:
IOException- Signals that an I/O exception has occurred.InvalidRoaringFormat- if a Roaring Bitmap cookie is missing.
-
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.
-
equals
-
getContainer
involves a binary search- 参数:
x- x- 返回:
- container
-
getContainerIndex
public int getContainerIndex(char x) -
getContainerAtIndex
-
getContainerPointer
Create a ContainerPointer for this RoaringArray- 返回:
- a ContainerPointer
-
getContainerPointer
Create a ContainerPointer for this RoaringArray- 参数:
startIndex- starting index in the container list- 返回:
- a ContainerPointer
-
getKeyAtIndex
public char getKeyAtIndex(int i) getKeyAtIndex- 参数:
i- i- 返回:
- char
-
hashCode
public int hashCode() -
hasRunContainer
public boolean hasRunContainer()hasRunContainer- 返回:
- boolean
-
headerSize
public int headerSize()headerSize- 返回:
- int
-
readExternal
- 指定者:
readExternal在接口中Externalizable- 抛出:
IOException
-
serialize
Serialize. The current bitmap is not modified.- 参数:
out- the DataOutput stream- 抛出:
IOException- Signals that an I/O exception has occurred.
-
serialize
Serialize. The current bitmap is not modified.- 参数:
buffer- the ByteBuffer to write to
-
serializedSizeInBytes
public int serializedSizeInBytes()Report the number of bytes required for serialization.- 返回:
- the size in bytes
-
setContainerAtIndex
-
size
public int size() -
writeExternal
- 指定者:
writeExternal在接口中Externalizable- 抛出:
IOException
-
first
public int first()Gets the first value in the array- 返回:
- the first value in the array
- 抛出:
NoSuchElementException- if empty
-
last
public int last()Gets the last value in the array- 返回:
- the last value in the array
- 抛出:
NoSuchElementException- if empty
-