Class AbstractSparseArray.Node<V>

java.lang.Object
com.tangosol.util.AbstractSparseArray.Node<V>
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
PrimitiveSparseArray.PrimitiveNode, SparseArray.ObjectNode
Enclosing class:
AbstractSparseArray<V>

protected abstract static class AbstractSparseArray.Node<V> extends Object implements Cloneable, Serializable
An AVL tree node. This class is used only within the AbstractSparseArray class and its derivations.
See Also:
  • Field Details

    • key

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

      protected AbstractSparseArray.Node<V> parent
      The parent of this node.
    • left

      protected AbstractSparseArray.Node<V> left
      The left child of this node.
    • balance

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

    • Node

      protected Node()
  • Method Details

    • 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
    • clone

      public AbstractSparseArray.Node<V> clone()
      Make a shallow copy of the node and its sub-nodes.
      Overrides:
      clone 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