Class AbstractSparseArray.Node<V>

    • Field Detail

      • key

        protected long key
        The key of the node. The key, once set, is considered immutable.
      • balance

        protected int balance
        The AVL balance factor of the sub-tree.
    • Constructor Detail

      • Node

        protected Node()
    • Method Detail

      • adopt

        protected void adopt​(AbstractSparseArray.Node<V> child,
                             boolean fLeft)
        Adopt a child node
        Parameters:
        child - the child to adopt
        fLeft - the position of the child
      • getValue

        public abstract V getValue()
        Get the value associated with the node.
        Returns:
        the value associated with the node.
      • setValue

        public abstract V setValue​(V oValue)
        Set the value associated with the node.
        Parameters:
        oValue - the value associated with the node
        Returns:
        the old value associated with the node
      • toString

        public String toString()
        Provide a string representation of this node's value.
        Overrides:
        toString in class Object
      • isLeaf

        protected boolean isLeaf()
        Determine if this node is a part of a 2-3-4 leaf node (i.e. at least one null child).
        Returns:
        true if this node is a leaf
      • isLinked

        protected boolean isLinked()
        Return true iff the node is linked to other nodes.
        Returns:
        true iff the node has a parent or children
      • print

        protected void print()
        Print the tree structure.
      • validate

        protected int validate()
        Validate the tree rooted at node is a proper AVL tree.
        Returns:
        the height of the node within the tree