Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
ReversedBadCharacterShiftTable.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <alib/set>
9#include <alib/map>
10
11#include <string/LinearString.h>
12
13namespace string {
14
15namespace properties {
16
22public:
27 template < class SymbolType >
29
30};
31
32template < class SymbolType >
34 const ext::set < SymbolType > & alphabet = pattern.getAlphabet ( );
36
37 /* Initialization of BCS to the length of the needle. */
38 for ( const auto & symbol : alphabet )
39 bcs.insert ( std::make_pair ( symbol, pattern.getContent ( ).size ( ) ) );
40
41 /* Filling out BCS, ignoring first character. */
42 for ( size_t i = pattern.getContent ( ).size ( ) - 1; i > 0; i-- )
43 bcs[pattern.getContent ( ).at ( i )] = i;
44
45 return bcs;
46}
47
48} /* namespace properties */
49
50} /* namespace string */
51
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Definition: set.hpp:44
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: ReversedBadCharacterShiftTable.h:21
static ext::map< SymbolType, size_t > bcs(const string::LinearString< SymbolType > &pattern)
Definition: ReversedBadCharacterShiftTable.h:33
Definition: BarSymbol.cpp:12
int i
Definition: AllEpsilonClosure.h:118
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: RandomStringFactory.cpp:12