|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Inorder iterator on the nodes of a binary tree. More...
#include <tpl_binNodeUtils.H>
Public Member Functions | |
| bool | is_in_first () const noexcept |
Return true if the iterator is on the first node. | |
| bool | is_last () const noexcept |
| void | swap (BinNodeInfixIterator &it) noexcept |
| BinNodeInfixIterator ()=default | |
| BinNodeInfixIterator (Node *r) noexcept | |
| Initialize an iterator on the first node inorder. | |
| BinNodeInfixIterator (const BinNodeInfixIterator &it) | |
| BinNodeInfixIterator (BinNodeInfixIterator &&it) noexcept | |
| void | reset_first () noexcept |
| Reset the iterator to the first node inorder. | |
| void | reset_last () noexcept |
| Reset the iterator to the first node inorder. | |
| void | end () noexcept |
| BinNodeInfixIterator & | operator= (const BinNodeInfixIterator &it) |
| BinNodeInfixIterator & | operator= (BinNodeInfixIterator &&it) noexcept |
| bool | has_curr () const noexcept |
Return true the iterator has current node. | |
| Node * | get_curr_ne () const noexcept |
| Return the current link guaranteeing no exception. Be careful. | |
| Node * | get_curr () const |
Return the current node. Throw overflow_error if there is no current. | |
| size_t | get_pos () const |
| Return the current position of iterator. Only valid if has_curr() == true. | |
| void | next_ne () noexcept |
| void | next () |
| Move the iterator one position forward. | |
Private Member Functions | |
| Node * | advance_to_min (Node *r) noexcept |
| void | init () noexcept |
Static Private Member Functions | |
| static Node * | advance_to_max (Node *r) noexcept |
Private Attributes | |
| Node * | root = Node::NullPtr |
| Node * | curr = Node::NullPtr |
| long | pos = 0 |
| ArrayStack< Node * > | s |
Inorder iterator on the nodes of a binary tree.
This class export a full iterator for the nodes of a binary tree where the visit order corresponds to a inorder sense.
Definition at line 2683 of file tpl_binNodeUtils.H.
|
default |
|
inlinenoexcept |
Initialize an iterator on the first node inorder.
Definition at line 2738 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::init().
|
inline |
Definition at line 2744 of file tpl_binNodeUtils.H.
|
inlinenoexcept |
Definition at line 2750 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::swap().
|
inlinestaticprivatenoexcept |
Definition at line 2700 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::reset_last().
|
inlineprivatenoexcept |
Definition at line 2690 of file tpl_binNodeUtils.H.
References LLINK, Aleph::ArrayStack< T >::push(), r, and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::BinNodeInfixIterator< Node >::init(), and Aleph::BinNodeInfixIterator< Node >::next_ne().
|
inlinenoexcept |
Definition at line 2774 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr, Aleph::ArrayStack< T >::empty(), Aleph::BinNodeInfixIterator< Node >::pos, and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::end().
|
inline |
Return the current node. Throw overflow_error if there is no current.
Definition at line 2807 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::BinNodeInfixIterator< Node >::curr, Aleph::divide_and_conquer_partition_dp(), and Aleph::BinNodeInfixIterator< Node >::has_curr().
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr().
|
inlinenoexcept |
Return the current link guaranteeing no exception. Be careful.
Definition at line 2804 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::get_curr_ne(), and TEST().
|
inline |
Return the current position of iterator. Only valid if has_curr() == true.
Definition at line 2814 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::pos.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::get_pos().
|
inlinenoexcept |
Return true the iterator has current node.
Definition at line 2801 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr.
Referenced by Aleph::BinNodeInfixIterator< Node >::get_curr(), Aleph::DynIntervalTree< T, Compare >::Iterator::has_curr(), Aleph::infix_for_each(), Aleph::infix_traverse(), Aleph::BinNodeInfixIterator< Node >::next(), and TEST().
|
inlineprivatenoexcept |
Definition at line 2708 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::pos, and Aleph::BinNodeInfixIterator< Node >::root.
Referenced by Aleph::BinNodeInfixIterator< Node >::BinNodeInfixIterator(), and Aleph::BinNodeInfixIterator< Node >::reset_first().
|
inlinenoexcept |
Return true if the iterator is on the first node.
Definition at line 2717 of file tpl_binNodeUtils.H.
References Aleph::and, Aleph::BinNodeInfixIterator< Node >::curr, Aleph::ArrayStack< T >::is_empty(), LLINK, and Aleph::BinNodeInfixIterator< Node >::s.
|
inlinenoexcept |
Definition at line 2722 of file tpl_binNodeUtils.H.
References Aleph::and, Aleph::BinNodeInfixIterator< Node >::curr, Aleph::ArrayStack< T >::is_empty(), RLINK, and Aleph::BinNodeInfixIterator< Node >::s.
|
inline |
Move the iterator one position forward.
Throw overflow_error if there is no current
Definition at line 2834 of file tpl_binNodeUtils.H.
References ah_overflow_error_if, Aleph::divide_and_conquer_partition_dp(), Aleph::BinNodeInfixIterator< Node >::has_curr(), and Aleph::BinNodeInfixIterator< Node >::next_ne().
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::next().
|
inlinenoexcept |
Definition at line 2816 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodeInfixIterator< Node >::curr, Aleph::ArrayStack< T >::is_empty(), Aleph::ArrayStack< T >::pop(), Aleph::BinNodeInfixIterator< Node >::pos, RLINK, and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::BinNodeInfixIterator< Node >::next(), Aleph::DynIntervalTree< T, Compare >::Iterator::next_ne(), and TEST().
|
inlinenoexcept |
Definition at line 2793 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::swap().
|
inline |
Definition at line 2781 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, and Aleph::BinNodeInfixIterator< Node >::s.
|
inlinenoexcept |
Reset the iterator to the first node inorder.
Definition at line 2753 of file tpl_binNodeUtils.H.
References Aleph::ArrayStack< T >::empty(), Aleph::BinNodeInfixIterator< Node >::init(), and Aleph::BinNodeInfixIterator< Node >::s.
Referenced by Aleph::DynIntervalTree< T, Compare >::Iterator::reset_first().
|
inlinenoexcept |
Reset the iterator to the first node inorder.
Definition at line 2760 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::advance_to_max(), Aleph::BinNodeInfixIterator< Node >::curr, Aleph::ArrayStack< T >::empty(), Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, Aleph::BinNodeInfixIterator< Node >::s, and Aleph::size().
|
inlinenoexcept |
Definition at line 2727 of file tpl_binNodeUtils.H.
References Aleph::BinNodeInfixIterator< Node >::curr, Aleph::BinNodeInfixIterator< Node >::pos, Aleph::BinNodeInfixIterator< Node >::root, Aleph::BinNodeInfixIterator< Node >::s, and Aleph::ArrayStack< T >::swap().
Referenced by Aleph::BinNodeInfixIterator< Node >::BinNodeInfixIterator(), and Aleph::BinNodeInfixIterator< Node >::operator=().
|
private |
Definition at line 2686 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::get_curr(), Aleph::BinNodeInfixIterator< Node >::get_curr_ne(), Aleph::BinNodeInfixIterator< Node >::has_curr(), Aleph::BinNodeInfixIterator< Node >::init(), Aleph::BinNodeInfixIterator< Node >::is_in_first(), Aleph::BinNodeInfixIterator< Node >::is_last(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().
|
private |
Definition at line 2687 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::get_pos(), Aleph::BinNodeInfixIterator< Node >::init(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().
|
mutableprivate |
Definition at line 2685 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::init(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().
|
private |
Definition at line 2688 of file tpl_binNodeUtils.H.
Referenced by Aleph::BinNodeInfixIterator< Node >::advance_to_min(), Aleph::BinNodeInfixIterator< Node >::end(), Aleph::BinNodeInfixIterator< Node >::is_in_first(), Aleph::BinNodeInfixIterator< Node >::is_last(), Aleph::BinNodeInfixIterator< Node >::next_ne(), Aleph::BinNodeInfixIterator< Node >::operator=(), Aleph::BinNodeInfixIterator< Node >::reset_first(), Aleph::BinNodeInfixIterator< Node >::reset_last(), and Aleph::BinNodeInfixIterator< Node >::swap().