Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Concepts
FormalRTEEmpty.h
Go to the documentation of this file.
1
6/*
7 * This file is part of Algorithms library toolkit.
8 * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz)
9
10 * Algorithms library toolkit is free software: you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation, either version 3 of the License, or
13 * (at your option) any later version.
14
15 * Algorithms library toolkit is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19
20 * You should have received a copy of the GNU General Public License
21 * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>.
22 */
23
24#pragma once
25
26#include "FormalRTEElement.h"
27
28namespace rte {
29
39template < class SymbolType >
40class FormalRTEEmpty : public ext::NullaryNode < FormalRTEElement < SymbolType > > {
44 void accept ( typename FormalRTEElement < SymbolType >::ConstVisitor & visitor ) const override {
45 visitor.visit ( * this );
46 }
47
51 void accept ( typename FormalRTEElement < SymbolType >::Visitor & visitor ) override {
52 visitor.visit ( * this );
53 }
54
55public:
59 explicit FormalRTEEmpty ( ) = default;
60
64 FormalRTEEmpty < SymbolType > * clone ( ) const & override;
65
69 FormalRTEEmpty < SymbolType > * clone ( ) && override;
70
74 bool testSymbol ( const common::ranked_symbol < SymbolType > & symbol ) const override;
75
79 void computeMinimalAlphabet ( ext::set < common::ranked_symbol < SymbolType > > & alphabetF, ext::set < common::ranked_symbol < SymbolType > > & alphabetK ) const override;
80
84 bool checkAlphabet ( const ext::set < common::ranked_symbol < SymbolType > > & alphabetF, const ext::set < common::ranked_symbol < SymbolType > > & alphabetK ) const override;
85
89 std::strong_ordering operator <=> ( const FormalRTEElement < SymbolType > & other ) const override {
90 if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return * this <=> static_cast < decltype ( ( * this ) ) > ( other );
91
92 return ext::type_index ( typeid ( * this ) ) <=> ext::type_index ( typeid ( other ) );
93 }
94
102 std::strong_ordering operator <=> ( const FormalRTEEmpty < SymbolType > & ) const;
103
107 bool operator == ( const FormalRTEElement < SymbolType > & other ) const override {
108 if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return * this == static_cast < decltype ( ( * this ) ) > ( other );
109
110 return false;
111 }
112
120 bool operator == ( const FormalRTEEmpty < SymbolType > & ) const;
121
125 void operator >>( ext::ostream & out ) const override;
126
132 }
133};
134
135template < class SymbolType >
136FormalRTEEmpty < SymbolType > * FormalRTEEmpty < SymbolType >::clone ( ) const & {
137 return new FormalRTEEmpty ( * this );
138}
139
140template < class SymbolType >
141FormalRTEEmpty < SymbolType > * FormalRTEEmpty < SymbolType >::clone ( ) && {
142 return new FormalRTEEmpty ( std::move ( * this ) );
143}
144
145template < class SymbolType >
147 return std::strong_ordering::equal;
148}
149
150template < class SymbolType >
152 return true;
153}
154
155template < class SymbolType >
157 out << "(FormalRTEEmpty)";
158}
159
160template < class SymbolType >
162 return false;
163}
164
165template < class SymbolType >
167}
168
169template < class SymbolType >
171 return true;
172}
173
174} /* namespace rte */
175
177
Definition: ranked_symbol.hpp:20
Nullary node is specialisation of Anyary node to no children.
Definition: tree_base.hpp:358
Definition: ostream.h:14
Definition: set.hpp:44
Managed pointer simulating value like behavior.
Definition: memory.hpp:233
Definition: typeindex.h:37
Definition: FormalRTEElement.h:59
virtual void visit(const FormalRTEAlternation< SymbolType > &alternation)=0
Definition: FormalRTEElement.h:70
virtual void visit(FormalRTEAlternation< SymbolType > &alternation)=0
Definition: FormalRTEElement.h:54
Represents the empty expression in the regular tree expression. The node can't have any children.
Definition: FormalRTEEmpty.h:40
ext::smart_ptr< FormalRTEElement< DefaultSymbolType > > normalize() &&override
Traverses the rte tree and normalizes the symbols to DefaultSymbolType. ( ) &&
Definition: FormalRTEEmpty.h:130
bool testSymbol(const common::ranked_symbol< SymbolType > &symbol) const override
< SymbolType >::testSymbol ( const common::ranked_symbol < SymbolType > & ) const
Definition: FormalRTEEmpty.h:161
std::strong_ordering operator<=>(const FormalRTEElement< SymbolType > &other) const override
< SymbolType >::operator <=> ( const FormalRTEElement < SymbolType > & other ) const;
Definition: FormalRTEEmpty.h:89
bool checkAlphabet(const ext::set< common::ranked_symbol< SymbolType > > &alphabetF, const ext::set< common::ranked_symbol< SymbolType > > &alphabetK) const override
< SymbolType >::checkAlphabet ( const ext::set < common::ranked_symbol < SymbolType > > &,...
Definition: FormalRTEEmpty.h:170
FormalRTEEmpty< SymbolType > * clone() const &override
< SymbolType >::clone ( ) const &
bool operator==(const FormalRTEElement< SymbolType > &other) const override
< SymbolType >::operator == ( const FormalRTEElement < SymbolType > & other ) const;
Definition: FormalRTEEmpty.h:107
void operator>>(ext::ostream &out) const override
< FormalRTEElement < SymbolType > >::operator >> ( ext::ostream & ) const
Definition: FormalRTEEmpty.h:156
void computeMinimalAlphabet(ext::set< common::ranked_symbol< SymbolType > > &alphabetF, ext::set< common::ranked_symbol< SymbolType > > &alphabetK) const override
< SymbolType >::computeMinimalAlphabet ( ext::set < common::ranked_symbol < SymbolType > > &,...
Definition: FormalRTEEmpty.h:166
FormalRTEEmpty()=default
Creates a new instance of the empty node.
typename T::SymbolType SymbolType
Definition: ReachableStates.h:176
Definition: Permutation.hpp:18
Definition: sigHandler.cpp:20
Definition: ToFTAGlushkov.h:22
Definition: FordFulkerson.hpp:16