Class TreeSecondary<T>

java.lang.Object
components.tree.TreeSecondary<T>
Type Parameters:
T - type of Tree labels
All Implemented Interfaces:
Standard<Tree<T>>, Tree<T>, TreeKernel<T>, Iterable<T>
Direct Known Subclasses:
Tree1

public abstract class TreeSecondary<T> extends Object implements Tree<T>
Layered implementations of secondary methods for Tree.
  • Constructor Details

  • Method Details

    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • root

      public T root()
      Description copied from interface: Tree
      Reports the root of this.
      Specified by:
      root in interface Tree<T>
      Returns:
      the root entry of this
    • replaceRoot

      public T replaceRoot(T x)
      Description copied from interface: Tree
      Replaces the root of this with x, and returns the old root.
      Specified by:
      replaceRoot in interface Tree<T>
      Parameters:
      x - the new root
      Returns:
      the old root
    • height

      public int height()
      Description copied from interface: Tree
      Reports the height of this.
      Specified by:
      height in interface Tree<T>
      Returns:
      the height
    • addSubtree

      public void addSubtree(int pos, Tree<T> st)
      Description copied from interface: Tree
      Adds the tree st at position pos in this; the declaration notwithstanding, the dynamic type of st must be the same as the dynamic type of this.
      Specified by:
      addSubtree in interface Tree<T>
      Parameters:
      pos - the position at which to add st
      st - the Tree to add
    • removeSubtree

      public Tree<T> removeSubtree(int pos)
      Description copied from interface: Tree
      Removes and returns the subtree at position pos in this.
      Specified by:
      removeSubtree in interface Tree<T>
      Parameters:
      pos - the position of the subtree to remove
      Returns:
      the subtree at position pos in this
    • numberOfSubtrees

      public int numberOfSubtrees()
      Description copied from interface: Tree
      Returns the number of subtrees of the root of this.
      Specified by:
      numberOfSubtrees in interface Tree<T>
      Returns:
      the number of subtrees of the root of this