#include <Tree.hpp>


Public Member Functions | |
| PostOrderIterator (Tree &t) | |
| virtual | ~PostOrderIterator () |
| void | operator++ () |
| void | operator++ (int) |
| bool | isValid () const |
| OA_ptr< Node > | current () const |
Private Attributes | |
| OA_ptr< Node > | p |
Post-order iterator enumerates the nodes in post-order (a node's sub-trees are visited before the node).
If Tree is changed during iteration of nodes then the list contained within this Iterator may no longer be accurate. This iterator could also keep references to Node's no longer in the Tree.
OLD DESIGN notes (decided to use links): We don't want the Iterator to have an OA_ptr<> to the Tree itself because the Tree might have a getPostOrderIterator method and then we would have to pass this to an OA_ptr. If we did have an OA_ptr to the Tree then we could keep the current list with the Tree and it could be shared amongst various iterators. We could also do a better job of keeping the iterators up-to-date. We could also keep iterators better up-to-date if we figured out how to do the post-order links
Definition at line 428 of file Tree.hpp.
| OA::Tree::PostOrderIterator::PostOrderIterator | ( | Tree & | t | ) |
PostOrderIterator creates an iterator to enumerate the tree nodes in post-order. If this is the first time a post-order traversal has been demanded for this tree, or the tree has changed since the last post-order traversal, a post-order walk is carried out using the recursive method create_postorder_links. This links up the nodes in post-order and subsequent post-order traversals simply follow the links.
Reimplemented in OA::ExprTree::PostOrderIterator, OA::ExprTree::PostOrderIterator, and OA::NewExprTree::PostOrderIterator.
| virtual OA::Tree::PostOrderIterator::~PostOrderIterator | ( | ) | [inline, virtual] |
Reimplemented in OA::ExprTree::PostOrderIterator, OA::ExprTree::PostOrderIterator, and OA::NewExprTree::PostOrderIterator.
Reimplemented in OA::ExprTree::PostOrderIterator, OA::ExprTree::PostOrderIterator, and OA::NewExprTree::PostOrderIterator.
Definition at line 435 of file Tree.hpp.
References p.
| bool OA::Tree::PostOrderIterator::isValid | ( | ) | const [inline, virtual] |
Implements OA::Iterator.
Definition at line 434 of file Tree.hpp.
References p, and OA::OA_ptr< T >::ptrEqual().
Referenced by operator++().

| void OA::Tree::PostOrderIterator::operator++ | ( | ) | [inline, virtual] |
Implements OA::Iterator.
Definition at line 432 of file Tree.hpp.

| void OA::Tree::PostOrderIterator::operator++ | ( | int | ) | [inline] |
Reimplemented from OA::Iterator.
OA_ptr<Node> OA::Tree::PostOrderIterator::p [private] |
Definition at line 438 of file Tree.hpp.
Referenced by current(), isValid(), and operator++().
1.7.1