32template <
class SymbolType = DefaultSymbolType >
47 return std::move ( m_string );
55 for(
const auto &
edge : edges ) {
56 m_delta[vertexNumber].
insert({{
edge.first.first - 1,
edge.first.second - 1},
edge.second});
65 return std::move ( m_delta );
68 bool addTransition (
unsigned from,
size_t startIndex,
size_t endIndex,
unsigned to ) {
73 m_delta = std::move ( delta );
93 if(m_delta[state].empty ( ))
94 res.insert(m_string.size ( ) - curLen);
96 for(
auto it = m_delta[state].
begin();it!=m_delta[state].
end();++it) {
102 for(
auto it = m_delta[state].
begin();it!=m_delta[state].
end();++it) {
103 if( m_string[it->first.first] != pattern[index])
106 for(
unsigned i = it->first.first;i<=it->first.second;
i++) {
107 if(index == pattern.size()) {
108 index += (it->first.second-
i+1);
112 if(m_string[
i] != pattern[index++]) {
123 return out <<
"(CompactSuffixAutomatonTerminatingSymbol " << instance.m_string <<
", " << instance.m_delta <<
")";
137template <
class SymbolType >
143 for (
size_t state = 0; state < getTransitions ( ).size ( ); ++ state )
144 states.insert ( state );
145 res.setStates ( std::move ( states ) );
147 res.addFinalState ( 1 );
149 for (
size_t state = 0; state < getTransitions ( ).size ( ); ++ state )
162template <
class SymbolType >
163struct normalize <
indexes::stringology::CompactSuffixAutomatonTerminatingSymbol < SymbolType > > {
167 res.setTransitions ( std::move ( value ).getTransitions ( ) );
173template <
class SymbolType >
174struct xmlApi <
indexes::stringology::CompactSuffixAutomatonTerminatingSymbol < SymbolType > > {
177 static std::string xmlTagName ( );
181template <
class SymbolType >
187 res.setString ( std::move (
string ) );
188 res.setTransitions ( std::move ( delta ) );
194template <
class SymbolType >
199template <
class SymbolType >
201 return "CompactSuffixAutomatonTerminatingSymbol";
204template <
class SymbolType >
static ext::vector< DefaultSymbolType > normalizeSymbols(ext::vector< SymbolType > &&symbols)
Definition: SymbolNormalize.h:86
Compact deterministic finite automaton. Accepts regular languages. The automaton has a list of symbol...
Definition: CompactDFA.h:73
Class extending the deque class from the standard library. Original reason is to allow printing of th...
Definition: deque.hpp:44
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
reverse_iterator insert(const_reverse_iterator pos, const T &value)
Inserts the value on position given by iterator pos.
Definition: vector.hpp:229
auto end() &
Inherited behavior of end for non-const instance.
Definition: vector.hpp:155
Definition: CompactSuffixAutomatonTerminatingSymbol.h:33
const ext::vector< ext::map< ext::pair< size_t, size_t >, unsigned > > & getTransitions() const &
Definition: CompactSuffixAutomatonTerminatingSymbol.h:60
const ext::vector< SymbolType > & getString() const &
Definition: CompactSuffixAutomatonTerminatingSymbol.h:42
unsigned GetNextState(unsigned state, const ext::vector< SymbolType > &pattern, unsigned &index) const
Definition: CompactSuffixAutomatonTerminatingSymbol.h:101
friend ext::ostream & operator<<(ext::ostream &out, const CompactSuffixAutomatonTerminatingSymbol &instance)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:122
void GetAllPathsLen(unsigned state, unsigned curLen, ext::set< unsigned > &res) const
Definition: CompactSuffixAutomatonTerminatingSymbol.h:92
void setTransitions(ext::vector< ext::map< ext::pair< size_t, size_t >, unsigned > > delta)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:72
bool addTransition(unsigned from, size_t startIndex, size_t endIndex, unsigned to)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:68
bool operator==(const CompactSuffixAutomatonTerminatingSymbol &other) const
Definition: CompactSuffixAutomatonTerminatingSymbol.h:130
void insertVertex(unsigned vertexNumber, const ext::map< ext::pair< int, int >, int > &edges)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:54
ext::vector< ext::map< ext::pair< size_t, size_t >, unsigned > > && getTransitions() &&
Definition: CompactSuffixAutomatonTerminatingSymbol.h:64
void setString(const ext::vector< SymbolType > &str)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:38
void setNumberOfVertices(int n)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:50
ext::vector< SymbolType > && getString() &&
Definition: CompactSuffixAutomatonTerminatingSymbol.h:46
auto operator<=>(const CompactSuffixAutomatonTerminatingSymbol &other) const
Definition: CompactSuffixAutomatonTerminatingSymbol.h:126
static void popToken(ext::deque< Token >::iterator &input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:39
static bool isToken(ext::deque< Token >::const_iterator input, Token::TokenType type, const std::string &data)
Definition: FromXMLParserHelper.cpp:29
int i
Definition: AllEpsilonClosure.h:118
return res
Definition: MinimizeByPartitioning.h:145
Definition: normalize.hpp:10
Definition: CapacityEdge.hpp:18
constexpr tuple< Elements &... > tie(Elements &... args) noexcept
Helper of extended tuple of references construction. The tuple is constructed to reffer to values in ...
Definition: tuple.hpp:218
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
Definition: CompressedBitParallelTreeIndex.h:40
void end()
Definition: measurements.cpp:19
Definition: ArithmeticCompression.h:18
static indexes::stringology::CompactSuffixAutomatonTerminatingSymbol< > eval(indexes::stringology::CompactSuffixAutomatonTerminatingSymbol< SymbolType > &&value)
Definition: CompactSuffixAutomatonTerminatingSymbol.h:164
Definition: normalize.hpp:13
Definition: xmlApi.hpp:27