类 Node

java.lang.Object
org.bitlap.roaringbitmap.art.Node
直接已知子类:
LeafNode, Node16, Node256, Node4, Node48

public abstract class Node extends Object
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    protected short
     
    static final int
     
    protected NodeType
     
    protected byte[]
     
    protected byte
     
  • 构造器概要

    构造器
    构造器
    说明
    Node(NodeType nodeType, int compressedPrefixSize)
    constructor
  • 方法概要

    修饰符和类型
    方法
    说明
    static int
    binarySearch(byte[] key, int fromIndex, int toIndex, byte k)
    search the position of the input byte key in the node's key byte array part
    static void
    copyPrefix(Node src, Node dst)
    copy the prefix between two nodes
    static Node
    deserialize into a typed node from the byte stream
    static Node
    deserialize(ByteBuffer byteBuffer)
    deserialize into a typed node
    abstract Node
    getChild(int pos)
    get the child at the specified position in the node, the 'pos' range from 0 to count
    abstract byte
    getChildKey(int pos)
    get the corresponding key byte of the requested position
    abstract int
    getChildPos(byte k)
    get the position of a child corresponding to the input key 'k'
    abstract int
    get the max child's position
    abstract int
    get the position of the min element in current node.
    abstract org.bitlap.roaringbitmap.art.SearchResult
    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
    abstract int
    get the next position in the node
    abstract int
    get the next smaller element's position
    static Node
    insertLeaf(Node current, LeafNode childNode, byte key)
    insert the LeafNode as a child of the current internal node
    abstract Node
    remove(int pos)
    remove the specified position child
    abstract void
    replaceNode(int pos, Node freshOne)
    replace the position child to the fresh one
    void
    serialize(DataOutput dataOutput)
    serialize
    void
    serialize(ByteBuffer byteBuffer)
    serialize
    abstract int
    the serialized size except the common node header part
    int
    the serialized size in bytes of this node
    protected static byte[]
    sortSmallByteArray(byte[] key, Node[] children, int left, int right)
    sort the small arrays through the insertion sort alg.

    从类继承的方法 java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 字段详细资料

    • nodeType

      protected NodeType nodeType
    • prefixLength

      protected byte prefixLength
    • prefix

      protected byte[] prefix
    • count

      protected short count
    • ILLEGAL_IDX

      public static final int ILLEGAL_IDX
      另请参阅:
  • 构造器详细资料

    • Node

      public Node(NodeType nodeType, int compressedPrefixSize)
      constructor
      参数:
      nodeType - the node type
      compressedPrefixSize - the prefix byte array size,less than or equal to 6
  • 方法详细资料

    • sortSmallByteArray

      protected static byte[] sortSmallByteArray(byte[] key, Node[] children, int left, int right)
      sort the small arrays through the insertion sort alg.
    • getChildPos

      public abstract int getChildPos(byte k)
      get the position of a child corresponding to the input key 'k'
      参数:
      k - a key value of the byte range
      返回:
      the child position corresponding to the key 'k'
    • getNearestChildPos

      public abstract org.bitlap.roaringbitmap.art.SearchResult getNearestChildPos(byte key)
      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
      参数:
      key - a key value of the byte range
      返回:
      a result indicating whether or not the key was found and the positions of the child corresponding to it or its neighbours
    • getChildKey

      public abstract byte getChildKey(int pos)
      get the corresponding key byte of the requested position
      参数:
      pos - the position
      返回:
      the corresponding key byte
    • getChild

      public abstract Node getChild(int pos)
      get the child at the specified position in the node, the 'pos' range from 0 to count
      参数:
      pos - the position
      返回:
      a Node corresponding to the input position
    • replaceNode

      public abstract void replaceNode(int pos, Node freshOne)
      replace the position child to the fresh one
      参数:
      pos - the position
      freshOne - the fresh node to replace the old one
    • getMinPos

      public abstract int getMinPos()
      get the position of the min element in current node.
      返回:
      the minimum key's position
    • getNextLargerPos

      public abstract int getNextLargerPos(int pos)
      get the next position in the node
      参数:
      pos - current position,-1 to start from the min one
      返回:
      the next larger byte key's position which is close to 'pos' position,-1 for end
    • getMaxPos

      public abstract int getMaxPos()
      get the max child's position
      返回:
      the max byte key's position
    • getNextSmallerPos

      public abstract int getNextSmallerPos(int pos)
      get the next smaller element's position
      参数:
      pos - the position,-1 to start from the largest one
      返回:
      the next smaller key's position which is close to input 'pos' position,-1 for end
    • remove

      public abstract Node remove(int pos)
      remove the specified position child
      参数:
      pos - the position to remove
      返回:
      an adaptive changed fresh node of the current node
    • serialize

      public void serialize(DataOutput dataOutput) throws IOException
      serialize
      参数:
      dataOutput - the DataOutput
      抛出:
      IOException - signal a exception happened while the serialization
    • serialize

      public void serialize(ByteBuffer byteBuffer) throws IOException
      serialize
      参数:
      byteBuffer - the ByteBuffer
      抛出:
      IOException - signal a exception happened while the serialization
    • serializeSizeInBytes

      public int serializeSizeInBytes()
      the serialized size in bytes of this node
      返回:
      the size in bytes
    • deserialize

      public static Node deserialize(DataInput dataInput) throws IOException
      deserialize into a typed node from the byte stream
      参数:
      dataInput - the input byte stream
      返回:
      the typed node
      抛出:
      IOException - indicate a exception happened
    • deserialize

      public static Node deserialize(ByteBuffer byteBuffer) throws IOException
      deserialize into a typed node
      参数:
      byteBuffer - the ByteBuffer
      返回:
      the typed node
      抛出:
      IOException - indicate a exception happened
    • serializeNodeBodySizeInBytes

      public abstract int serializeNodeBodySizeInBytes()
      the serialized size except the common node header part
      返回:
      the size in bytes
    • insertLeaf

      public static Node insertLeaf(Node current, LeafNode childNode, byte key)
      insert the LeafNode as a child of the current internal node
      参数:
      current - current internal node
      childNode - the leaf node
      key - the key byte reference to the child leaf node
      返回:
      an adaptive changed node of the input 'current' node
    • copyPrefix

      public static void copyPrefix(Node src, Node dst)
      copy the prefix between two nodes
      参数:
      src - the source node
      dst - the destination node
    • binarySearch

      public static int binarySearch(byte[] key, int fromIndex, int toIndex, byte k)
      search the position of the input byte key in the node's key byte array part
      参数:
      key - the input key byte array
      fromIndex - inclusive
      toIndex - exclusive
      k - the target key byte value
      返回:
      the array offset of the target input key 'k' or -1 to not found