Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ExactMatchingAutomaton.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <automaton/FSM/NFA.h>
9#include <string/LinearString.h>
10
11namespace stringology {
12
13namespace matching {
14
16public:
21 template < class SymbolType >
23};
24
25template < class SymbolType >
28 res.setInputAlphabet(pattern.getAlphabet());
29 for(const SymbolType& symbol : pattern.getAlphabet()) {
30 res.addTransition( 0, symbol, 0);
31 }
32 unsigned i = 1;
33 for(const SymbolType& symbol : pattern.getContent()) {
34 res.addState( i );
35 res.addTransition( i - 1, symbol, i );
36 i++;
37 }
38 res.addFinalState( i - 1 );
39 return res;
40}
41
42} /* namespace matching */
43
44} /* namespace stringology */
45
Nondeterministic finite automaton. Accepts regular languages.
Definition: NFA.h:66
Linear string.
Definition: LinearString.h:57
const ext::set< SymbolType > & getAlphabet() const &
Definition: LinearString.h:103
const ext::vector< SymbolType > & getContent() const &
Definition: LinearString.h:238
Definition: ExactMatchingAutomaton.h:15
static automaton::NFA< SymbolType, unsigned > construct(const string::LinearString< SymbolType > &pattern)
Definition: ExactMatchingAutomaton.h:26
int i
Definition: AllEpsilonClosure.h:118
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
return res
Definition: MinimizeByPartitioning.h:145
Definition: ArithmeticCompression.h:18