Aleph-w  1.9
General library for algorithms and data structures
Aleph::Tree_Node< T > Class Template Reference

#include <tpl_tree_node.H>

Inherited by Aleph::Tree_Node_Vtl< T >.

Classes

class  Children_Iterator
 

Public Types

using Item_Type = Tree_Node *
 
using key_type = T
 Tipo de dato genérico que contiene el nodo.
 

Public Member Functions

T & get_key () noexcept
 retorna referencia modificable al contenido del nodo.
 
const T & get_key () const noexcept
 
T & get_data () noexcept
 retorna referencia modificable al contenido del nodo.
 
const T & get_data () const noexcept
 
Dlinkget_child_list () noexcept
 
Dlinkget_sibling_list () noexcept
 
bool is_root () const noexcept
 Retorna true si this es la raíz del árbol general.
 
bool is_leaf () const noexcept
 Retorna true si this es un nodo hoja.
 
bool is_leftmost () const noexcept
 Retorna true si this es el nodo más a la izquierda de sus hermanos.
 
bool is_rightmost () const noexcept
 Retorna true si this es el nodo más a la derecha de sus hermanos.
 
void set_is_root (bool value) noexcept
 
void set_is_leaf (bool value) noexcept
 
void set_is_leftmost (bool value) noexcept
 
void set_is_rightmost (bool value) noexcept
 
 Tree_Node () noexcept
 Constructor vacío (clave indefinida).
 
 Tree_Node (const T &__data) noexcept(std::is_nothrow_copy_constructible< T >::value)
 Constructor con valor de dato __data.
 
 Tree_Node (T &&__data) noexcept(std::is_nothrow_move_constructible< T >::value)
 
Tree_Nodeget_left_sibling () const noexcept
 Retorna hermano izquierdo de this.
 
Tree_Nodeget_right_sibling () const noexcept
 Retorna hermano derecho de this.
 
Tree_Nodeget_left_child () const noexcept
 retorna el hijo más a la izquierda de this.
 
Tree_Nodeget_right_child () const noexcept
 retorna el hijo más a la derecha de this.
 
Tree_Nodeget_child (const size_t i) const noexcept
 
Tree_Nodeget_parent () const noexcept
 Retorna el padre de this.
 
void insert_right_sibling (Tree_Node *p) noexcept
 
void insert_left_sibling (Tree_Node *p)
 
void insert_leftmost_child (Tree_Node *p) noexcept
 
void insert_rightmost_child (Tree_Node *p) noexcept
 
Tree_Nodejoin (Tree_Node *tree)
 join tree as subtree of root this
 
void insert_tree_to_right (Tree_Node *tree)
 
Tree_Nodeget_left_tree () const noexcept
 Retorna el árbol a la izquierda de this.
 
Tree_Nodeget_right_tree () const noexcept
 Retorna el árbol a la derecha de this.
 
Tree_Nodeget_last_tree () const
 
template<template< typename > class Container = DynList>
Container< Tree_Node * > trees () const
 Return a list with all trees belonging to the forrest.
 
template<typename Operation >
void for_each_child (Operation &op) const
 
template<typename Operation >
void for_each_child (Operation &&op=Operation()) const
 
template<template< typename > class Container = DynList>
Container< Tree_Node * > children_nodes () const
 Retorna una lista de los nodos hijos de this.
 
template<template< typename > class Container = DynList>
Container< T > children () const
 Retorna una lista de los contenidos de los hijos de this.
 
template<class Operation >
bool traverse (Operation op)
 Recorre en prefijo todos los nodos y ejecuta op.
 
template<class Operation >
bool traverse (Operation op) const
 
template<class Op >
bool level_traverse (Op op)
 
template<class Op >
bool level_traverse (Op op) const
 
 Functional_Methods (Tree_Node *)
 
Children_Iterator children_it () const
 
Iterator get_it () const
 
 STL_ALEPH_ITERATOR (Tree_Node)
 

Detailed Description

template<class T>
class Aleph::Tree_Node< T >

Árboles m-rios genéricos.

La clase Tree_Node<Key> define árboles generales de cualquier orden representados mediante listas enlazadas.

Parameters
Keyel tipo de dato que contiene cada nodo del árbol.

Member Function Documentation

◆ for_each_child()

template<class T>
template<typename Operation >
void Aleph::Tree_Node< T >::for_each_child ( Operation &  op) const
inline

Visita cada hijo de this y ejecuta la operación operation sobre el nodo hijo

+ Here is the caller graph for this function:

◆ get_child()

template<class T>
Tree_Node* Aleph::Tree_Node< T >::get_child ( const size_t  i) const
inlinenoexcept

Retorna el i-ésimo hijo de this.

Retorna el i-ésimo hijo de this.

Parameters
[in]iordinal del hijo al que se desea acceder.
Returns
puntero al i-ésimo hijo de this; nullptr si no existe.

◆ get_last_tree()

template<class T>
Tree_Node* Aleph::Tree_Node< T >::get_last_tree ( ) const
inline

Retorna el árbol más a la derecha de la arborescencia this. Dispara excepción range_error si this no es el árbol más a la izquierda de toda la arborescencia.

◆ insert_left_sibling()

template<class T>
void Aleph::Tree_Node< T >::insert_left_sibling ( Tree_Node< T > *  p)
inline

Inserta p como hermano izquierdo de this.

Inserta p como hermano izquierdo de this.

Parameters
[in]pnodo a insertar como hermano izquierdo.

◆ insert_leftmost_child()

template<class T>
void Aleph::Tree_Node< T >::insert_leftmost_child ( Tree_Node< T > *  p)
inlinenoexcept

Inserta p como el hijo más a la izquierda de this.

Inserta p como el hijo más a la izquierda de this.

Parameters
[in]pnodo a insertar.

◆ insert_right_sibling()

template<class T>
void Aleph::Tree_Node< T >::insert_right_sibling ( Tree_Node< T > *  p)
inlinenoexcept

Inserta p como hermano derecho de this.

Inserta p como hermano derecho de this.

Parameters
[in]pnodo a insertar como hermano derecho.

◆ insert_rightmost_child()

template<class T>
void Aleph::Tree_Node< T >::insert_rightmost_child ( Tree_Node< T > *  p)
inlinenoexcept

Inserta p como el hijo más a la derecho de this.

Inserta p como el hijo más a la derecho de this.

Parameters
[in]pnodo a insertar.

◆ insert_tree_to_right()

template<class T>
void Aleph::Tree_Node< T >::insert_tree_to_right ( Tree_Node< T > *  tree)
inline

Insert tree to the right of this

Assuming that this is part of a forrest, this method insert tree to the right of this.

Be careful with the fact that tree will not always be inserted as the rightmost tree, but as the tree to right of this.

Parameters
[in]treethe tree to insert
Exceptions
domain_errorif tree is not root

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

Leandro Rabindranath León