Package org.roaringbitmap.art
Class Node48
java.lang.Object
org.roaringbitmap.art.Node
org.roaringbitmap.art.Node48
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int
(package private) long[]
(package private) Node[]
(package private) static final byte
(package private) static final int
(package private) static final long
(package private) static final int
(package private) static final int
Fields inherited from class org.roaringbitmap.art.Node
count, ILLEGAL_IDX, nodeType, prefix, prefixLength
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static byte
childrenIdx
(int pos, long[] childIndex) void
deserializeNodeBody
(DataInput dataInput) deserialize the node's body contentvoid
deserializeNodeBody
(ByteBuffer byteBuffer) deserialize the node's body contentgetChild
(int pos) get the child at the specified position in the node, the 'pos' range from 0 to countbyte
getChildKey
(int pos) get the corresponding key byte of the requested positionint
getChildPos
(byte k) get the position of a child corresponding to the input key 'k'int
get the max child's positionint
get the position of the min element in current node.getNearestChildPos
(byte k) get the position of a child corresponding to the input key 'k' if present if 'k' is not in the child, return the positions of the neighbouring nodes insteadint
getNextLargerPos
(int pos) get the next position in the nodeint
getNextSmallerPos
(int pos) get the next smaller element's positionstatic Node
insert a child node into the node48 node with the key byteremove
(int pos) remove the specified position childvoid
replaceChildren
(Node[] children) replace the node's children according to the given children parameter while doing the deserialization phase.void
replaceNode
(int pos, Node freshOne) replace the position child to the fresh onevoid
serializeNodeBody
(DataOutput dataOutput) serialize the node's body contentvoid
serializeNodeBody
(ByteBuffer byteBuffer) serialize the node's body contentint
the serialized size except the common node header part(package private) static void
setOneByte
(int pos, byte v, long[] childIndex) Methods inherited from class org.roaringbitmap.art.Node
binarySearch, binarySearchWithResult, copyPrefix, deserialize, deserialize, insertLeaf, serialize, serialize, serializeSizeInBytes, sortSmallByteArray
-
Field Details
-
BYTES_PER_LONG
static final int BYTES_PER_LONG- See Also:
-
LONGS_USED
static final int LONGS_USED- See Also:
-
INDEX_SHIFT
static final int INDEX_SHIFT- See Also:
-
POS_MASK
static final int POS_MASK- See Also:
-
childIndex
long[] childIndex -
children
Node[] children -
EMPTY_VALUE
static final byte EMPTY_VALUE- See Also:
-
INIT_LONG_VALUE
static final long INIT_LONG_VALUE- See Also:
-
-
Constructor Details
-
Node48
public Node48(int compressedPrefixSize)
-
-
Method Details
-
getChildPos
public int getChildPos(byte k) Description copied from class:Node
get the position of a child corresponding to the input key 'k'- Specified by:
getChildPos
in classNode
- Parameters:
k
- a key value of the byte range- Returns:
- the child position corresponding to the key 'k'
-
getNearestChildPos
Description copied from class:Node
get the position of a child corresponding to the input key 'k' if present if 'k' is not in the child, return the positions of the neighbouring nodes instead- Specified by:
getNearestChildPos
in classNode
- Parameters:
k
- a key value of the byte range- Returns:
- a result indicating whether or not the key was found and the positions of the child corresponding to it or its neighbours
-
getChildKey
public byte getChildKey(int pos) Description copied from class:Node
get the corresponding key byte of the requested position- Specified by:
getChildKey
in classNode
- Parameters:
pos
- the position- Returns:
- the corresponding key byte
-
getChild
Description copied from class:Node
get the child at the specified position in the node, the 'pos' range from 0 to count -
replaceNode
Description copied from class:Node
replace the position child to the fresh one- Specified by:
replaceNode
in classNode
- Parameters:
pos
- the positionfreshOne
- the fresh node to replace the old one
-
getMinPos
public int getMinPos()Description copied from class:Node
get the position of the min element in current node. -
getNextLargerPos
public int getNextLargerPos(int pos) Description copied from class:Node
get the next position in the node- Specified by:
getNextLargerPos
in classNode
- Parameters:
pos
- current position,-1 to start from the min one- Returns:
- the next larger byte key's position which is close to 'pos' position,-1 for end
-
getMaxPos
public int getMaxPos()Description copied from class:Node
get the max child's position -
getNextSmallerPos
public int getNextSmallerPos(int pos) Description copied from class:Node
get the next smaller element's position- Specified by:
getNextSmallerPos
in classNode
- Parameters:
pos
- the position,-1 to start from the largest one- Returns:
- the next smaller key's position which is close to input 'pos' position,-1 for end
-
insert
insert a child node into the node48 node with the key byte- Parameters:
currentNode
- the node4child
- the child nodekey
- the key byte- Returns:
- the node48 or an adaptive generated node256
-
remove
Description copied from class:Node
remove the specified position child -
serializeNodeBody
Description copied from class:Node
serialize the node's body content- Specified by:
serializeNodeBody
in classNode
- Parameters:
dataOutput
- the DataOutput- Throws:
IOException
- exception indicates serialization errors
-
serializeNodeBody
Description copied from class:Node
serialize the node's body content- Specified by:
serializeNodeBody
in classNode
- Parameters:
byteBuffer
- the ByteBuffer- Throws:
IOException
- exception indicates serialization errors
-
deserializeNodeBody
Description copied from class:Node
deserialize the node's body content- Specified by:
deserializeNodeBody
in classNode
- Parameters:
dataInput
- the DataInput- Throws:
IOException
- exception indicates deserialization errors
-
deserializeNodeBody
Description copied from class:Node
deserialize the node's body content- Specified by:
deserializeNodeBody
in classNode
- Parameters:
byteBuffer
- the ByteBuffer- Throws:
IOException
- exception indicates deserialization errors
-
serializeNodeBodySizeInBytes
public int serializeNodeBodySizeInBytes()Description copied from class:Node
the serialized size except the common node header part- Specified by:
serializeNodeBodySizeInBytes
in classNode
- Returns:
- the size in bytes
-
replaceChildren
Description copied from class:Node
replace the node's children according to the given children parameter while doing the deserialization phase.- Specified by:
replaceChildren
in classNode
- Parameters:
children
- all the not null children nodes in key byte ascending order,no null element
-
childrenIdx
private static byte childrenIdx(int pos, long[] childIndex) -
setOneByte
static void setOneByte(int pos, byte v, long[] childIndex)
-