liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
|
Iterates over the Position nodes in the linked-list of a Levenshtein State. More...
#include <state_iterator.h>
Public Member Functions | |
StateIterator (State *state, Position *head, StateIterator *outer=nullptr) | |
Constructs a new StateIterator of the Position nodes of state , with an optional outer pointer for unsubsumption. | |
void | insert (Position *position) |
Inserts a new Position after the current one in the linked-list. | |
void | remove () |
Removes the current Position from the linked-list. | |
auto | operator++ () -> StateIterator & |
Advances the Position in the linked-list by one. | |
auto | operator* () const -> Position * |
Returns a pointer to the current Position in the linked-list. | |
auto | operator== (const StateIterator &other) const -> bool |
Returns whether this StateIterator is equivalent to another. | |
Private Member Functions | |
void | advance () |
Advances the Position being iterated over by one. | |
Private Attributes | |
StateIterator * | _outer = nullptr |
Outermost iterator over the same linked-list, used for unsubsumption. | |
State * | _state = nullptr |
Levenshtein State that owns the linked-list being iterated over. | |
Position * | _next = nullptr |
Next Position to be iterated over. | |
Position * | _curr = nullptr |
Current Position being iterated over. | |
Position * | _prev = nullptr |
Previous Position being iterated over. | |
Iterates over the Position nodes in the linked-list of a Levenshtein State.
Definition at line 14 of file state_iterator.h.
liblevenshtein::StateIterator::StateIterator | ( | State * | state, |
Position * | head, | ||
StateIterator * | outer = nullptr ) |
Constructs a new StateIterator of the Position nodes of state
, with an optional outer
pointer for unsubsumption.
state | Levenshtein State owning the linked-list being iterated over. |
head | Head Position of the current sub-list. |
outer | Iterator during unsubsumption that owns the outermost level of iteration over the linked-list. |
Definition at line 6 of file state_iterator.cpp.
|
private |
Advances the Position being iterated over by one.
Definition at line 45 of file state_iterator.cpp.
References _curr, _next, _prev, and liblevenshtein::Position::next().
Inserts a new Position after the current one in the linked-list.
position | New Position to add after the current one in the linked-list. |
Definition at line 26 of file state_iterator.cpp.
References _curr, _next, _state, liblevenshtein::State::head(), liblevenshtein::State::insert_after(), and query().
auto liblevenshtein::StateIterator::operator++ | ( | ) | -> StateIterator & |
Advances the Position in the linked-list by one.
Definition at line 13 of file state_iterator.cpp.
auto liblevenshtein::StateIterator::operator== | ( | const StateIterator & | other | ) | const -> bool |
Returns whether this StateIterator is equivalent to another.
By convention, the iterators must be over the same linked-list.
other | A StateIterator to compare with this one for equivalence. |
Definition at line 22 of file state_iterator.cpp.
References query().
void liblevenshtein::StateIterator::remove | ( | ) |
Removes the current Position from the linked-list.
Definition at line 35 of file state_iterator.cpp.
References _curr, _next, _outer, _prev, _state, liblevenshtein::Position::next(), and liblevenshtein::State::remove().
Current Position being iterated over.
Definition at line 75 of file state_iterator.h.
Referenced by advance(), insert(), operator*(), and remove().
|
private |
Outermost iterator over the same linked-list, used for unsubsumption.
Definition at line 66 of file state_iterator.h.
Referenced by remove().
Previous Position being iterated over.
Definition at line 78 of file state_iterator.h.
Levenshtein State that owns the linked-list being iterated over.
Definition at line 69 of file state_iterator.h.