15#include <string/LinearString.h>
30 template <
class SymbolType >
35template <
class SymbolType >
40 size_t subjectSize = subject.
getContent ( ).size ( );
43 size_t posInSubject = 0;
45 while ( posInSubject + patternSize <= subjectSize ) {
46 unsigned currentState = suffixAutomaton.
getAutomaton ( ).getInitialState ( );
48 size_t posInPattern = patternSize;
49 size_t lastPrefixPos = posInPattern;
52 while ( posInPattern > 0 && ! fail ) {
53 auto transition = suffixAutomaton.
getAutomaton ( ).getTransitions ( ).find ( { currentState, subject.
getContent ( ).
at ( posInSubject + posInPattern - 1 ) } );
55 if ( transition == suffixAutomaton.
getAutomaton ( ).getTransitions ( ).end ( ) )
58 currentState = transition->second;
63 if ( ( posInPattern != 0 ) && ( suffixAutomaton.
getAutomaton ( ).getFinalStates ( ).find ( currentState ) != suffixAutomaton.
getAutomaton ( ).getFinalStates ( ).end ( ) ) )
64 lastPrefixPos = posInPattern;
69 occ.insert ( posInSubject );
71 posInSubject += lastPrefixPos;
Suffix automaton string index. Automaton representation of all suffixes. The automaton is general det...
Definition: SuffixAutomaton.h:50
unsigned getBackboneLength() const
Definition: SuffixAutomaton.h:116
const automaton::DFA< SymbolType, unsigned > & getAutomaton() const &
Definition: SuffixAutomaton.h:175
Linear string.
Definition: LinearString.h:57
const ext::vector< SymbolType > & getContent() const &
Definition: LinearString.h:238
Definition: BackwardDAWGMatching.h:24
static ext::set< unsigned > match(const string::LinearString< SymbolType > &subject, const indexes::stringology::SuffixAutomaton< SymbolType > &suffixAutomaton)
Definition: BackwardDAWGMatching.h:36
Definition: ArithmeticCompression.h:18