Package org.roaringbitmap.art
Class LeafNode
- java.lang.Object
-
- org.roaringbitmap.art.Node
-
- org.roaringbitmap.art.LeafNode
-
public class LeafNode extends Node
-
-
Field Summary
Fields Modifier and Type Field Description static int
LEAF_NODE_KEY_LENGTH_IN_BYTES
-
Fields inherited from class org.roaringbitmap.art.Node
count, ILLEGAL_IDX, nodeType, prefix, prefixLength
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deserializeNodeBody(java.io.DataInput dataInput)
void
deserializeNodeBody(java.nio.ByteBuffer byteBuffer)
Node
getChild(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'long
getContainerIdx()
byte[]
getKeyBytes()
int
getMaxPos()
get the max child's positionint
getMinPos()
get the position of the min element in current node.int
getNextLargerPos(int pos)
get the next position in the nodeint
getNextSmallerPos(int pos)
get the next smaller element's positionNode
remove(int pos)
remove the specified position childvoid
replaceChildren(Node[] children)
void
replaceNode(int pos, Node freshOne)
replace the position child to the fresh onevoid
serializeNodeBody(java.io.DataOutput dataOutput)
void
serializeNodeBody(java.nio.ByteBuffer byteBuffer)
int
serializeNodeBodySizeInBytes()
the serialized size except the common node header part-
Methods inherited from class org.roaringbitmap.art.Node
binarySearch, copyPrefix, deserialize, deserialize, insertLeaf, serialize, serialize, serializeSizeInBytes
-
-
-
-
Field Detail
-
LEAF_NODE_KEY_LENGTH_IN_BYTES
public static final int LEAF_NODE_KEY_LENGTH_IN_BYTES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LeafNode
public LeafNode(byte[] key, long containerIdx)
constructor- Parameters:
key
- the 48 bitcontainerIdx
- the corresponding container index
-
LeafNode
public LeafNode(long key, long containerIdx)
constructor- Parameters:
key
- a long value ,only the high 48 bit is valuablecontainerIdx
- the corresponding container index
-
-
Method Detail
-
serializeNodeBody
public void serializeNodeBody(java.io.DataOutput dataOutput) throws java.io.IOException
- Throws:
java.io.IOException
-
serializeNodeBody
public void serializeNodeBody(java.nio.ByteBuffer byteBuffer) throws java.io.IOException
- Throws:
java.io.IOException
-
deserializeNodeBody
public void deserializeNodeBody(java.io.DataInput dataInput) throws java.io.IOException
- Throws:
java.io.IOException
-
deserializeNodeBody
public void deserializeNodeBody(java.nio.ByteBuffer byteBuffer) throws java.io.IOException
- Throws:
java.io.IOException
-
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
-
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'
-
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
public Node getChild(int pos)
Description copied from class:Node
get the child at the specified position in the node, the 'pos' range from 0 to count
-
replaceNode
public void replaceNode(int pos, Node freshOne)
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
-
remove
public Node remove(int pos)
Description copied from class:Node
remove the specified position child
-
replaceChildren
public void replaceChildren(Node[] children)
-
getContainerIdx
public long getContainerIdx()
-
getKeyBytes
public byte[] getKeyBytes()
-
-