Class AbstractPreOrderVisitor<T,R>
java.lang.Object
io.openml.gearbox.binarytree.traversal.AbstractVisitor<T,R>
io.openml.gearbox.binarytree.traversal.AbstractPreOrderVisitor<T,R>
- Type Parameters:
T
- The type of value stored in the nodeR
- The type of object to be computed via a pre-order traversal, seeAbstractVisitor.getTraversalResult()
- Direct Known Subclasses:
PreOrderSearch
,Size
Deprecated.
AbstractPreOrderVisitor
performs pre-order tree traversal and allows custom actions on visiting each tree
node during the traversal.
Traversing the tree does not allow mutation involved, otherwise the traversal behavior is undefined.
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class io.openml.gearbox.binarytree.traversal.AbstractVisitor
canTerminate, getTraversalResult, visitNode
-
Constructor Details
-
AbstractPreOrderVisitor
public AbstractPreOrderVisitor()Deprecated.
-
-
Method Details
-
traverse
Deprecated.Pre-order traverses the specified tree and performs actions on each visited node.This method runs optimally in O(n) time and O(n) space without recursion, i.e. it also invokes
AbstractVisitor.getTraversalResult()
,AbstractVisitor.visitNode(TreeNode)
,AbstractVisitor.canTerminate()
:- if
AbstractVisitor.getTraversalResult()
runs in O(m) in time and O(s) in space, this method runs at least MAX[O(n), O(m)] in time and at least MAX[O(n), O(s)] in space - if
AbstractVisitor.visitNode(TreeNode)
runs in O(m) in time and O(s) in space, this method runs at least O(n* m) in time and at least MAX[O(n), O(s)] in space - if
AbstractVisitor.canTerminate()
runs in O(m) in time and O(s) in space, this method runs at least O(n * m) in time and at least MAX[O(n), O(s)] in space
- Parameters:
root
- the root of the tree- Returns:
- the preorder traversal of the tree
- Throws:
NullPointerException
- ifroot
isnull
- if
-
apply
Deprecated.
-
AbstractPreOrderVisitor
reflects an obsolete implementation that doesn't strictly bind the principle of Visitor pattern. Please use the enhancedTreeTraverser
orAbstractPreOrderTraversalVisitor