Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
GlushkovIndexate.h
Go to the documentation of this file.
1
6#pragma once
7
9#include <alib/pair>
10
13
14namespace rte {
15
17public:
22 template < class SymbolType >
24 unsigned i = 1;
25
26 return FormalRTE < ext::pair < SymbolType, unsigned > > ( FormalRTEStructure < ext::pair < SymbolType, unsigned > > ( rte.getRTE ( ).getStructure ( ).template accept < ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i ) ) );
27 }
28
29 template < class SymbolType >
30 class Formal {
31 public:
38 };
39
40};
41
42template < class SymbolType >
44 ext::pair < SymbolType, unsigned > sps = ext::make_pair ( node.getSymbol ( ).getSymbol ( ), i ++ );
46 for ( const rte::FormalRTEElement < SymbolType > & e : node.getElements ( ) ) {
48 }
49
51}
52
53template < class SymbolType >
56}
57
58template < class SymbolType >
60 ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > > left = node.getLeftElement ( ).template accept < ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
61 ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > > right = node.getRightElement ( ).template accept < ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
63}
64
65template < class SymbolType >
67 ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > > left = node.getLeftElement ( ).template accept < ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
68 ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > > right = node.getRightElement ( ).template accept < ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
69 FormalRTESymbolSubst < ext::pair < SymbolType, unsigned > > substSymbol ( common::ranked_symbol < ext::pair < SymbolType, unsigned > > ( ext::make_pair ( node.getSubstitutionSymbol ( ).getSymbol ( ).getSymbol ( ), 0u ), node.getSubstitutionSymbol ( ).getSymbol ( ).getRank ( ) ) );
70 return ext::ptr_value < FormalRTEElement < ext::pair < SymbolType, unsigned > > > ( FormalRTESubstitution < ext::pair < SymbolType, unsigned > > ( std::move ( left ), std::move ( right ), std::move ( substSymbol ) ) );
71}
72
73template < class SymbolType >
75 ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > > element = node.getElement ( ).template accept < ext::ptr_value < rte::FormalRTEElement < ext::pair < SymbolType, unsigned > > >, GlushkovIndexate::Formal < SymbolType > > ( i );
76 FormalRTESymbolSubst < ext::pair < SymbolType, unsigned > > substSymbol ( common::ranked_symbol < ext::pair < SymbolType, unsigned > > ( ext::make_pair ( node.getSubstitutionSymbol ( ).getSymbol ( ).getSymbol ( ), 0u ), node.getSubstitutionSymbol ( ).getSymbol ( ).getRank ( ) ) );
78}
79
80template < class SymbolType >
83}
84
85} /* namespace rte */
86
Definition: ranked_symbol.hpp:20
Class extending the pair class from the standard library. Original reason is to allow printing of the...
Definition: pair.hpp:43
Class representing wrapper of dynamically allocated object behaving like rvalue reference.
Definition: ptr_value.hpp:40
Implementation of vector storing dynamicaly allocated instances of given type. The class mimicks the ...
Definition: ptr_vector.hpp:44
void push_back(R &&value)
Appends a new value at the end of the container.
Definition: ptr_vector.hpp:1228
Represents the alternation operator in the regular tree expression. The node must have exactly two ch...
Definition: FormalRTEAlternation.h:44
Definition: FormalRTEElement.h:54
Represents the empty expression in the regular tree expression. The node can't have any children.
Definition: FormalRTEEmpty.h:40
Represents the iteration operator in the regular tree expression. The node has exactly one child.
Definition: FormalRTEIteration.h:45
Represents unbounded regular expression structure. Regular expression is stored as a tree of Unbounde...
Definition: FormalRTEStructure.h:41
Represents the concatenation operator in the regular tree expression. The node must have exactly two ...
Definition: FormalRTESubstitution.h:44
Represents the terminal symbol in the regular tree expression. The number of children must be the sam...
Definition: FormalRTESymbolAlphabet.h:44
Represents the substitution symbol in the regular tree expression. The node can't have any children.
Definition: FormalRTESymbolSubst.h:43
Formal regular tree expression represents regular tree expression. It describes regular tree language...
Definition: FormalRTE.h:71
Definition: GlushkovIndexate.h:30
static ext::ptr_value< FormalRTEElement< ext::pair< SymbolType, unsigned > > > visit(const rte::FormalRTEAlternation< SymbolType > &node, unsigned &i)
Definition: GlushkovIndexate.h:59
Definition: GlushkovIndexate.h:16
static FormalRTE< ext::pair< SymbolType, unsigned > > index(const rte::FormalRTE< SymbolType > &rte)
Definition: GlushkovIndexate.h:23
int i
Definition: AllEpsilonClosure.h:118
constexpr auto make_pair(T1 &&x, T2 &&y)
Definition: pair.hpp:79
Definition: Node.cpp:11
Definition: ToFTAGlushkov.h:22