Package org.roaringbitmap.art
Class Containers
java.lang.Object
org.roaringbitmap.art.Containers
To support the largest 2^48 different keys,we almost need 2^18 Container arrays which holds 2^31
- 8 Container
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate long
private int
private static final int
private static final int
private static final byte
private static final byte
private static final byte
private int
private static final byte
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
addContainer
(Container container) add a Containerprivate byte
containerType
(Container container) void
deserialize
(DataInput dataInput) Deserialize the byte stream to init this Containersvoid
deserialize
(ByteBuffer byteBuffer) Deserialize the byte stream to init this ContainersgetContainer
(long idx) get the Container with the corresponding container indexlong
the number of all the holding containersprivate void
grow
(int minCapacity, int firstLevelIdx) increases the capacity to ensure that it can hold at least the number of elements specified by the minimum capacity argument.private static int
hugeCapacity
(int minCapacity) private Container
instanceContainer
(byte containerType, int cardinality, DataInput dataInput) private Container
instanceContainer
(byte containerType, int cardinality, ByteBuffer byteBuffer) iterator()
a iterator of the Containersvoid
remove
(long containerIdx) remove the container index Containervoid
replace with a fresh Containervoid
replace the container index one with a fresh Containerprivate void
reset()
void
serialize
(DataOutput dataOutput) Serialize the Containersvoid
serialize
(ByteBuffer byteBuffer) Serialize the Containerslong
Report the number of bytes required for serialization.(package private) static long
toContainerIdx
(int firstLevelIdx, int secondLevelIdx)
-
Field Details
-
containerArrays
-
containerSize
private long containerSize -
firstLevelIdx
private int firstLevelIdx -
secondLevelIdx
private int secondLevelIdx -
MAX_JVM_ARRAY_LENGTH
private static final int MAX_JVM_ARRAY_LENGTH- See Also:
-
MAX_JVM_ARRAY_OFFSET
private static final int MAX_JVM_ARRAY_OFFSET- See Also:
-
NULL_MARK
private static final byte NULL_MARK- See Also:
-
NOT_NULL_MARK
private static final byte NOT_NULL_MARK- See Also:
-
TRIMMED_MARK
private static final byte TRIMMED_MARK- See Also:
-
NOT_TRIMMED_MARK
private static final byte NOT_TRIMMED_MARK- See Also:
-
-
Constructor Details
-
Containers
public Containers()Constructor
-
-
Method Details
-
reset
private void reset() -
remove
public void remove(long containerIdx) remove the container index Container- Parameters:
containerIdx
- the container index
-
getContainer
get the Container with the corresponding container index- Parameters:
idx
- the container index- Returns:
- the corresponding Container
-
addContainer
add a Container- Parameters:
container
- a Container- Returns:
- the container index
-
iterator
a iterator of the Containers- Returns:
- a iterator
-
replace
replace the container index one with a fresh Container- Parameters:
containerIdx
- the container index to replacefreshContainer
- the fresh one
-
replace
replace with a fresh Container- Parameters:
firstLevelIdx
- the first level array indexsecondLevelIdx
- the second level array indexfreshContainer
- a fresh container
-
getContainerSize
public long getContainerSize()the number of all the holding containers- Returns:
- the container number
-
getContainerArrays
-
toContainerIdx
static long toContainerIdx(int firstLevelIdx, int secondLevelIdx) -
grow
private void grow(int minCapacity, int firstLevelIdx) increases the capacity to ensure that it can hold at least the number of elements specified by the minimum capacity argument.- Parameters:
minCapacity
- the desired minimum capacity
-
hugeCapacity
private static int hugeCapacity(int minCapacity) -
serializedSizeInBytes
public long serializedSizeInBytes()Report the number of bytes required for serialization.- Returns:
- The size in bytes
-
serialize
Serialize the Containers- Parameters:
dataOutput
- The destination DataOutput- Throws:
IOException
- Signals that an I/O exception has occurred.
-
serialize
Serialize the Containers- Parameters:
byteBuffer
- The destination ByteBuffer- Throws:
IOException
- Signals that an I/O exception has occurred.
-
deserialize
Deserialize the byte stream to init this Containers- Parameters:
dataInput
- The DataInput- Throws:
IOException
- Signals that an I/O exception has occurred.
-
deserialize
Deserialize the byte stream to init this Containers- Parameters:
byteBuffer
- The DataInput- Throws:
IOException
- Signals that an I/O exception has occurred.
-
containerType
-
instanceContainer
private Container instanceContainer(byte containerType, int cardinality, DataInput dataInput) throws IOException - Throws:
IOException
-
instanceContainer
private Container instanceContainer(byte containerType, int cardinality, ByteBuffer byteBuffer) throws IOException - Throws:
IOException
-