liblevenshtein 4.0.0
A library for generating Finite State Transducers based on Levenshtein Automata.
Loading...
Searching...
No Matches
state_iterator.h
Go to the documentation of this file.
1#ifndef LIBLEVENSHTEIN_TRANSDUCER_STATE_ITERATOR_H
2#define LIBLEVENSHTEIN_TRANSDUCER_STATE_ITERATOR_H
3
5
6namespace liblevenshtein {
7
9class State;
10
15public:
16
26 StateIterator(State* state, Position* head, StateIterator *outer = nullptr);
27
34
38 void remove();
39
45 auto operator++() -> StateIterator &;
46
52 auto operator*() const -> Position *;
53
61 auto operator==(const StateIterator &other) const -> bool;
62
63private:
64
67
69 State* _state = nullptr;
70
72 Position* _next = nullptr;
73
75 Position* _curr = nullptr;
76
78 Position* _prev = nullptr;
79
83 void advance();
84};
85
86} // namespace liblevenshtein
87
88#endif // LIBLEVENSHTEIN_TRANSDUCER_STATE_ITERATOR_H
Represents a location within the Levenshtein automaton.
Definition position.h:11
Iterates over the Position nodes in the linked-list of a Levenshtein State.
auto operator==(const StateIterator &other) const -> bool
Returns whether this StateIterator is equivalent to another.
StateIterator * _outer
Outermost iterator over the same linked-list, used for unsubsumption.
auto operator++() -> StateIterator &
Advances the Position in the linked-list by one.
void insert(Position *position)
Inserts a new Position after the current one in the linked-list.
Position * _curr
Current Position being iterated over.
void advance()
Advances the Position being iterated over by one.
auto operator*() const -> Position *
Returns a pointer to the current Position in the linked-list.
Position * _next
Next Position to be iterated over.
State * _state
Levenshtein State that owns the linked-list being iterated over.
StateIterator(State *state, Position *head, StateIterator *outer=nullptr)
Constructs a new StateIterator of the Position nodes of state, with an optional outer pointer for uns...
Position * _prev
Previous Position being iterated over.
void remove()
Removes the current Position from the linked-list.
Consists of a closure of Position nodes within the Levenshtein automaton.
Definition state.h:23
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Definition main.cpp:25
Various utilities regarding Levenshtein transducers.
Definition namespaces.dox:9