Interface SerializationNode<VALUE>


  • public interface SerializationNode<VALUE>
    An abstraction of a node given to the trie serializer to write.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      int childCount()
      The number of children of the node.
      long maxPositionDelta​(long nodePosition)
      Returns the furthest distance that needs to be written to store this node, i.e.
      VALUE payload()
      The payload of the node if the node has any associated, otherwise null.
      long serializedPositionDelta​(int i, long nodePosition)
      Returns the distance between this node's position and the child at index i.
      int transition​(int i)
      The transition character for the child at position i.
    • Method Detail

      • childCount

        int childCount()
        The number of children of the node.
      • payload

        VALUE payload()
        The payload of the node if the node has any associated, otherwise null.
      • transition

        int transition​(int i)
        The transition character for the child at position i. Must be an integer between 0 and 255.
      • serializedPositionDelta

        long serializedPositionDelta​(int i,
                                     long nodePosition)
        Returns the distance between this node's position and the child at index i. Given as a difference calculation to be able to handle two different types of calls: - writing nodes where all children's positions are already completely determined - sizing and writing branches within a page where we don't know where we'll actually place the nodes, but we know how far backward the child nodes will end up
      • maxPositionDelta

        long maxPositionDelta​(long nodePosition)
        Returns the furthest distance that needs to be written to store this node, i.e. min(serializedPositionDelta(i, nodePosition) for 0 <= i < childCount()) Given separately as the loop above can be inefficient (e.g. when children are not yet written).