#include <Trie.hh>
Public Member Functions | |
Creating iterators | |
Iterator () | |
Construct an un-attached iterator. | |
Iterator (const Trie< Array > &trie) | |
Construct an iterator attached to an trie. | |
Iterator (const Iterator &it, unsigned int length) | |
Construct a prefix iterator containing only a few first symbols. | |
Iterator information | |
unsigned int | length () const |
The length of the iterator inside the trie. | |
u32 | symbol_index (unsigned int level) const |
The iterator position at the symbol vector. | |
u32 | symbol_index () const |
The iterator position at the symbol vector on highest level. | |
u32 | child_limit_index (unsigned int level) const |
The iterator position at the child_limit vector. | |
u32 | child_limit_index () const |
The iterator position at the child_limit vector on highest level. | |
u32 | symbol (unsigned int level) const |
Return the symbol from the current iterator position. | |
u32 | symbol () const |
Return the symbol from the current iterator position at the highest level. | |
std::vector< u32 > | symbol_vec () const |
Return the symbol vector corresponding to the iterator. | |
u32 | child_limit (unsigned int level) const |
Return the index of the first child after the children of the iterator node at the given level. | |
u32 | child_limit () const |
Return the index of the first child after the children of the current node. | |
u32 | first_child (unsigned int level) const |
Return the index of the first child of the iterator node at the given level. | |
u32 | first_child () const |
Return the index of the first child of the current node. | |
u32 | first_sibling (unsigned int level) const |
Return the index of the first sibling on the current node at a given level. | |
u32 | first_sibling () const |
Return the index of the first sibling on the current node. | |
u32 | sibling_limit (unsigned int level) const |
Return the index after siblings after the siblings of the current node at a given level. | |
u32 | sibling_limit () const |
Return the index after siblings after the siblings of the current node. | |
bool | is_root () const |
Is the iterator at the virtual root node? | |
bool | is_separated_leaf () const |
Is the node leaf node in a separated level. | |
u32 | num_children (unsigned int level) const |
The number of children the current iterator has at a given level. | |
u32 | num_children () const |
The number of children the current node has. | |
Moving the iterator | |
Iterator | parent () const |
Iterator positioned at the parent node. | |
void | goto_root () |
Move the iterator to the virtual root node. | |
bool | goto_parent () |
Move iterator to the parent of the current node. | |
bool | goto_first_child () |
Move the iterator to the first child of the current node. | |
bool | goto_next_sibling () |
Move the iterator to the next sibling. | |
bool | goto_child (u32 symbol) |
Move the iterator to child having the specified symbol. | |
bool | goto_next_depth_first () |
Move the iterator to the next node in depth-first order. | |
bool | goto_leaf () |
Move the iterator deeper along the first children until a leaf is reached. | |
bool | goto_next_depth_first_post () |
Move the iterator to the next node in depth-first post-order, i.e., processing children before parents. | |
bool | goto_next_on_level (unsigned int level) |
Move the iterator depth first to the next node on a given level. | |
void | goto_backoff_full () |
Move the iterator to the first backoff node found in the model. | |
bool | goto_backoff_once () |
Move the iterator to the backoff node. | |
Comparing iterators | |
bool | operator== (const Iterator it) |
Test if two iterators point to the same position. | |
bool | operator!= (const Iterator it) |
Test if two iterators do not point to the same position. | |
Private Attributes | |
const Trie< Array > * | m_trie |
The trie that the iterator is attached to. | |
std::vector< u32 > | m_symbol_stack |
The path of symbol vector indices that define the position of the iterator. | |
std::vector< u32 > | m_child_limit_stack |
The path of child_limit vector indices that define the position of the iterator. | |
Friends | |
class | Trie |
|
Construct an un-attached iterator.
|
|
Construct an iterator attached to an trie. The iterator will be located at the root of the trie.
|
|
Construct a prefix iterator containing only a few first symbols.
|
|
Return the index of the first child after the children of the current node. Zero MAY be returned if there are no children. |
|
Return the index of the first child after the children of the iterator node at the given level.
|
|
The iterator position at the child_limit vector on highest level.
|
|
The iterator position at the child_limit vector.
|
|
Return the index of the first child of the current node. It is safe to call this for the first node of the level; zero is returned. |
|
Return the index of the first child of the iterator node at the given level. It is safe to call this for the first node of the level; zero is returned.
|
|
Return the index of the first sibling on the current node.
|
|
Return the index of the first sibling on the current node at a given level.
|
|
Move the iterator to the first backoff node found in the model. Backoffing removes symbols from the beginning of the string until the resulting string is found in the model.
|
|
Move the iterator to the backoff node. Backoffing removes a symbol from the beginning of the string. If backoff node does not exist, the iterator is left at the original position.
|
|
Move the iterator to child having the specified symbol.
|
|
Move the iterator to the first child of the current node.
|
|
Move the iterator deeper along the first children until a leaf is reached.
|
|
Move the iterator to the next node in depth-first order.
|
|
Move the iterator to the next node in depth-first post-order, i.e., processing children before parents. Assumes that iterator is positioned at root to begin the search.
|
|
Move the iterator depth first to the next node on a given level.
|
|
Move the iterator to the next sibling.
|
|
Move iterator to the parent of the current node.
|
|
Move the iterator to the virtual root node.
|
|
Is the iterator at the virtual root node?
|
|
Is the node leaf node in a separated level.
|
|
The length of the iterator inside the trie. The length is zero, when the iterator is positioned at the abstract root node. |
|
The number of children the current node has.
|
|
The number of children the current iterator has at a given level.
|
|
Test if two iterators do not point to the same position.
|
|
Test if two iterators point to the same position.
|
|
Iterator positioned at the parent node.
|
|
Return the index after siblings after the siblings of the current node.
|
|
Return the index after siblings after the siblings of the current node at a given level.
|
|
Return the symbol from the current iterator position at the highest level.
|
|
Return the symbol from the current iterator position.
|
|
The iterator position at the symbol vector on highest level.
|
|
The iterator position at the symbol vector.
|
|
Return the symbol vector corresponding to the iterator.
|
|
|
|
The path of child_limit vector indices that define the position of the iterator. If the last element is max_u32, the current node does not have children. |
|
The path of symbol vector indices that define the position of the iterator.
|
|
The trie that the iterator is attached to.
|