13#include <string/LinearString.h>
32 template <
class SymbolType >
38 template <
class SymbolType >
43 size_t n = text.size(), m = pat.size();
45 size_t repSize, p ,
q ;
52 if ( repSize == 0 || repSize == 1 ) {
53 for (
size_t i = 0 ;
i <= n - m ; ++
i ) {
55 while ( j < m && text[
i + j ] == pat[j] ) ++ j ;
56 if ( j == m ) occ.insert(
i) ;
62 size_t i = repSize/2 ;
63 while (
i <= n - m ) {
64 bool leftmostMismatch = std::equal(text.begin() +
i + p , text.begin() +
i + p + repSize/2 , text.begin() +
i +
q ) ;
65 if ( leftmostMismatch ) {
66 for (
size_t i_0 =
i - repSize / 2 ; i_0 <=
i ; ++ i_0 ){
67 if ( std::equal( pat.begin() , pat.end() , text.begin() + i_0 ) ) occ.insert(i_0) ;
73 for (
size_t j =
i - repSize / 2 ; j <= n - m ; ++ j ) {
74 if ( std::equal( pat.begin() , pat.end() , text.begin() + j ) ) occ.insert(j) ;
Linear string.
Definition: LinearString.h:57
const ext::vector< SymbolType > & getContent() const &
Definition: LinearString.h:238
static ext::tuple< size_t, size_t, size_t > construct(const string::LinearString< SymbolType > &string)
Definition: Repetition.h:28
static ext::set< unsigned > match(const string::LinearString< SymbolType > &subject, const string::LinearString< SymbolType > &pattern)
Definition: CGR.h:39
int i
Definition: AllEpsilonClosure.h:118
q
Definition: SingleInitialStateEpsilonTransition.h:85
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
void start(measurements::stealth_string name, measurements::Type type)
Definition: measurements.cpp:14
void end()
Definition: measurements.cpp:19
Definition: ArithmeticCompression.h:18