Aleph-w  1.9
General library for algorithms and data structures
Aleph::DynMapTree< Key, Data, Tree, Compare > Class Template Reference

#include <tpl_dynMapTree.H>

+ Inheritance diagram for Aleph::DynMapTree< Key, Data, Tree, Compare >:
+ Collaboration diagram for Aleph::DynMapTree< Key, Data, Tree, Compare >:

Public Types

using Key_Type = Key
 
using Item_Type = Key
 
using Value_Type = Data
 
using Iterator = typename Base::Iterator
 
using Node = typename Tree< std::pair< Key, Data >, Dft_Pair_Cmp< Key, Data, Compare > >::Node
 
using Tree_Type = Tree< std::pair< Key, Data >, Dft_Pair_Cmp< Key, Data, Compare > >
 
typedef DynSetTree Set_Type
 
using iterator = StlIterator< SetName >
 
using const_iterator = StlConstIterator< SetName >
 

Public Member Functions

 DynMapTree (const DynList< Key > &keys)
 
Pair * insert (const Key &key, const Data &data)
 
Pair * insert (const Key &key, Data &&data=Data())
 
Pair * insert (Key &&key, const Data &data)
 
Pair * insert (Key &&key, Data &&data=Data())
 
Pair * append (const Key &key, const Data &data)
 
Pair * append (const Key &key, Data &&data=Data())
 
Pair * append (Key &&key, const Data &data)
 
Pair * append (Key &&key, Data &&data=Data())
 
Pair * put (const Key &key, const Data &data)
 
Pair * put (const Key &key, Data &&data)
 
Pair * put (Key &&key, const Data &data)
 
Pair * put (Key &&key, Data &&data)
 
Data remove (const Key &key)
 
Data remove (Key &&key)
 
Pair * search (const Key &key) const noexcept
 
Pair * search (Key &&key) const noexcept
 
bool has (const Key &key) const noexcept
 
bool has (Key &&key) const noexcept
 
bool contains (const Key &key) const noexcept
 
bool contains (Key &&key) const noexcept
 
Data & find (const Key &key)
 
const Data & find (const Key &key) const
 
Data & operator[] (const Key &key)
 
const Data & operator[] (const Key &key) const
 
Data & operator[] (Key &&key)
 
const Data & operator[] (Key &&key) const
 
DynList< Key > keys () const
 
DynList< Data > values () const
 
DynList< Data * > values_ptr ()
 
DynList< Pair * > items_ptr ()
 
void swap (DynSetTree &dset)
 
 Special_Ctors (DynSetTree, std::pair< Key, Data >)
 
void empty ()
 Elimina todos los elementos del conjunto.
 
std::pair< Key, Data > * insert (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > * insert (std::pair< Key, Data > &&key)
 
std::pair< Key, Data > * append (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > * append (std::pair< Key, Data > &&key)
 
std::pair< Key, Data > * search_or_insert (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > * search_or_insert (std::pair< Key, Data > &&key)
 
pair< std::pair< Key, Data > *, bool > contains_or_insert (const std::pair< Key, Data > &key)
 
pair< std::pair< Key, Data > *, bool > contains_or_insert (std::pair< Key, Data > &&key)
 
std::pair< Key, Data > * insert_dup (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > * insert_dup (std::pair< Key, Data > &&key)
 
std::pair< Key, Data > * put (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > * put (std::pair< Key, Data > &&key)
 
size_t remove (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > del (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > remove_pos (const size_t i)
 
bool exist (const std::pair< Key, Data > &key) const
 Retorna true si key pertenece al conjunto dinámico.
 
bool has (const std::pair< Key, Data > &key) const
 
bool contains (const std::pair< Key, Data > &key) const
 
std::pair< Key, Data > & find (const std::pair< Key, Data > &key) const
 
std::pair< int, std::pair< Key, Data > *> find_position (const std::pair< Key, Data > &key) const
 
std::pair< Key, Data > * search (const std::pair< Key, Data > &key) const
 
const std::pair< Key, Data > & min () const
 
const std::pair< Key, Data > & get_first () const
 
const std::pair< Key, Data > & max () const
 
const std::pair< Key, Data > & get_last () const
 
const std::pair< Key, Data > & get () const
 Sinónimo de max.
 
const size_t & size () const
 Retorna la cardinalidad del conjunto.
 
bool is_empty () const
 Retorna true si el conjunto está vacío.
 
size_t internal_path_length () const
 
Nodeget_root_node () const
 
const std::pair< Key, Data > & get_root () const
 
const std::pair< Key, Data > & get_item () const
 Retorna un elemento cualquiera del conjunto.
 
size_t height () const
 Calcula y retorna la altura del árbol binario de búsqueda.
 
void for_each_in_preorder (void(*visitFct)(Node *, int, int))
 
long position (const std::pair< Key, Data > &key) const
 
std::pair< Key, Data > & select (const size_t &i)
 
const std::pair< Key, Data > & select (const size_t &i) const
 
std::pair< Key, Data > & operator() (const size_t &i)
 
const std::pair< Key, Data > & operator[] (const std::pair< Key, Data > &key) const
 
const std::pair< Key, Data > & operator[] (const std::pair< Key, Data > &key)
 
std::pair< Key, Data > & access (const size_t &i)
 
bool verify ()
 
void for_each_preorder (Key_Op &key_op) const
 
void for_each_preorder (Key_Op &&key_op=Key_Op()) const
 
void for_each_inorder (Key_Op &key_op) const
 
void for_each_inorder (Key_Op &&key_op=Key_Op()) const
 
void for_each_postorder (Key_Op &key_op)
 
void for_each_postorder (Key_Op &&key_op=Key_Op())
 
DynSetTreejoin (DynSetTree &t, DynSetTree &dup)
 
DynSetTreejoin (DynSetTree &t, DynSetTree &&dup=DynSetTree())
 
DynSetTreejoin_dup (DynSetTree &t)
 
bool split_key (const std::pair< Key, Data > &key, DynSetTree &l, DynSetTree &r)
 
void split_pos (const size_t pos, DynSetTree &l, DynSetTree &r)
 
void split_key_dup (const std::pair< Key, Data > &key, DynSetTree &l, DynSetTree &r)
 
bool traverse (Operation &op)
 
bool traverse (Operation &&op=Operation())
 
bool traverse (Operation &op) const
 
bool traverse (Operation &&op=Operation()) const
 
auto get_it () const
 
auto get_it (size_t pos) const
 
auto get_itor () const
 
std::pair< Key, Data > & nth_ne (const size_t n) noexcept
 
const std::pair< Key, Data > & nth_ne (const size_t n) const noexcept
 
std::pair< Key, Data > & nth (const size_t n)
 
const std::pair< Key, Data > & nth (const size_t n) const
 
std::pair< Key, Data > * find_ptr (Operation &operation) noexcept(noexcept(operation))
 
const std::pair< Key, Data > * find_ptr (Operation &operation) const noexcept(noexcept(operation))
 
const std::pair< Key, Data > * find_ptr (Operation &&operation) const noexcept(noexcept(operation))
 
std::pair< Key, Data > * find_ptr (Operation &&operation) noexcept(noexcept(operation))
 
size_t find_index (Operation &operation) const noexcept(noexcept(operation))
 
size_t find_index (Operation &&operation) const noexcept(noexcept(operation))
 
std::tuple< bool, std::pair< Key, Data > > find_item (Operation &operation) noexcept(noexcept(operation))
 
std::tuple< bool, std::pair< Key, Data > > find_item (Operation &operation) const noexcept(noexcept(operation))
 
std::tuple< bool, std::pair< Key, Data > > find_item (Operation &&operation) noexcept(noexcept(operation))
 
std::tuple< bool, std::pair< Key, Data > > find_item (Operation &&operation) const noexcept(noexcept(operation))
 
void emplace (Args &&... args)
 
void emplace_end (Args &&... args)
 
void emplace_ins (Args &&... args)
 
size_t ninsert (Args ... args)
 
size_t nappend (Args ... args)
 
void for_each (Operation &operation) noexcept(noexcept(operation))
 
void for_each (Operation &operation) const noexcept(noexcept(operation))
 
void for_each (Operation &&operation) const noexcept(noexcept(operation))
 
void for_each (Operation &&operation) noexcept(noexcept(operation))
 
void each (Operation &operation) noexcept(noexcept(operation))
 
void each (Operation &operation) const noexcept(noexcept(operation))
 
void each (Operation &&operation) const noexcept(noexcept(operation))
 
void each (Operation &&operation) noexcept(noexcept(operation))
 
void each (size_t pos, size_t slice, Operation &operation) const
 
void each (size_t pos, size_t slice, Operation &&operation) const
 
void mutable_for_each (Operation &operation) noexcept(noexcept(operation))
 
void mutable_for_each (Operation &&operation) noexcept(noexcept(operation))
 
bool all (Operation &operation) const noexcept(noexcept(operation))
 
bool all (Operation &&operation) const noexcept(noexcept(operation))
 
bool exists (Operation &op) const noexcept(noexcept(op))
 
bool exists (Operation &&op) const noexcept(noexcept(op))
 
DynList< __T > maps (Operation &op) const
 
DynList< __T > maps (Operation &&op) const
 
DynList< __T > maps_if (Prop prop, Operation &op) const
 
DynList< __T > maps_if (Prop prop, Operation &&op) const
 
DynList< std::pair< Key, Data > > to_dynlist () const
 
__T foldl (const __T &init, Op &op) const noexcept(noexcept(op))
 
__T foldl (const __T &init, Op &&op=Op()) const noexcept(noexcept(op))
 
std::pair< Key, Data > fold (const std::pair< Key, Data > &init, Operation &operation) const noexcept(noexcept(operation))
 
std::pair< Key, Data > fold (const std::pair< Key, Data > &init, Operation &&operation) const noexcept(noexcept(operation))
 
DynList< std::pair< Key, Data > > filter (Operation &operation) const
 
DynList< std::pair< Key, Data > > filter (Operation &&operation) const
 
DynList< const std::pair< Key, Data > *> ptr_filter (Operation &operation) const
 
DynList< const std::pair< Key, Data > *> ptr_filter (Operation &&operation) const
 
DynList< std::tuple< std::pair< Key, Data >, size_t > > pfilter (Operation &operation) const
 
DynList< std::tuple< std::pair< Key, Data >, size_t > > pfilter (Operation &&operation) const
 
std::pair< DynList< std::pair< Key, Data > >, DynList< std::pair< Key, Data > > > partition (Operation &op) const
 
std::pair< DynList< std::pair< Key, Data > >, DynList< std::pair< Key, Data > > > partition (Operation &&op) const
 
std::pair< DynList< std::pair< Key, Data > >, DynList< std::pair< Key, Data > > > partition (size_t n) const
 
std::tuple< DynList< std::pair< Key, Data > >, DynList< std::pair< Key, Data > > > tpartition (Operation &op) const
 
std::tuple< DynList< std::pair< Key, Data > >, DynList< std::pair< Key, Data > > > tpartition (Operation &&op) const
 
size_t length () const noexcept
 
DynList< std::pair< Key, Data > > rev () const
 
DynList< std::pair< Key, Data > > take (const size_t n) const
 
DynList< std::pair< Key, Data > > take (size_t i, size_t j, size_t step=1) const
 
DynList< std::pair< Key, Data > > drop (const size_t n) const
 
void mutable_drop (size_t n)
 
DynList< T > items () const
 
bool equal_to (const DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &r) const noexcept
 
bool operator== (const DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &r) const noexcept
 
bool operator!= (const DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &r) const noexcept
 Negation of are_equal()
 
iterator begin () noexcept
 
const_iterator begin () const noexcept
 
iterator end () noexcept
 
const_iterator end () const noexcept
 
const_iterator cbegin () const noexcept
 
const_iterator cbegin () noexcept
 
const_iterator cend () const noexcept
 
const_iterator cend () noexcept
 

Static Public Member Functions

static Data & get_data (const Key &key) noexcept
 
static const Key & get_key (Data *data_ptr) noexcept
 

Detailed Description

template<typename Key, typename Data, template< typename, class > class Tree = Avl_Tree, class Compare = Aleph::less<Key>>
class Aleph::DynMapTree< Key, Data, Tree, Compare >

Mapeo genérico instrumentado con árboles binarios de búsqueda.

DynMapTree define un mapeo entre un conjunto de claves, que no se pueden repetir, y un conjunto rango. El mapeo se implanta mediante alguna clase de árbol binario de búsqueda definido como parámetros tipo.

Los parámetros tipo de esta clase se definen del siguiente modo:

  1. Tree: la clase de árbol binario de búsqueda con que se desea instrumentar el mapeo. Los posibles tipos son BinTree Avl_Tree Splay_Tree Rb_Tree Treap y Rand_Tree.
  2. Key: tipo de clave de indización. También se le dice "dominio" del mapeo.
  3. Data: tipo del rango.
  4. Compare: criterio de comparación entre las claves.

Los elementos del mapeo pueden accederse mediante el operador [] colocando como parámetro la clave de indización.

See also
BinTree Avl_Tree Splay_Tree Rb_Tree Treap Rand_Tree

Member Typedef Documentation

◆ Node

using Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::Node = typename Tree<std::pair< Key, Data > , Dft_Pair_Cmp< Key, Data, Compare > >::Node
inherited

Tipo de nodo binario empleado por el árbol binario de búsqueda interno.

Member Function Documentation

◆ all() [1/2]

bool Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::all ( Operation &  operation) const
inlinenoexceptinherited

Check if all the elements of container satisfy a condition.

all(operation) checks if for each element item of container operation(item) returns true.

This method has complexity $O(n)$ in average and worst case.

Parameters
[in]operationto be used as condition
Returns
true if all the elements satisfy the criteria: false otherwise.
Exceptions
anythingthat could throw operation

◆ all() [2/2]

bool Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::all ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ del()

std::pair< Key, Data > Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::del ( const std::pair< Key, Data > &  key)
inlineinherited

Deletes key and returns a full copy of stored key

This method is intended to be used with compound keys, by example pairs, whose searching is done by a particular member of compound data.

Parameters
[in]keykey to be removed
Returns
a full copy of stored key
Exceptions
domain_errorif the key is not found in the set

◆ drop()

DynList<std::pair< Key, Data > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::drop ( const size_t  n) const
inlineinherited

Drop the first n elements seen in the container during its traversal.

The complexity of this method is $O(N)$ where N always is the number of elements of container.

Returns
A DynList<T> having the remainder $N - n$ elements according to traversal order.
Exceptions
bad_allocif there is no enough memory or out_of_range if n is greater or equal than N (the number of elements in the container).

◆ each() [1/6]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::each ( Operation &  operation)
inlinenoexceptinherited

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

◆ each() [2/6]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::each ( Operation &  operation) const
inlinenoexceptinherited

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

◆ each() [3/6]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::each ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ each() [4/6]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::each ( Operation &&  operation)
inlinenoexceptinherited

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

◆ each() [5/6]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::each ( size_t  pos,
size_t  slice,
Operation &  operation 
) const
inlineinherited

Traverse all the container and performs a mutable operation on each element.

mutable_for_each(operation) traverses the container and on each element item is performed operation(item).

operation could have the following signature:

void operation(T & item)

Be very careful with the fact that this method allows to modify the elements themselves, what could badly alter the internal state of container. This would be the case for heaps, binary trees and hash tables.

Parameters
[in]<tt>operation</tt>to be done on each element.
Returns
an reference to this
Exceptions
anythingthat can throw operation

◆ each() [6/6]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::each ( size_t  pos,
size_t  slice,
Operation &&  operation 
) const
inlineinherited

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

◆ emplace()

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::emplace ( Args &&...  args)
inlineinherited

Appends a new element into the container by constructing it in-place with the given args.

emplace(args) tries to match a constructor T(args). If this exists, then this is constructed in-place and directly forwarded to the method append() of container. If all on the container and T` is adequately done, then the object is constructed once time, successively forwarded and at its target place in the container is moved, avoiding thus unnecessary copies.

Note
The semantic of append depends of container. In general, this has some sense for lists and arrays and it means insertion at the end of sequence. On other type of container append() is equivalent to insert().
Parameters
[in]argsvariadic arguments list
Exceptions
bad_allocif there is no enough memory

◆ emplace_end()

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::emplace_end ( Args &&...  args)
inlineinherited

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

◆ emplace_ins()

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::emplace_ins ( Args &&...  args)
inlineinherited

Insert a new element into the container by constructing it in-place with the given args.

emplace_ins(args) tries to match a constructor T(args). If this exists, then this is constructed in-place and directly forwarded to the method insert() of container. If all on the container and T` is adequately done, then the object is constructed once time, successively forwarded and finally, at its target place in the container, is moved, avoiding thus unnecessary copies.

Note
The semantic of insert() depends of container. In general, this has some sense for lists and arrays and it means insertion at the beginning of sequence. On other type of container append() is equivalent to insert().
Parameters
[in]argsvariadic arguments list
Exceptions
bad_allocif there is no enough memory

◆ equal_to()

bool Aleph::EqualToMethod< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > >::equal_to ( const DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  r) const
inlinenoexceptinherited

Test if elements of this are exactly contained in another container.

This method serves for testing if two containers contain the same elements. First, the container sizes are tested for equality. If they have the same size, then the testing is done by traversing this. Each seen element is searched in the another container with the method search(). So the container r must export the search() method, which frequently is the case for containers oriented to fast retrieval.

Warning
On some container, concretely DynList, the size is computed, not retrieved. So take in account this fact.
Parameters
[in]rcontainer on which the searches will be performed.
Returns
true if the container have the same size and all the elements of this are present in r

◆ exists() [1/2]

bool Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::exists ( Operation &  op) const
inlinenoexceptinherited

Test for existence in the container of an element satisfying a criteria.

exists(op) returns true if it exists any element item in container for which op(item) return true.

This method has complexity $O(n)$ in average and worst case.

Parameters
[in]opoperation for testing existence
Returns
true if it exists an item for which op return true; false otherwise.
Exceptions
anythingthat could throw op

◆ exists() [2/2]

bool Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::exists ( Operation &&  op) const
inlinenoexceptinherited

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

◆ filter() [1/2]

DynList<std::pair< Key, Data > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::filter ( Operation &  operation) const
inlineinherited

Filter the elements of a container according to a matching criteria.

This method builds a dynamic list with copies of items of container matching a criteria defined by operation, which should have the following signature:

bool operation(const T & item)

If operation return true then item matches the criteria; otherwise, operation must return false.

For example, if the container has integer, the the following code snippet would return a list containing the items greater than 100:

c.filter([] (auto item) { return item > 100; });
Parameters
[in]operationdefining the flter criteria
Returns
a DynList<T> with the matched elements.
Exceptions
anythingthat could throw operation or bad_alloc if there is no enough memory

◆ filter() [2/2]

DynList<std::pair< Key, Data > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::filter ( Operation &&  operation) const
inlineinherited

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

◆ find() [1/2]

template<typename Key, typename Data, template< typename, class > class Tree = Avl_Tree, class Compare = Aleph::less<Key>>
Data& Aleph::DynMapTree< Key, Data, Tree, Compare >::find ( const Key &  key)
inline

Retorna dato asociado a una clave.

search(key) retorna un puntero al valor del dato asociado a la clave key.

Parameters
[in]keyclave a buscar.
Returns
puntero al dato asociado a key si la clave existe en mapeo; nullptr de lo contrario.
Exceptions
domain_errorsi la clave no está dentro del mapeo
+ Here is the caller graph for this function:

◆ find() [2/2]

std::pair< Key, Data > & Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::find ( const std::pair< Key, Data > &  key) const
inlineinherited

Retorna una referencia modificable a un elemento dentro del conjunto.

find(key) busca la clave key en el conjunto y retorna una referencia modificable hacia el valor contenido en el conjunto.

Parameters
[in]keyclave a buscar.
Returns
referencia modificable a la clave key contenida dentro del conjunto.
Exceptions
domain_errorsi key no está dentro del conjunto.
Note
Téngase sumo cuidado con alterar el orden de búsqueda, pues la referencia es modificable.

◆ find_index() [1/2]

size_t Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_index ( Operation &  operation) const
inlinenoexceptinherited

Find the position of an item in the container according to a searching criteria.

find_index(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and the position of the current item (which mathes operation) is returned.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)
Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in this situation, the consider your design and use a faster approach.
Parameters
[in]<tt>operation</tt>to be performed on each item for matching a searching criteria.
Returns
the last seen position. If the item is not found, then the number of items is returned.

◆ find_index() [2/2]

size_t Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_index ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ find_item() [1/4]

std::tuple<bool, std::pair< Key, Data > > Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_item ( Operation &  operation)
inlinenoexceptinherited

Safe sequential searching of an item matching a criteria.

find_item(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and duple containg a copy of found item is returned.

The method is said safe because returns a copy of item.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)
Parameters
[in]<tt>operation</tt>to be used as searching criteria
Returns
a duple tuple<bool, Type>. The first field indicates if the item was found and the second contains a copy of found item. If no item is found, then the first field is false and the second is the result of default constructor on the type stored in the container.

◆ find_item() [2/4]

std::tuple<bool, std::pair< Key, Data > > Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_item ( Operation &  operation) const
inlinenoexceptinherited

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

◆ find_item() [3/4]

std::tuple<bool, std::pair< Key, Data > > Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_item ( Operation &&  operation)
inlinenoexceptinherited

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

◆ find_item() [4/4]

std::tuple<bool, std::pair< Key, Data > > Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_item ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ find_position()

std::pair<int, std::pair< Key, Data > *> Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::find_position ( const std::pair< Key, Data > &  key) const
inlineinherited

Retorna la posición infija (ordenada) de la clave key o lo que seria su posición de pertenecer al árbol.

find_position(key) busca en el árbol extendido la clave key (lo cual toma tiempo $O(\lg n)$) y retorna la posición infija del nodo que contiene la clave.

Parameters
[in]keyclave a buscar y a determinar posición infija.
Returns
posición infija de la clave key dentro del conjunto ordenado si ésta se encuentra o, de lo contrario, la posición donde se encontraría de pertenecer al árbol.
Warning
Sólo funciona si el árbol maneja rangos.

◆ find_ptr() [1/4]

std::pair< Key, Data > * Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_ptr ( Operation &  operation)
inlinenoexceptinherited

Find a pointer to an item in the container according to a searching criteria.

find_ptr(operation) traverses the container and on each item perform operation(item). If the result of operation is true, then the traversal is stopped and a pointer to the current item (which mathes operation) is returned.

operation must have the following signature:

bool operation(const typename Container::Item_Type & item)
Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in thie situation, the consider your design and to use an faster approach.
Parameters
[in]<tt>operation</tt>to be performed on each item for matching a searching criteria.
Returns
a valid pointer to an item if this was found or nullptr otherwise.

◆ find_ptr() [2/4]

const std::pair< Key, Data > * Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_ptr ( Operation &  operation) const
inlinenoexceptinherited

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

◆ find_ptr() [3/4]

const std::pair< Key, Data > * Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_ptr ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ find_ptr() [4/4]

std::pair< Key, Data > * Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::find_ptr ( Operation &&  operation)
inlinenoexceptinherited

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

◆ fold() [1/2]

std::pair< Key, Data > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::fold ( const std::pair< Key, Data > &  init,
Operation &  operation 
) const
inlinenoexceptinherited

Simplified version of foldl() where the folded type is the same type of elements stored in the container.

See also
foldl(const __T & init, Op & op)

◆ fold() [2/2]

std::pair< Key, Data > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::fold ( const std::pair< Key, Data > &  init,
Operation &&  operation 
) const
inlinenoexceptinherited

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

◆ foldl() [1/2]

__T Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::foldl ( const __T &  init,
Op &  op 
) const
inlinenoexceptinherited

Fold the elements of the container to a specific result.

foldl(init, op) set an internal variable acc of type __T to init value. Then it traverses the container and on each item it performs:

acc = op(acc, op(acc, item);

So acc serves as a sort of accumulator.

op should have the following signature:

__T op(__T acc, const T & item);

Since foldl is overloaded with several operation structures, there is a certain flexibility with the parameter qualifiers. You could, for example, to declare acc and/or item by value.

The method is a template. The first template parameter __T specifies the final folded type. By default, this type is T (the type of elements stored in the container). The second parameter is the operation. If the folded type is the same than T (the type of item stored), the you can simply write a foldl(). For example, if the container stores integer, in order to determine the maximum of all elements you could do:

c.foldl(std::numeric_limits<int>::min(), [] (int acc, int item)
  {
    return std::min(acc, item);
  });

When the folded type is different than T, then you must specify the folded type as template parameter. For example, if you want to compute the sum of inversed elements, the you could do it as follows:

c.template foldl<double>(0, [] (double acc, int item)
  {
    return acu + 1.0/item;
  });
Parameters
[in]initinitial value of folded value (or accumulator).
[in]opoperation to be performed on each item and used for folding.
Returns
the final folded computation.
Exceptions
anythingthat could throw op

◆ foldl() [2/2]

__T Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::foldl ( const __T &  init,
Op &&  op = Op() 
) const
inlinenoexceptinherited

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

◆ for_each() [1/4]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::for_each ( Operation &  operation)
inlinenoexceptinherited

Traverse all the container and performs an operation on each element.

for_each(operation) traverses the container and on each element item is performed operation(item).

operation must have the following signature:

void operation(const T & item)

Overloadings of this method allow that that the signature can be lightly different; for example, remove the reference or the const.

Parameters
[in]<tt>operation</tt>to be done on each element.
Returns
an reference to this
Exceptions
anythingthat can throw operation

◆ for_each() [2/4]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::for_each ( Operation &  operation) const
inlinenoexceptinherited

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

◆ for_each() [3/4]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::for_each ( Operation &&  operation) const
inlinenoexceptinherited

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

◆ for_each() [4/4]

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::for_each ( Operation &&  operation)
inlinenoexceptinherited

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

◆ for_each_in_preorder()

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_in_preorder ( void(*)(Node *, int, int)  visitFct)
inlineinherited

Efectúa un recorrido prefijo sobre todas los nodos del árbol e invoca la operación visitFct en cada visita

◆ for_each_inorder() [1/2]

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_inorder ( Key_Op &  key_op) const
inlineinherited

Efectúa un recorrido infijo sobre todas las claves del conjunto e invoca la operacion Op.

Op(p) tiene la siguiente estructura:

struct Key_Op
{
// atributos de estado que se deseen mantener
Key_Op(...) // constructor opcional si es necesario inicializar
{
// inicialización
}
void operator () (const Key & key)
{
// operación sobre clave key
}
};
Parameters
[in]key_opoperación a ejecutar sobre cada clave
See also
For_Each_In_Order

◆ for_each_inorder() [2/2]

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_inorder ( Key_Op &&  key_op = Key_Op()) const
inlineinherited

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

◆ for_each_postorder() [1/2]

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_postorder ( Key_Op &  key_op)
inlineinherited

Efectúa un recorrido sufijo sobre todas las claves del conjunto e invoca la operacion Op.

Op(p) tiene la siguiente estructura:

struct Key_Op
{
// atributos de estado que se deseen mantener
Key_Op(...) // constructor opcional si es necesario inicializar
{
// inicialización
}
void operator () (const Key & key)
{
// operación sobre clave key
}
};
Parameters
[in]key_opoperación a ejecutar sobre cada clave
See also
For_Each_Postorder

◆ for_each_postorder() [2/2]

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_postorder ( Key_Op &&  key_op = Key_Op())
inlineinherited

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

◆ for_each_preorder() [1/2]

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_preorder ( Key_Op &  key_op) const
inlineinherited

Efectúa un recorrido prefijo sobre todas las claves del conjunto e invoca la operacion Op.

Op(p) tiene la siguiente estructura:

struct Key_Op
{
// atributos de estado que se deseen mantener
Key_Op(...) // constructor opcional si es necesario inicializar
{
// inicialización
}
void operator () (const Key & key)
{
// operación sobre clave key
}
};
Parameters
[in]key_opoperación a ejecutar sobre cada clave
See also
For_Each_Preorder

◆ for_each_preorder() [2/2]

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::for_each_preorder ( Key_Op &&  key_op = Key_Op()) const
inlineinherited

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

◆ get_first()

const std::pair< Key, Data > & Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::get_first ( ) const
inlineinherited

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

◆ get_it() [1/2]

auto Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::get_it ( ) const
inlineinherited

Return an properly initialized iterator positioned at the first item on the container

◆ get_it() [2/2]

auto Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::get_it ( size_t  pos) const
inlineinherited

Return an properly initialized iterator positioned at the pos item on the container

◆ get_itor()

auto Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::get_itor ( ) const
inlineinherited

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

◆ get_last()

const std::pair< Key, Data > & Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::get_last ( ) const
inlineinherited

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

◆ insert() [1/2]

template<typename Key, typename Data, template< typename, class > class Tree = Avl_Tree, class Compare = Aleph::less<Key>>
Pair* Aleph::DynMapTree< Key, Data, Tree, Compare >::insert ( const Key &  key,
const Data &  data 
)
inline

Inserta un par en el mapeo.

insert(key,data) inserta en el mapeo un nuevo par (key,data) indizado por el valor de key. La operación no realiza inserción si el valor de key ya está presente en el mapeo.

Parameters
[in]keyclave a insertar.
[in]datavalor a indizar por la clave key.
Returns
puntero al dato mapeado.
Exceptions
bad_allocsi no hay suficiente memoria.
+ Here is the caller graph for this function:

◆ insert() [2/2]

std::pair< Key, Data > * Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::insert ( const std::pair< Key, Data > &  key)
inlineinherited

Inserta una clave en el conjunto dinámico.

Inserta la clave key en el conjunto dinámico.

Parameters
[in]keyclave a insertar.
Returns
puntero a la clave insertada si ésta no está dentro del árbol; nullptr de lo contrario.

◆ internal_path_length()

size_t Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::internal_path_length ( ) const
inlineinherited

Calcula y retorna la longitud del camino interno del árbol binario de búsqueda.

◆ items()

template<class Container, typename T>
DynList<T> Aleph::GenericItems< Container, T >::items ( ) const
inlineinherited

Return a list of all the elements of a container sorted by traversal order.

Returns
a DynList<T> containing all the elements of the container
Exceptions
bad_allocif there is no enough memory

◆ join() [1/2]

DynSetTree& Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::join ( DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  t,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  dup 
)
inlineinherited

Unión de dos árboles binarios de búsqueda.

join(t,dup) construye un árbol binario de búsqueda correspondiente a la unión de this con t. Las claves duplicadas se inserta, en dup.

Parameters
[in]tárbol binario de búsqueda que se quiere unir a this.
[out]dupárbol binario de búsqueda con las claves duplicadas de t.
Note
Luego de las llamadas el árbol t deviene vacíos y this deviene la unión de ambos árboles; sin embargo los valores de t1 y t2 no se modifican.
Returns
this

◆ join() [2/2]

DynSetTree& Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::join ( DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  t,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &&  dup = DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > >() 
)
inlineinherited

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

◆ join_dup()

DynSetTree& Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::join_dup ( DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  t)
inlineinherited

Unión de dos árboles binarios de búsqueda.

join_dup(t) construye un árbol binario de búsqueda correspondiente a la unión de this con t en la cual pueden haber claves duplicadas.

Parameters
[in]tárbol binario de búsqueda que se quiere unir a this.
Note
Luego de las llamadas el árbol t deviene vacíos y this deviene la unión de ambos árboles;
Returns
this

◆ length()

size_t Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::length ( ) const
inlinenoexceptinherited

Count the number of elements of a container.

This method counts the number of elements stored in the container.

Note
Take in account that this method computes; it does not retrieve. Consequently it always takes $O(n)$. However, for many containers this number is already stored and retrievable in $O(1)$ through the methos size()
Returns
the number of elements stored in the container.

◆ maps() [1/2]

DynList<__T> Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::maps ( Operation &  op) const
inlineinherited

Map the elements of the container.

maps(op) produces a dynamic list resulting of mapping of each element of container item to the result of operation op(item).

maps() is a template method which receives as template parameters the type __T, which is the type of target or range of mapping, and the transforming operation. By default __T is the same type of the elements stored in the container.

operation should have the following signature:

__T operation(const T & item)

So, operation(item) performs a transformation of item towards the type __T.

If __T ==T`, which is common and by default, then you could specify a mapping without need of template specification. For example, if the container has integer values, the a mapping of item multiplied by 4 could be very simply written as follows:

c.maps([] (int item) { return 4*i; });

In contrast, if the range type is different than the domain type, then it is necessary to specify the template keyword in the method call. For example, if the range is double and you want to return the elements divided by 4, the could do as follows:

c.template maps<double>([] (int item) { return 1.0*item/4; });
Parameters
[in]opoperation to be performed in order to do the transformation on an item
Returns
a `DynList<__T> object containing the mapped items. The order of resulting list is the same than the order of visit of the iterator for the container.
Exceptions
anythingthat could throw op or bad_alloc if there is no enough memory

◆ maps() [2/2]

DynList<__T> Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::maps ( Operation &&  op) const
inlineinherited

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

◆ maps_if() [1/2]

DynList<__T> Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::maps_if ( Prop  prop,
Operation &  op 
) const
inlineinherited

Conditional mapping of the elements of the container.

maps_if(prop, op) traverses each item of container, on each item it tests the proposition prop. If this last is true, then the item is mapped through the function op(item).

Parameters
[in]opoperation to be perfomed in order to do the transformation on an item.
[in]propa lambda returning a bool which perform the logical test.
Returns
a `DynList<__T> object containing the mapped items. The order of resulting list is the same than the order of visit of the iterator for the container.
Exceptions
anythingthat could throw op or bad_alloc if there is no enough memory

◆ maps_if() [2/2]

DynList<__T> Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::maps_if ( Prop  prop,
Operation &&  op 
) const
inlineinherited

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

◆ max()

const std::pair< Key, Data > & Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::max ( ) const
inlineinherited

Retorna la mayor clave contenida en el conjunto según el criterio de comparación dado.

◆ min()

const std::pair< Key, Data > & Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::min ( ) const
inlineinherited

Retorna la menor clave contenida en el conjunto según el criterio de comparación dado.

◆ mutable_drop()

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::mutable_drop ( size_t  n)
inlineinherited

Drop the first n elements seen from container.

The complexity of this method is $O(N)$ where N always is the number of elements of container.

Exceptions
out_of_rangeif n is greater or equal than N (the number of elements in the container).

◆ mutable_for_each()

void Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::mutable_for_each ( Operation &&  operation)
inlinenoexceptinherited

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

◆ nappend()

size_t Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::nappend ( Args ...  args)
inlineinherited

Append n variadic items

Parameters
[in]argsitems to be appended
Returns
the number of appended items

◆ ninsert()

size_t Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::ninsert ( Args ...  args)
inlineinherited

Insert n variadic items

Parameters
[in]argsitems to be inserted
Returns
the number of inserted items

◆ nth() [1/2]

std::pair< Key, Data > & Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::nth ( const size_t  n)
inlineinherited

Return the n-th item of container.

The notion of ordinal depends of type of container. On list, probably will be the insertion order. On binary search trees will be the nth smaller item. On hash tables will be pseudo random.

Warning
Frequent use of this method will definitively degrade the performance. Try not to use this method inside loops. In general, if you falls in this situation, then consider your design and to use an faster approach.
Parameters
[in]nthe nth item to find
Returns
a valid reference to the item into the container.
Exceptions
out_of_rangeif n is greater or equal that the size of container.

◆ nth() [2/2]

const std::pair< Key, Data > & Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::nth ( const size_t  n) const
inlineinherited

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

◆ nth_ne()

const std::pair< Key, Data > & Aleph::LocateFunctions< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::nth_ne ( const size_t  n) const
inlinenoexceptinherited

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

◆ operator==()

bool Aleph::EqualToMethod< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > >::operator== ( const DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  r) const
inlinenoexceptinherited

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

◆ partition() [1/3]

std::pair<DynList<std::pair< Key, Data > >, DynList<std::pair< Key, Data > > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::partition ( Operation &  op) const
inlineinherited

Exclusive partition of container according to a filter criteria.

partition(op) traverses the container and filters its elements according to the filter criteria defined by op. The filtered elements are copied to a first list and the not filtered ones to a second list. When all the container is traversed, a pair containing these lists is returned.

The op requirements are the same than for filter().

Parameters
[in]opoperation instrumenting the filter criteria
Returns
a std::pair<DynList<T>, DynList<T>>.firstcontains the filtered elements andsecondthe non-filtered ones. \throw anything that could throw op orbad_alloc` if there is no enough memory
See also
filter()

◆ partition() [2/3]

std::pair<DynList<std::pair< Key, Data > >, DynList<std::pair< Key, Data > > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::partition ( Operation &&  op) const
inlineinherited

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

◆ partition() [3/3]

std::pair<DynList<std::pair< Key, Data > >, DynList<std::pair< Key, Data > > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::partition ( size_t  n) const
inlineinherited

Exclusive partition of container in the nth item

partition(n) traverses the container and produces a pair of lists. The first one contains the first n elements and the second one the this->size() - n remaining elements.

Parameters
[in]nthe first n items of the first list
Exceptions
anythingthat could throw op or bad_alloc if there is no enough memory

◆ pfilter() [1/2]

DynList<std::tuple<std::pair< Key, Data > , size_t> > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::pfilter ( Operation &  operation) const
inlineinherited

Filter the elements of a container according to a matching criteria and determine its positions respect to the traversal of container.

pfilter(operation) is very similar to filter(), but instead of building a list of filtered elements, it builds a list of pairs with form (item, pos), where item is a copy of filtered element and pos is its position respect to the traversal order. The position is relative to the container type.

The pair is defined with a tuple:

std::tuple<T, size_t>
Parameters
[in]operationthat defines the filter criteria
Returns
a DynList
Exceptions
bad_allocif there is no enough memory
See also
filter(Operation & operation)

◆ pfilter() [2/2]

DynList<std::tuple<std::pair< Key, Data > , size_t> > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::pfilter ( Operation &&  operation) const
inlineinherited

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

◆ position()

long Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::position ( const std::pair< Key, Data > &  key) const
inlineinherited

Retorna la posición infija (ordenada) de la clave key.

position(key) busca en el treap extendido la clave key (lo cual toma tiempo $O(\lg n)$) y retorna la posición infija del nodo que contiene la clave.

Parameters
[in]keyclave a buscar y a determinar posición infija.
Returns
posición infija de la clave key dentro del conjunto ordenado si la clave se encuentra; -1 de lo contrario
Warning
Sólo funciona si el árbol maneja rangos.

◆ ptr_filter()

DynList<const std::pair< Key, Data > *> Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::ptr_filter ( Operation &  operation) const
inlineinherited

Filter the elements of a container according to a matching criteria an return pointer to the matched items in the container.

This method builds a dynamic list with stores pointers to the items of matching a criteria defined by operation, which should have the followgin signature:

bool operation(const T & item)

If operation return true then item matches the criteria; otherwise, operation must return false.

For example, if the container has integer, the the following code snippet would return a list containing the items greater than 100:

c.ptr_filter([] (auto item) { return item > 100; });
Parameters
[in]operationdefining the flter criteria
Returns
a DynList<const T*> with the pointers to the matched elements.
Exceptions
anythingthat could throw operation or bad_alloc if there is no enough memory

◆ put()

template<typename Key, typename Data, template< typename, class > class Tree = Avl_Tree, class Compare = Aleph::less<Key>>
Pair* Aleph::DynMapTree< Key, Data, Tree, Compare >::put ( const Key &  key,
const Data &  data 
)
inline

Inserta un par en el mapeo.

put(key,data) inserta en el mapeo un nuevo par (key,data) indizado por el valor de key. La operación no realiza inserción si el valor de key ya está presente en el mapeo.

Parameters
[in]keyclave a insertar.
[in]datavalor a indizar por la clave key.
Returns
número de elementos que contiene el mapeo.
Exceptions
bad_allocsi no hay suficiente memoria.
+ Here is the caller graph for this function:

◆ remove() [1/2]

template<typename Key, typename Data, template< typename, class > class Tree = Avl_Tree, class Compare = Aleph::less<Key>>
Data Aleph::DynMapTree< Key, Data, Tree, Compare >::remove ( const Key &  key)
inline

Deletes the pair key,data

remove(key) deletes from the mapping the pair associated to key

Parameters
[in]keyto delete
Returns
the data associated to the removed key.
Exceptions
domain_errorif key is not in the mapping

◆ remove() [2/2]

size_t Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::remove ( const std::pair< Key, Data > &  key)
inlineinherited

Elimina una clave del conjunto dinámico.

remove(key) busca la clave key del conjunto y la elimina.

Parameters
[in]keyclave a eliminar
Returns
número de elementos que tiene el conjunto.

◆ remove_pos()

std::pair< Key, Data > Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::remove_pos ( const size_t  i)
inlineinherited

Elimina una clave del conjunto dinámico.

remove(key) busca la clave key del conjunto y la elimina.

Parameters
[in]keyclave a eliminar
Returns
número de elementos que tiene el conjunto.

◆ rev()

DynList<std::pair< Key, Data > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::rev ( ) const
inlineinherited

Return a list with the elements of container in reverse order respect to its traversal order.

Returns
a DynList<T> inversely ordered accordirg to the traversal order.
Exceptions
bad_allocif there is no enough memory

◆ search() [1/2]

template<typename Key, typename Data, template< typename, class > class Tree = Avl_Tree, class Compare = Aleph::less<Key>>
Pair* Aleph::DynMapTree< Key, Data, Tree, Compare >::search ( const Key &  key) const
inlinenoexcept

Retorna dato asociado a una clave.

search(key) retorna un puntero al valor del dato asociado a la clave key.

Parameters
[in]keyclave a buscar.
Returns
puntero al dato asociado a key si la clave existe en mapeo; nullptr de lo contrario.
See also
test
+ Here is the caller graph for this function:

◆ search() [2/2]

std::pair< Key, Data > * Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::search ( const std::pair< Key, Data > &  key) const
inlineinherited

Busca un elemento en el conjunto.

search(key) busca la clave key en el conjunto. Si el elemento se encuentra en el conjunto, entonces se retorna un puntero al valor contenido en el conjunto; de lo contrario se retrona nullptr.

Parameters
[in]keyclave a buscar.
Returns
puntero al elemento en en el conjunto si éste se encuentra en el mismo; nullptr de l contrario.
Note
Téngase sumo cuidado con alterar el orden de búsqueda, pues a través del puntero la clave es modificable.

◆ search_or_insert()

std::pair< Key, Data > * Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::search_or_insert ( const std::pair< Key, Data > &  key)
inlineinherited

Busca la clave key en el árbol binario de búsqueda o lo inserta en caso de no encontrarse.

search_or_insert(key) busca en el árbol binario un nodo cuya clave sea KEY(p). Si la clave se encuentra, entonces se retorna un puntero a ella; de lo contrario se inserta key en el árbol binario de búsqueda this.

Parameters
[in]keyla clave a buscar o insertar.
Returns
puntero a la clave dentro del árbol

◆ select()

std::pair< Key, Data > & Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::select ( const size_t &  i)
inlineinherited

Retorna el i-ésimo nodo en posición infija

Parameters
[in]iposición deseada
Returns
referencia a la i-esima clave insertada en el conjunto

◆ split_key()

bool Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::split_key ( const std::pair< Key, Data > &  key,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  l,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  r 
)
inlineinherited

Particiona el árbol binario de búsqueda según una clave.

split_key(key,l,r) particiona, según la clave key, el árbol binario de búsqueda this en dos árboles l y r. Luego de la operación el árbol this deviene vacío, l contiene todas las claves menores que key y r las mayores.

Parameters
[in]keyclave de partición.
[out]lárbol con las claves menores que key.
[out]rárbol con las claves mayores que key.
Returns
true si key no está dentro del árbol binario; en cuyo caso la partición fue hecha exitosamente. De lo contrario, si key se encuentra dentro del árbol, el árbol no se particiona y el resultado es false.

◆ split_key_dup()

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::split_key_dup ( const std::pair< Key, Data > &  key,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  l,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  r 
)
inlineinherited

Particiona el árbol binario de búsqueda según una clave que puede estar presente en el árbol.

split_dup(key,l,r) particiona, según la clave key, el árbol binario de búsqueda this en dos árboles l y r. Luego de la operación el árbol this deviene vacío, l contiene todas las claves menores que key y r las mayores o iguales.

Parameters
[in]keyclave de partición.
[out]lárbol con las claves menores que key.
[out]rárbol con las claves mayores o iguales que key.

◆ split_pos()

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::split_pos ( const size_t  pos,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  l,
DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  r 
)
inlineinherited

Particiona el árbol binario de búsqueda según una posición infija.

split_pos(pos,l,r) particiona árbol binario de búsqueda this en dos árboles l y r. Luego de la operación el árbol this deviene vacío, l contiene las pos primeras claves y r las restantes.

Parameters
[in]posposición de partición
[out]lárbol con las claves entre intervalo [0,pos]
[out]rárbol con las claves en el intervalo (pos,N), donde N es el número de claves

◆ swap()

void Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::swap ( DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > &  dset)
inlineinherited

Intercambia todos los elementos del treap this con el treap tree en tiempo contante (y extremadamente rápido).

Parameters
[in]treeel treap a intercambiar con this

◆ take() [1/2]

DynList<std::pair< Key, Data > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::take ( const size_t  n) const
inlineinherited

Return a list with the first n elements seen in the container during its traversal.

The complexity of this method is $O(n)$ where n can be less than the number of elements of container.

Returns
A DynList<T> having the first n elements according to its traversal order.
Exceptions
bad_allocif there is no enough memory or out_of_range if n is greater or equal than the number of elements in the container.

◆ take() [2/2]

DynList<std::pair< Key, Data > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::take ( size_t  i,
size_t  j,
size_t  step = 1 
) const
inlineinherited

Return a list with elements seen in the container between i and j position respect to its traversal.

The complexity of this method is $O(n)$ where n can be less than the number of elements of container.

Returns
A DynList<T> having the first n elements according to its traversal order.
Exceptions
bad_allocif there is no enough memory or out_of_range if n is greater or equal than the number of elements in the container.

◆ tpartition() [1/2]

std::tuple<DynList<std::pair< Key, Data > >, DynList<std::pair< Key, Data > > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::tpartition ( Operation &  op) const
inlineinherited

Exclusive partition of container according to a filter criteria.

This methos has exactly the same semantic than partition(Operation & op), excepts than instead of returning a std::pair it returns a std::tuple.

Parameters
[in]opoperation instrumenting the filter criteria
Returns
a std::tuple<DynList<T>, DynList<T>>.firstcontains the filteres elements andsecondthe non-filtered ones. \throw anything that could throw op orbad_alloc` if there is no enough memory
See also
partition(Operation & op)

◆ tpartition() [2/2]

std::tuple<DynList<std::pair< Key, Data > >, DynList<std::pair< Key, Data > > > Aleph::FunctionalMethods< DynSetTree< std::pair< Key, Data >, Tree, Dft_Pair_Cmp< Key, Data, Compare > > , std::pair< Key, Data > >::tpartition ( Operation &&  op) const
inlineinherited

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

◆ traverse()

bool Aleph::DynSetTree< std::pair< Key, Data > , Tree, Dft_Pair_Cmp< Key, Data, Compare > >::traverse ( Operation &  op)
inlineinherited

Traverse all the set of pairs and for each key executes the operation op.

Operation must have the signature

bool operation(T & item)

If

operation()

returns false then the traversal is aborted; otherwise the the routine advance and so on

Parameters
[in]operation
Returns
true if all items are traversed; false otherwise

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

Leandro Rabindranath León