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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addSubtree
(int pos, Tree<T> st) Adds the treest
at positionpos
inthis
; the declaration notwithstanding, the dynamic type ofst
must be the same as the dynamic type ofthis
.final boolean
int
hashCode()
int
height()
Reports the height ofthis
.int
Returns the number of subtrees of the root ofthis
.removeSubtree
(int pos) Removes and returns the subtree at positionpos
inthis
.replaceRoot
(T x) Replaces the root ofthis
withx
, 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, wait
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
Methods 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:Tree
Reports the root ofthis
. -
replaceRoot
Description copied from interface:Tree
Replaces the root ofthis
withx
, and returns the old root.- Specified by:
replaceRoot
in interfaceTree<T>
- Parameters:
x
- the new root- Returns:
- the old root
-
height
Description copied from interface:Tree
Reports the height ofthis
. -
addSubtree
Description copied from interface:Tree
Adds the treest
at positionpos
inthis
; the declaration notwithstanding, the dynamic type ofst
must be the same as the dynamic type ofthis
.- Specified by:
addSubtree
in interfaceTree<T>
- Parameters:
pos
- the position at which to addst
st
- theTree
to add
-
removeSubtree
Description copied from interface:Tree
Removes and returns the subtree at positionpos
inthis
.- Specified by:
removeSubtree
in interfaceTree<T>
- Parameters:
pos
- the position of the subtree to remove- Returns:
- the subtree at position pos in
this
-
numberOfSubtrees
Description copied from interface:Tree
Returns the number of subtrees of the root ofthis
.- Specified by:
numberOfSubtrees
in interfaceTree<T>
- Returns:
- the number of subtrees of the root of
this
-