24template <
class PrefixRankedPatternType >
25bool symbolCompare ( [[maybe_unused]]
const PrefixRankedPatternType& pattern,
size_t i,
size_t j ) {
26 return pattern.getContent ( )[
i ] == pattern.getContent ( )[ j ];
29template <
class SymbolType >
32 const auto& symbol2 = pattern.
getContent ( )[ j ];
33 return symbol1 == symbol2 || ( symbol1.getRank ( ) == symbol2.getRank ( ) && ( pattern.
getNodeWildcards ( ).contains ( symbol1 ) || pattern.
getNodeWildcards ( ).contains ( symbol2 ) ) );
42 template <
class PrefixRankedPatternType >
46template <
class PrefixRankedPatternType >
51 for (
unsigned i = 0;
i <= pattern.getContent ( ).size ( );
i++ )
55 for (
unsigned ofs = 1; ofs < pattern.getContent ( ).size ( ); ofs++ ) {
61 if (
i >= pattern.getContent ( ).size ( ) ) {
62 while ( j < pattern.getContent ( ).size ( ) ) {
63 maxs [ j ] =
std::max ( maxs [ j ], j + 1 - ofs );
67 }
else if ( j >= pattern.getContent ( ).size ( ) ) {
69 }
else if ( symbolCompare ( pattern,
i, j ) ) {
70 maxs [ j ] =
std::max ( maxs [ j ], j + 1 - ofs );
73 }
else if ( pattern.getContent ( )[
i ] == pattern.getSubtreeWildcard ( ) || pattern.getContent ( )[ j ] == pattern.getSubtreeWildcard ( ) ) {
74 for (
int k =
static_cast < int > ( j ); k < subtreeJumpTable [ j ] ; k++ )
75 maxs [ k ] =
std::max ( maxs [ k ], k + 1 - ofs );
77 i = subtreeJumpTable[
i ];
78 j = subtreeJumpTable[ j ];
88 for (
size_t i = 2;
i <= pattern.getContent ( ).size ( );
i++ ) {
89 res [
i ] = maxs [
i - 1 ];
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Tree pattern represented as linear sequece as result of preorder traversal. The representation is so ...
Definition: PrefixRankedExtendedPattern.h:80
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedExtendedPattern.h:293
const ext::set< common::ranked_symbol< SymbolType > > & getNodeWildcards() const &
Definition: PrefixRankedExtendedPattern.h:157
Definition: BorderArray.h:39
static ext::vector< size_t > construct(const PrefixRankedPatternType &pattern)
Definition: BorderArray.h:47
static ext::vector< int > compute(const tree::PrefixRankedBarTree< SymbolType > &subject)
Definition: SubtreeJumpTable.h:49
int i
Definition: AllEpsilonClosure.h:118
return res
Definition: MinimizeByPartitioning.h:145
constexpr const T & max(const T &a)
Root case of maximum computation. The maximum from one value is the value itself.
Definition: algorithm.hpp:278
Definition: BadCharacterShiftTable.h:18