Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
LastVariableOffsetBack.h
Go to the documentation of this file.
1
6#pragma once
7
10
11namespace tree {
12
13namespace properties {
14
16public:
17 template < class SymbolType >
18 static size_t offset ( const tree::PrefixRankedBarPattern < SymbolType > & pattern );
19 template < class SymbolType >
20 static size_t offset ( const tree::PrefixRankedBarNonlinearPattern < SymbolType > & pattern );
21
22};
23
24template < class SymbolType >
27}
28
29template < class SymbolType >
31 // find the distance between the end of the pattern and the index
32 // of the last symbol representing the variable
33 size_t offset = pattern.getContent ( ).size ( );
34
35 for ( size_t i = 0; i < pattern.getContent ( ).size ( ); i++ )
36 if ( pattern.getContent ( )[i] == pattern.getSubtreeWildcard ( ) || pattern.getNonlinearVariables ( ).count ( pattern.getContent ( )[i] ) )
37 offset = pattern.getContent ( ).size ( ) - i - 1;
38
39 return offset;
40}
41
42} /* namespace properties */
43
44} /* namespace tree */
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 > > & getNonlinearVariables() const &
Definition: PrefixRankedBarNonlinearPattern.h:277
const common::ranked_symbol< SymbolType > & getSubtreeWildcard() const &
Definition: PrefixRankedBarNonlinearPattern.h:259
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
Definition: LastVariableOffsetBack.h:15
static size_t offset(const tree::PrefixRankedBarPattern< SymbolType > &pattern)
Definition: LastVariableOffsetBack.h:25
int i
Definition: AllEpsilonClosure.h:118
Definition: BackwardOccurrenceTest.h:17