Class Node4


public class Node4 extends BranchNode
  • Constructor Details

    • Node4

      public Node4(int compressedPrefixSize)
  • Method Details

    • clone

      protected Node4 clone()
      Specified by:
      clone in class Node
    • nodeType

      protected NodeType nodeType()
      Specified by:
      nodeType in class BranchNode
    • getChildPos

      public int getChildPos(byte k)
      Description copied from class: BranchNode
      get the position of a child corresponding to the input key 'k'
      Specified by:
      getChildPos in class BranchNode
      Parameters:
      k - a key value of the byte range
      Returns:
      the child position corresponding to the key 'k'
    • getNearestChildPos

      public org.roaringbitmap.art.SearchResult getNearestChildPos(byte k)
      Description copied from class: BranchNode
      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 class BranchNode
      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: BranchNode
      get the corresponding key byte of the requested position
      Specified by:
      getChildKey in class BranchNode
      Parameters:
      pos - the position
      Returns:
      the corresponding key byte
    • getChild

      public Node getChild(int pos)
      Description copied from class: BranchNode
      get the child at the specified position in the node, the 'pos' range from 0 to count
      Specified by:
      getChild in class BranchNode
      Parameters:
      pos - the position
      Returns:
      a Node corresponding to the input position
    • getChildAtKey

      public Node getChildAtKey(byte key)
      Description copied from class: BranchNode
      get the child at the specified key in the node. the behavior is equivalent to int pos = getChildPos(key); return (pos != ILLEGAL_IDX) ? getChild(pos) : null; but subclasses may be able to provide a more efficient implementation
      Specified by:
      getChildAtKey in class BranchNode
      Parameters:
      key - the position
      Returns:
      a Node corresponding to the input position, or null if not found
    • replaceNode

      public void replaceNode(int pos, Node freshOne)
      Description copied from class: BranchNode
      replace the position child to the fresh one
      Specified by:
      replaceNode in class BranchNode
      Parameters:
      pos - the position
      freshOne - the fresh node to replace the old one
    • getMinPos

      public int getMinPos()
      Description copied from class: BranchNode
      get the position of the min element in current node.
      Specified by:
      getMinPos in class BranchNode
      Returns:
      the minimum key's position
    • getNextLargerPos

      public int getNextLargerPos(int pos)
      Description copied from class: BranchNode
      get the next position in the node
      Specified by:
      getNextLargerPos in class BranchNode
      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: BranchNode
      get the max child's position
      Specified by:
      getMaxPos in class BranchNode
      Returns:
      the max byte key's position
    • getNextSmallerPos

      public int getNextSmallerPos(int pos)
      Description copied from class: BranchNode
      get the next smaller element's position
      Specified by:
      getNextSmallerPos in class BranchNode
      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

      protected BranchNode insert(Node childNode, byte key)
      insert the child node into this with the key byte
      Specified by:
      insert in class BranchNode
      Parameters:
      childNode - the child node
      key - the key byte
      Returns:
      the input node4 or an adaptive generated node16
    • remove

      public Node remove(int pos)
      Description copied from class: BranchNode
      remove the specified position child
      Specified by:
      remove in class BranchNode
      Parameters:
      pos - the position to remove
      Returns:
      an adaptive changed fresh node of the current node
    • serializeNodeBody

      public void serializeNodeBody(DataOutput dataOutput) throws IOException
      Throws:
      IOException
    • serializeNodeBody

      public void serializeNodeBody(ByteBuffer byteBuffer) throws IOException
      serialize the node's body content
      Throws:
      IOException
    • deserializeNodeBody

      public void deserializeNodeBody(DataInput dataInput) throws IOException
      Throws:
      IOException
    • deserializeNodeBody

      public void deserializeNodeBody(ByteBuffer byteBuffer) throws IOException
      deserialize the node's body content
      Throws:
      IOException
    • serializeNodeBodySizeInBytes

      public int serializeNodeBodySizeInBytes()
      Description copied from class: Node
      the serialized size except the common node header part
      Specified by:
      serializeNodeBodySizeInBytes in class Node
      Returns:
      the size in bytes
    • replaceChildren

      public void replaceChildren(Node[] children)