Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
SymbolNormalize.h
Go to the documentation of this file.
1
6#pragma once
7
8#include <alib/vector>
9#include <alib/set>
10#include <alib/multiset>
11
13
14namespace alphabet {
15
20public:
21 template < class SymbolType >
23
24 template < class SymbolType >
26
27 template < class SymbolType >
28 static DefaultSymbolType normalizeSymbol ( SymbolType && symbol );
29
30 template < class FirstSymbolType, class SecondSymbolType >
32
33 template < class SymbolType >
35
36 template < class SymbolType >
38
39 template < class FirstSymbolType, class SecondSymbolType >
41
42 template < class FirstSymbolType, class SecondSymbolType >
44
45 template < class SymbolType >
47};
48
49template < class SymbolType >
52 for ( SymbolType && symbol : ext::make_mover ( symbols ) ) {
53 res.insert ( normalizeSymbol ( std::move ( symbol ) ) );
54 }
55 return res;
56}
57
58template < class SymbolType >
61 for ( common::ranked_symbol < SymbolType > && symbol : ext::make_mover ( symbols ) ) {
62 res.insert ( normalizeRankedSymbol ( std::move ( symbol ) ) );
63 }
64 return res;
65}
66
67template < class SymbolType >
69 return object::Object ( std::forward < SymbolType > ( symbol ) );
70}
71
72template < class FirstSymbolType, class SecondSymbolType >
74 if ( symbol.template is < FirstSymbolType > ( ) )
75 return ext::variant < DefaultSymbolType, DefaultSymbolType > ( object::Object ( std::move ( symbol.template get < FirstSymbolType > ( ) ) ) );
76 else
77 return ext::variant < DefaultSymbolType, DefaultSymbolType > ( object::Object ( std::move ( symbol.template get < SecondSymbolType > ( ) ) ) );
78}
79
80template < class SymbolType >
82 return common::ranked_symbol < DefaultSymbolType > ( normalizeSymbol ( std::move ( symbol ).getSymbol ( ) ), symbol.getRank ( ) );
83}
84
85template < class SymbolType >
88 for ( SymbolType & symbol : symbols ) {
89 res.push_back ( normalizeSymbol ( std::move ( symbol ) ) );
90 }
91 return res;
92}
93
94template < class FirstSymbolType, class SecondSymbolType >
98 res.push_back ( normalizeVariantSymbol ( std::move ( symbol ) ) );
99 }
100 return res;
101}
102
103template < class FirstSymbolType, class SecondSymbolType >
107 res.insert ( normalizeVariantSymbol ( std::move ( symbol ) ) );
108 }
109 return res;
110}
111
112template < class SymbolType >
115 for ( common::ranked_symbol < SymbolType > & symbol : symbols ) {
116 res.push_back ( normalizeRankedSymbol ( std::move ( symbol ) ) );
117 }
118 return res;
119}
120
121} /* namespace alphabet */
122
123namespace core {
124
125template < class SymbolType >
126struct normalize < common::ranked_symbol < SymbolType > > {
128 return alphabet::SymbolNormalize::normalizeRankedSymbol ( std::move ( value ) );
129 }
130};
131
132} /* namespace core */
133
Definition: SymbolNormalize.h:19
static ext::vector< common::ranked_symbol< DefaultSymbolType > > normalizeRankedSymbols(ext::vector< common::ranked_symbol< SymbolType > > &&symbols)
Definition: SymbolNormalize.h:113
static ext::set< DefaultSymbolType > normalizeAlphabet(ext::set< SymbolType > &&symbols)
Definition: SymbolNormalize.h:50
static common::ranked_symbol< DefaultSymbolType > normalizeRankedSymbol(common::ranked_symbol< SymbolType > &&symbol)
Definition: SymbolNormalize.h:81
static ext::set< common::ranked_symbol< DefaultSymbolType > > normalizeRankedAlphabet(ext::set< common::ranked_symbol< SymbolType > > &&symbols)
Definition: SymbolNormalize.h:59
static ext::vector< ext::variant< DefaultSymbolType, DefaultSymbolType > > normalizeVariantSymbols(ext::vector< ext::variant< FirstSymbolType, SecondSymbolType > > &&symbols)
Definition: SymbolNormalize.h:95
static ext::vector< DefaultSymbolType > normalizeSymbols(ext::vector< SymbolType > &&symbols)
Definition: SymbolNormalize.h:86
static DefaultSymbolType normalizeSymbol(SymbolType &&symbol)
Definition: SymbolNormalize.h:68
static ext::variant< DefaultSymbolType, DefaultSymbolType > normalizeVariantSymbol(ext::variant< FirstSymbolType, SecondSymbolType > &&symbol)
Definition: SymbolNormalize.h:73
Definition: ranked_symbol.hpp:20
Definition: multiset.hpp:44
Definition: set.hpp:44
Implementation of the variant class allowing to store any type of those listed in the template parame...
Definition: variant.hpp:98
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: Object.h:16
Definition: BarSymbol.cpp:12
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
return res
Definition: MinimizeByPartitioning.h:145
Definition: Permutation.hpp:18
Definition: normalize.hpp:10
reference_mover< T > make_mover(T &param)
Move adaptor construction function specialized to lvalue reference parameter.
Definition: iterator.hpp:468
static common::ranked_symbol< > eval(common::ranked_symbol< SymbolType > &&value)
Definition: SymbolNormalize.h:127
Definition: normalize.hpp:13