Class IntervalTree.RBNode

java.lang.Object
com.github.basking2.sdsai.IntervalTree.RBNode
Enclosing class:
IntervalTree<K extends Comparable<K>,V>

public class IntervalTree.RBNode extends Object
How a tree is represented. The advantages to this internal class are: - Truly empty data structure state.
- We can avoid recursion when "appropriate."
- We can compute and save global info like tree size.
  • Field Details

  • Constructor Details

  • Method Details

    • copyData

      public void copyData(IntervalTree<K,V>.RBNode that)
      Copy data members (not tree structure members) from another RBNode. NOTE: This may make the max invalid. The function updateMax() should be called.
      Parameters:
      that - The node to copy data from.
      See Also:
    • print

      public void print(String s)
    • min

      protected IntervalTree<K,V>.RBNode min()
    • max

      protected IntervalTree<K,V>.RBNode max()
    • setMax

      protected void setMax(K max)
    • successor

      protected IntervalTree<K,V>.RBNode successor()
      Returns the successor to a node or RBNULL if there is none.
    • predecessor

      protected IntervalTree<K,V>.RBNode predecessor()
      Returns the predecessor to a node or RBNULL if there is none. Reverse of successor function.
    • rotateRight

      protected void rotateRight()
      Returns the new "top" of the sub tree.
    • rotateLeft

      protected void rotateLeft()
      Returns the new "top" of the sub tree.
    • insertFixup

      protected void insertFixup()
    • deleteFixup

      public void deleteFixup()
    • updateMax

      public void updateMax()
      Update the max value for this node, considering children that are not RBNULL and the interval. If this node is also RBNULL, this does nothing.
    • updateMaxAncestry

      public void updateMaxAncestry()
      Walk up the tree until we are at an RBNULL node and update the max value.
      See Also: