Aleph-w  1.9
General library for algorithms and data structures
Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator Class Reference

#include <tpl_treapRk.H>

+ Collaboration diagram for Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator:

Public Member Functions

 Iterator (const Gen_Treap_Rk &__tree) noexcept
 Initialize an iterator on __tree
 
 Iterator (const Gen_Treap_Rk &__tree, Node *__curr) noexcept
 Initialize an iterator startin from node __curr
 
 Iterator (const Gen_Treap_Rk &__tree, const size_t pos) noexcept
 Initialize an iterator starting from the iorder position pos
 
 Iterator (const Iterator &itor) noexcept
 
Iteratoroperator= (const Iterator &itor) noexcept
 
void reset_first () noexcept
 Reset the iterator to the first position.
 
void reset_last () noexcept
 Reset the iterator to the last position.
 
void end () noexcept
 Put the iterator in the end state.
 
void reset_to_key (const Key &key) noexcept
 
void reset_to_node (Node *node) noexcept
 
void reset_to_pos (size_t pos) noexcept
 Put the current to the position pos.
 
Node * get_curr_ne () const noexcept
 Return the current node.
 
Node * get_curr () const noexcept
 
size_t get_current_position () const
 
size_t get_pos () const
 
bool has_curr () const noexcept
 Return true if iterator has current node.
 
void prev ()
 
void next_ne () noexcept
 
void next ()
 
Node * del ()
 Remove the current node and move the iterator one position forward.
 
bool operator== (const Iterator &itor) const noexcept
 Return true if this is equal to itor
 
bool operator!= (const Iterator &itor) const
 Return true if this is not equal to itor
 
bool verify (Gen_Treap_Rk *r) const noexcept
 
bool verify (const Iterator &it) const noexcept
 

Protected Attributes

Gen_Treap_Rktree_ptr
 
Node * curr
 
int curr_pos
 

Static Protected Attributes

static const int Pos_Not_Current = -1
 
static const int Pos_Empty_Container = -2
 
static const int Pos_Not_Updated = -3
 

Detailed Description

template<template< class > class NodeType, class Key, class Compare>
class Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator

Iterator on nodes of the tree.

The visit order is inorder.

Member Function Documentation

◆ get_curr()

template<template< class > class NodeType, class Key, class Compare>
Node* Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_curr ( ) const
inlinenoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ get_current_position()

template<template< class > class NodeType, class Key, class Compare>
size_t Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_current_position ( ) const
inline

return the position of current node

@return current position
@throw underflow_error if the iterator has not current node
after a `prev()` operation
@throw overflow_error if the iterator has not current node
after a `next()` operation
+ Here is the call graph for this function:

◆ get_pos()

template<template< class > class NodeType, class Key, class Compare>
size_t Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::get_pos ( ) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ next()

template<template< class > class NodeType, class Key, class Compare>
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::next ( )
inline

Move the iterator one position forward. Throws overflow_error if there is no current

◆ prev()

template<template< class > class NodeType, class Key, class Compare>
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::prev ( )
inline

Move the iterator one position backward. Throws underflow_error if there is no current

◆ reset_to_key()

template<template< class > class NodeType, class Key, class Compare>
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_key ( const Key &  key)
inlinenoexcept

Put the iterator to a node according to specific key

If key is not present, the the iterator is put on the node

Parameters
[in]keyto guide the position
Exceptions
domain_errorsi la clave no está contenida en el árbol.
+ Here is the call graph for this function:

◆ reset_to_node()

template<template< class > class NodeType, class Key, class Compare>
void Aleph::Gen_Treap_Rk< NodeType, Key, Compare >::Iterator::reset_to_node ( Node *  node)
inlinenoexcept

Put the current node to a specific node

Parameters
[in]nodetoput as current
Note
Obviously the node must belong to the tree

The documentation for this class was generated from the following file:

Leandro Rabindranath León