Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
SubtreeJumpTable.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <alib/vector>
9
17
18namespace tree {
19
20namespace properties {
21
23 template < class T >
24 static int buildDataPointersBar ( ext::vector < int > & res, const ext::vector < T > & content, const ext::set < T > & bars, int begin );
25 template < class T >
26 static int buildDataPointersPrefixRanked ( ext::vector < int > & res, const ext::vector < T > & content, int begin );
27 template < class T >
28 static int buildDataPointersPrefixRankedInternal ( ext::vector < int > & res, const ext::vector < T > & content, int begin );
29
30public:
31 template < class SymbolType >
33 template < class SymbolType >
35 template < class SymbolType >
37 template < class SymbolType >
39 template < class SymbolType >
41 template < class SymbolType >
43 template < class SymbolType >
45
46};
47
48template < class SymbolType >
51
52 buildDataPointersBar ( res, subject.getContent ( ), subject.getBars ( ), 0 );
53
54 return res;
55}
56
57template < class SymbolType >
60
61 buildDataPointersBar ( res, pattern.getContent ( ), pattern.getBars ( ), 0 );
62
63 return res;
64}
65
66template < class SymbolType >
69
70 buildDataPointersBar ( res, pattern.getContent ( ), pattern.getBars ( ), 0 );
71
72 return res;
73}
74
75template < class SymbolType >
78
79 buildDataPointersPrefixRanked ( res, subject.getContent ( ), 0 );
80
81 return res;
82}
83
84template < class SymbolType >
87
88 buildDataPointersPrefixRanked ( res, pattern.getContent ( ), 0 );
89
90 return res;
91}
92
93template < class SymbolType >
96
97 buildDataPointersPrefixRanked ( res, pattern.getContent ( ), 0 );
98
99 return res;
100}
101
102template < class SymbolType >
105
106 buildDataPointersPrefixRanked ( res, pattern.getContent ( ), 0 );
107
108 return res;
109}
110
116template < class T >
117int SubtreeJumpTable::buildDataPointersBar ( ext::vector < int > & res, const ext::vector < T > & content, const ext::set < T > & bars, int begin ) {
118 res.push_back ( 0 );
119 int index = begin + 1;
120
121 while ( ! bars.contains ( content [ index ] ) )
122 index = buildDataPointersBar ( res, content, bars, index );
123
124 index++;
125 res [ begin ] = index;
126 res.push_back ( begin - 1 );
127 return index;
128}
129
135template < class T >
136int SubtreeJumpTable::buildDataPointersPrefixRanked ( ext::vector < int > & res, const ext::vector < T > & content, int begin ) {
137 for ( size_t i = 0; i < content.size ( ); i++ )
138 res.push_back ( 0 );
139
140 return buildDataPointersPrefixRankedInternal ( res, content, begin );
141}
142
143template < class T >
144int SubtreeJumpTable::buildDataPointersPrefixRankedInternal ( ext::vector < int > & res, const ext::vector < T > & content, int begin ) {
145 int index = begin + 1;
146
147 for ( unsigned i = 0; i < content [ begin ].getRank ( ); i++ )
148 index = buildDataPointersPrefixRankedInternal ( res, content, index );
149
150 res [ begin ] = index;
151 return index;
152}
153
154} /* namespace properties */
155
156} /* namespace tree */
157
Definition: set.hpp:44
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Nonlinear tree pattern represented as linear sequece as result of preorder traversal with additional ...
Definition: PrefixRankedBarNonlinearPattern.h:91
const ext::set< common::ranked_symbol< SymbolType > > & getBars() const &
Definition: PrefixRankedBarNonlinearPattern.h:232
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedBarNonlinearPattern.h:434
Tree pattern represented as linear sequece as result of preorder traversal with additional bar symbol...
Definition: PrefixRankedBarPattern.h:85
const ext::set< common::ranked_symbol< SymbolType > > & getBars() const &
Definition: PrefixRankedBarPattern.h:175
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedBarPattern.h:334
Tree structure represented as linear sequece as result of preorder traversal with additional bar symb...
Definition: PrefixRankedBarTree.h:78
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedBarTree.h:273
const ext::set< common::ranked_symbol< SymbolType > > & getBars() const &
Definition: PrefixRankedBarTree.h:156
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
Nonlinear tree pattern represented as linear sequece as result of preorder traversal....
Definition: PrefixRankedNonlinearPattern.h:82
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedNonlinearPattern.h:333
Tree pattern represented as linear sequece as result of preorder traversal. The representation is so ...
Definition: PrefixRankedPattern.h:77
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedPattern.h:262
Tree structure represented as linear sequece as result of preorder traversal. The representation is s...
Definition: PrefixRankedTree.h:71
const ext::vector< common::ranked_symbol< SymbolType > > & getContent() const &
Definition: PrefixRankedTree.h:235
Definition: SubtreeJumpTable.h:22
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
auto begin(Container &&cont) -> decltype(std::forward(cont).begin())
Definition: iterator.hpp:900
Definition: BackwardOccurrenceTest.h:17