![]() |
aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
|
A splay tree. More...
#include <agrum/tools/core/splay.h>
Public Member Functions | |
Constructors / Destructors | |
SplayTree () | |
Basic constructor, make an empty splay tree. More... | |
SplayTree (const Element &e) | |
Basic constructor, make a splay tree with one element. More... | |
SplayTree (const SplayTree &from) | |
Copy constructor. More... | |
~SplayTree () | |
Class destructor. More... | |
Operators | |
SplayTree< Element > & | operator= (const SplayTree< Element > &from) |
Assignment operator. More... | |
Methods | |
Element & | operator[] (const unsigned int i) |
Get the element at the position n. More... | |
const Element & | operator[] (const unsigned int i) const |
Get the element at the position n. More... | |
Element & | front () |
Get the first element. More... | |
Element & | back () |
Get the last element. More... | |
void | popFront () |
Remove the first element. More... | |
void | popBack () |
Remove the last element. More... | |
void | pushFront (const Element &e) |
Add an element in the first position. More... | |
void | pushBack (const Element &e) |
Add an element in the last position. More... | |
void | insert (const Element &e) |
Add an element to the tree. More... | |
void | join (const SplayTree< Element > &s) |
Concatenation of two trees. More... | |
SplayTree< Element > | split (const int i) |
Divide the tree at the position. More... | |
SplayTree< Element > | split_by_val (const Element &e) |
Divide the tree at the position. More... | |
Size | size () const |
The number of elements in the tree. More... | |
bool | contains (const Element &e) const |
Test if the tree contains the element. More... | |
Protected Attributes | |
Data Menbers | |
SplayBinaryNode< Element > * | root |
Root of the tree. More... | |
HashTable< Element, SplayBinaryNode< Element > *> | addr |
The hash table to find quickly the position of a node. More... | |
Protected Member Functions | |
void | copy_ (const SplayTree< Element > &) |
a function used to perform copies More... | |
Friends | |
std::ostream & | operator<< (std::ostream &out, const SplayTree< Element > &) |
Friendly to display. More... | |
A splay tree.
Element | The elements type. |
INLINE gum::SplayTree< Element >::SplayTree | ( | ) |
Basic constructor, make an empty splay tree.
Definition at line 363 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE gum::SplayTree< Element >::SplayTree | ( | const Element & | e | ) |
Basic constructor, make a splay tree with one element.
e | The element of the tree. |
Definition at line 374 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE gum::SplayTree< Element >::SplayTree | ( | const SplayTree< Element > & | from | ) |
Copy constructor.
from | The gum::SplayTree to copy. |
Definition at line 383 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE gum::SplayTree< Element >::~SplayTree | ( | ) |
Class destructor.
Definition at line 412 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Element & gum::SplayTree< Element >::back | ( | ) |
Get the last element.
NotFound | Raised if the splay tree is empty. |
Definition at line 515 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE bool gum::SplayTree< Element >::contains | ( | const Element & | e | ) | const |
Test if the tree contains the element.
e | The element to test if it is in the splay tree. |
Definition at line 780 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
protected |
a function used to perform copies
Definition at line 352 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Element & gum::SplayTree< Element >::front | ( | ) |
Get the first element.
NotFound | Raised if the splay tree is empty. |
Definition at line 498 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SplayTree< Element >::insert | ( | const Element & | e | ) |
Add an element to the tree.
e | The element to add. |
Definition at line 616 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SplayTree< Element >::join | ( | const SplayTree< Element > & | s | ) |
Concatenation of two trees.
s | The tree to add. |
Definition at line 642 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE SplayTree< Element > & gum::SplayTree< Element >::operator= | ( | const SplayTree< Element > & | from | ) |
Assignment operator.
from | The gum::SplayTree to copy. |
Definition at line 392 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
Element & gum::SplayTree< Element >::operator[] | ( | const unsigned int | i | ) |
Get the element at the position n.
i | The position of the element to return. |
NotFound | Raised if no element was found. |
Definition at line 422 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
const Element & gum::SplayTree< Element >::operator[] | ( | const unsigned int | i | ) | const |
Get the element at the position n.
i | The position of the element to return. |
NotFound | Raised if no element was found. |
Definition at line 459 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SplayTree< Element >::popBack | ( | ) |
Remove the last element.
Definition at line 555 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SplayTree< Element >::popFront | ( | ) |
Remove the first element.
Definition at line 532 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SplayTree< Element >::pushBack | ( | const Element & | e | ) |
Add an element in the last position.
e | The element to push. |
Definition at line 597 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE void gum::SplayTree< Element >::pushFront | ( | const Element & | e | ) |
Add an element in the first position.
e | The element to push. |
Definition at line 578 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE Size gum::SplayTree< Element >::size | ( | ) | const |
The number of elements in the tree.
Definition at line 770 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE SplayTree< Element > gum::SplayTree< Element >::split | ( | const int | i | ) |
Divide the tree at the position.
i | The position of the element (e) for split. |
Definition at line 668 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
INLINE SplayTree< Element > gum::SplayTree< Element >::split_by_val | ( | const Element & | e | ) |
Divide the tree at the position.
e | the element for split |
Definition at line 732 of file splay_tpl.h.
References gum::Set< Key, Alloc >::emplace().
|
friend |
Friendly to display.
Definition at line 800 of file splay_tpl.h.
|
protected |
|
protected |