Package components.tree
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
Layered implementations of secondary methods for
Tree.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSubtree(int pos, Tree<T> st) Adds the treestat positionposinthis; the declaration notwithstanding, the dynamic type ofstmust be the same as the dynamic type ofthis.final booleaninthashCode()intheight()Reports the height ofthis.intReturns the number of subtrees of the root ofthis.removeSubtree(int pos) Removes and returns the subtree at positionposinthis.replaceRoot(T x) Replaces the root ofthiswithx, and returns the old root.root()Reports the root ofthis.toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, iterator, spliteratorMethods inherited from interface components.standard.Standard
clear, newInstance, transferFromMethods inherited from interface components.tree.TreeKernel
assemble, disassemble, newSequenceOfTree, size
-
Constructor Details
-
TreeSecondary
public TreeSecondary()
-
-
Method Details
-
equals
-
hashCode
-
toString
-
root
Description copied from interface:TreeReports the root ofthis. -
replaceRoot
Description copied from interface:TreeReplaces the root ofthiswithx, and returns the old root.- Specified by:
replaceRootin interfaceTree<T>- Parameters:
x- the new root- Returns:
- the old root
-
height
Description copied from interface:TreeReports the height ofthis. -
addSubtree
Description copied from interface:TreeAdds the treestat positionposinthis; the declaration notwithstanding, the dynamic type ofstmust be the same as the dynamic type ofthis.- Specified by:
addSubtreein interfaceTree<T>- Parameters:
pos- the position at which to addstst- theTreeto add
-
removeSubtree
Description copied from interface:TreeRemoves and returns the subtree at positionposinthis.- Specified by:
removeSubtreein interfaceTree<T>- Parameters:
pos- the position of the subtree to remove- Returns:
- the subtree at position pos in
this
-
numberOfSubtrees
Description copied from interface:TreeReturns the number of subtrees of the root ofthis.- Specified by:
numberOfSubtreesin interfaceTree<T>- Returns:
- the number of subtrees of the root of
this
-