1#ifndef LIBLEVENSHTEIN_TRANSDUCER_STATE_H
2#define LIBLEVENSHTEIN_TRANSDUCER_STATE_H
5#include <initializer_list>
Represents a location within the Levenshtein automaton.
Iterates over the Position nodes in the linked-list of a Levenshtein State.
Consists of a closure of Position nodes within the Levenshtein automaton.
static auto find_middle(Position *lower) -> Position *
Finds the middle node between lower and the tail.
Position * _head
First Position in the linked-list.
void sort(const Comparator &compare)
Merge-sorts the linked-list of Positions.
void insert_after(Position *curr, Position *next)
Inserts a new Position into the linked-list following an existing member.
void add(Position *next)
Adds a new Position to the tail of the linked-list.
auto begin() -> StateIterator
Returns an iterator over the Positions in this State, beginning at the head and traversing to the tai...
auto end() -> StateIterator
Returns an iterator representing the end of the linked-list of Positions.
auto head() const -> Position *
Returns the first Position in the linked-list of Position nodes.
static auto merge(const Comparator &compare, Position *lower, Position *upper) -> Position *
Merge-sorts the nodes in the range between lower and upper.
void remove(Position *prev, Position *curr)
Removes a Position from the linked-list.
auto merge_sort(const Comparator &compare, Position *lower) -> Position *
Sorts the linked-list of Positions within the Levenshtein automaton.
~State()
Frees any owned allocations.
State()=default
Constructs an empty state, which is most commonly used to represent the intersection of the root node...
void query(ll::Dawg *dawg, const std::string &query_term, std::size_t max_distance)
Various utilities regarding Levenshtein transducers.
std::function< int(Position *, Position *)> Comparator
auto compare(Position *lhs, Position *rhs) -> int
Compares two Positions within the Levenshtein transducer.