From 15e683ecc7bf6011a32bf2109c18cd61daa0c07f Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Wed, 17 Oct 2018 09:15:21 +0200 Subject: [PATCH] remove AutomatonBase --- alib2data/src/automaton/AutomatonBase.h | 53 ------------------- alib2data/src/automaton/FSM/CompactNFA.h | 18 ++----- alib2data/src/automaton/FSM/DFA.h | 18 ++----- alib2data/src/automaton/FSM/EpsilonNFA.h | 19 ++----- alib2data/src/automaton/FSM/ExtendedNFA.h | 18 ++----- .../FSM/MultiInitialStateEpsilonNFA.h | 20 +++---- .../src/automaton/FSM/MultiInitialStateNFA.h | 18 ++----- alib2data/src/automaton/FSM/NFA.h | 13 +---- alib2data/src/automaton/PDA/DPDA.h | 15 ++---- alib2data/src/automaton/PDA/InputDrivenDPDA.h | 17 ++---- alib2data/src/automaton/PDA/InputDrivenNPDA.h | 17 ++---- alib2data/src/automaton/PDA/NPDA.h | 16 ++---- alib2data/src/automaton/PDA/NPDTA.h | 15 ++---- .../PDA/RealTimeHeightDeterministicDPDA.h | 15 ++---- .../PDA/RealTimeHeightDeterministicNPDA.h | 16 ++---- alib2data/src/automaton/PDA/SinglePopDPDA.h | 17 ++---- alib2data/src/automaton/PDA/SinglePopNPDA.h | 16 ++---- .../src/automaton/PDA/VisiblyPushdownDPDA.h | 16 ++---- .../src/automaton/PDA/VisiblyPushdownNPDA.h | 16 ++---- alib2data/src/automaton/TA/DFTA.h | 18 ++----- alib2data/src/automaton/TA/NFTA.h | 18 ++----- alib2data/src/automaton/TM/OneTapeDTM.h | 16 ++---- 22 files changed, 88 insertions(+), 317 deletions(-) delete mode 100644 alib2data/src/automaton/AutomatonBase.h diff --git a/alib2data/src/automaton/AutomatonBase.h b/alib2data/src/automaton/AutomatonBase.h deleted file mode 100644 index 91d880ecd9..0000000000 --- a/alib2data/src/automaton/AutomatonBase.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * AutomatonBase.h - * - * This file is part of Algorithms library toolkit. - * Copyright (C) 2017 Jan Travnicek (jan.travnicek@fit.cvut.cz) - - * Algorithms library toolkit is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * Algorithms library toolkit is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with Algorithms library toolkit. If not, see <http://www.gnu.org/licenses/>. - * - * Created on: Apr 10, 2013 - * Author: Jan Travnicek - */ - -#ifndef AUTOMATON_BASE_H_ -#define AUTOMATON_BASE_H_ - -#include <alib/compare> - -namespace automaton { - -/** - * \brief Represents base for a concrete automaton type. - */ -class AutomatonBase : public ext::CompareOperators < AutomatonBase > { -public: - virtual ~AutomatonBase ( ) noexcept { - } - - /** - * \brief Comparison helper method evaluating allowing possibly deeper comparison of this with other class of the same type. - * - * \details If the other class is of different type the relative order is computer by means of type_index. - * - * \param other the other class to compare with - * - * \returns result of actual comparison if type of this class and other class is the same, result of difference of type indexes othervise. - */ - virtual int compare ( const AutomatonBase & other ) const = 0; -}; - -} /* namespace automaton */ - -#endif /* AUTOMATON_BASE_H_ */ diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h index 535a8b8806..209c8f7205 100644 --- a/alib2data/src/automaton/FSM/CompactNFA.h +++ b/alib2data/src/automaton/FSM/CompactNFA.h @@ -24,11 +24,13 @@ #ifndef COMPACT_DFA_H_ #define COMPACT_DFA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> -#include <ostream> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> #include <common/createUnique.hpp> @@ -39,7 +41,6 @@ #include <label/InitialStateLabel.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -75,7 +76,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class CompactNFA final : public AutomatonBase, public core::Components < CompactNFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class CompactNFA final : public ext::CompareOperators < CompactNFA < SymbolType, StateType > >, public core::Components < CompactNFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times a list of input symbols on the left hand side to a set of states. */ @@ -398,15 +399,6 @@ public: */ ext::map < ext::pair < StateType, ext::vector < SymbolType > >, ext::set < StateType > > getTransitionsToState ( const StateType & from ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h index 6dd35774e3..42b4869012 100644 --- a/alib2data/src/automaton/FSM/DFA.h +++ b/alib2data/src/automaton/FSM/DFA.h @@ -24,11 +24,13 @@ #ifndef DFA_H_ #define DFA_H_ -#include <alib/map> -#include <alib/set> #include <ostream> #include <sstream> + +#include <alib/map> +#include <alib/set> #include <alib/range> +#include <alib/compare> #include <core/components.hpp> @@ -36,7 +38,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -69,7 +70,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class DFA final : public AutomatonBase, public core::Components < DFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class DFA final : public ext::CompareOperators < DFA < SymbolType, StateType > >, public core::Components < DFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times an input symbol on the left hand side to a state. */ @@ -348,15 +349,6 @@ public: */ bool isTotal ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h index 995824c683..94374e3fa5 100644 --- a/alib2data/src/automaton/FSM/EpsilonNFA.h +++ b/alib2data/src/automaton/FSM/EpsilonNFA.h @@ -24,11 +24,12 @@ #ifndef EPSILON_NFA_H_ #define EPSILON_NFA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/variant> -#include <ostream> -#include <sstream> #include <core/components.hpp> #include <common/createUnique.hpp> @@ -40,7 +41,6 @@ #include <label/InitialStateLabel.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -75,7 +75,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class StateType = DefaultStateType > -class EpsilonNFA final : public AutomatonBase, public core::Components < EpsilonNFA < SymbolType, EpsilonType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class EpsilonNFA final : public ext::CompareOperators < EpsilonNFA < SymbolType, EpsilonType, StateType > >, public core::Components < EpsilonNFA < SymbolType, EpsilonType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times an input symbol or epsilon on the left hand side to a set of states. */ @@ -523,15 +523,6 @@ public: */ bool isTotal ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * @@ -539,7 +530,7 @@ public: * * \returns the actual relation between two by type same automata instances */ - virtual int compare ( const EpsilonNFA & other ) const; + int compare ( const EpsilonNFA & other ) const; /** * Print this object as raw representation to ostream. diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h index d4356f33a4..9e1a4217af 100644 --- a/alib2data/src/automaton/FSM/ExtendedNFA.h +++ b/alib2data/src/automaton/FSM/ExtendedNFA.h @@ -24,11 +24,13 @@ #ifndef EXTENDED_NFA_H_ #define EXTENDED_NFA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> -#include <ostream> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> #include <common/createUnique.hpp> @@ -42,7 +44,6 @@ #include <regexp/unbounded/UnboundedRegExpSymbol.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -78,7 +79,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class ExtendedNFA final : public AutomatonBase, public core::Components < ExtendedNFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class ExtendedNFA final : public ext::CompareOperators < ExtendedNFA < SymbolType, StateType > >, public core::Components < ExtendedNFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times a regular expression on the left hand side to a set of states. */ @@ -408,15 +409,6 @@ public: */ ext::map < ext::pair < StateType, regexp::UnboundedRegExpStructure < SymbolType > >, ext::set < StateType > > getTransitionsToState ( const StateType & from ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/FSM/MultiInitialStateEpsilonNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateEpsilonNFA.h index 4f29f6e32d..928c8a1c9a 100644 --- a/alib2data/src/automaton/FSM/MultiInitialStateEpsilonNFA.h +++ b/alib2data/src/automaton/FSM/MultiInitialStateEpsilonNFA.h @@ -24,11 +24,13 @@ #ifndef MULTI_INITIAL_STATE_EPSILON_NFA_H_ #define MULTI_INITIAL_STATE_EPSILON_NFA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/variant> -#include <ostream> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> #include <common/createUnique.hpp> @@ -40,7 +42,6 @@ #include <label/InitialStateLabel.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -76,7 +77,7 @@ class InitialStates; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class StateType = DefaultStateType > -class MultiInitialStateEpsilonNFA final : public AutomatonBase, public core::Components < MultiInitialStateEpsilonNFA < SymbolType, EpsilonType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { +class MultiInitialStateEpsilonNFA final : public ext::CompareOperators < MultiInitialStateEpsilonNFA < SymbolType, EpsilonType, StateType > >, public core::Components < MultiInitialStateEpsilonNFA < SymbolType, EpsilonType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { /** * Transition function as mapping from a state times an input symbol or epsilon on the left hand side to a set of states. */ @@ -560,15 +561,6 @@ public: */ bool isTotal ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * @@ -576,7 +568,7 @@ public: * * \returns the actual relation between two by type same automata instances */ - virtual int compare ( const MultiInitialStateEpsilonNFA & other ) const; + int compare ( const MultiInitialStateEpsilonNFA & other ) const; /** * Print this object as raw representation to ostream. diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h index 928049a304..4501076f98 100644 --- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h +++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h @@ -24,18 +24,19 @@ #ifndef MULTI_INITIAL_STATE_NFA_H_ #define MULTI_INITIAL_STATE_NFA_H_ -#include <alib/map> -#include <alib/set> #include <ostream> #include <sstream> +#include <alib/map> +#include <alib/set> +#include <alib/compare> + #include <core/components.hpp> #include <common/DefaultStateType.h> #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -68,7 +69,7 @@ class InitialStates; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class MultiInitialStateNFA final : public AutomatonBase, public core::Components < MultiInitialStateNFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { +class MultiInitialStateNFA final : public ext::CompareOperators < MultiInitialStateNFA < SymbolType, StateType > >, public core::Components < MultiInitialStateNFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { /** * Transition function as mapping from a state times an input symbol on the left hand side to a set of states. */ @@ -413,15 +414,6 @@ public: */ unsigned transitionsSize ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h index 65f8858d7c..f7be753c8c 100644 --- a/alib2data/src/automaton/FSM/NFA.h +++ b/alib2data/src/automaton/FSM/NFA.h @@ -26,6 +26,7 @@ #include <alib/map> #include <alib/set> +#include <alib/compare> #include <core/components.hpp> @@ -33,7 +34,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -65,7 +65,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class NFA final : public AutomatonBase, public core::Components < NFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class NFA final : public ext::CompareOperators < NFA < SymbolType, StateType > >, public core::Components < NFA < SymbolType, StateType >, ext::set < SymbolType >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times an input symbol on the left hand side to a set of states. */ @@ -382,15 +382,6 @@ public: */ unsigned transitionsSize ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h index dad243faca..d7a87e1b1c 100644 --- a/alib2data/src/automaton/PDA/DPDA.h +++ b/alib2data/src/automaton/PDA/DPDA.h @@ -24,12 +24,13 @@ #ifndef DPDA_H_ #define DPDA_H_ +#include <sstream> + #include <alib/set> #include <alib/map> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> #include <core/components.hpp> @@ -38,7 +39,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -79,7 +79,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class DPDA final : public AutomatonBase, public core::Components < DPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class DPDA final : public ext::CompareOperators < DPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < DPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Transition function as mapping from a state times an input symbol or epsilon times string of pushdown store symbols on the left hand side to a state times string of pushdown store symbols. @@ -511,15 +511,6 @@ public: */ ext::map < ext::tuple < StateType, ext::variant < EpsilonType, InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > getTransitionsToState ( const StateType & from ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/InputDrivenDPDA.h b/alib2data/src/automaton/PDA/InputDrivenDPDA.h index 0be13fe076..e54d9799bf 100644 --- a/alib2data/src/automaton/PDA/InputDrivenDPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenDPDA.h @@ -24,11 +24,12 @@ #ifndef INPUT_DRIVEN_DPDA_H_ #define INPUT_DRIVEN_DPDA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> -#include <ostream> -#include <sstream> #include <alib/algorithm> #include <core/components.hpp> @@ -37,7 +38,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -76,7 +76,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class InputDrivenDPDA final : public AutomatonBase, public core::Components < InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class InputDrivenDPDA final : public ext::CompareOperators < InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > >, public core::Components < InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Transition function as mapping from a state times an input symbol on the left hand side to a state. @@ -492,15 +492,6 @@ public: */ ext::map < ext::pair < StateType, InputSymbolType >, StateType > getTransitionsToState ( const StateType & to ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h index 076e60819e..a7557eba1d 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h @@ -24,11 +24,12 @@ #ifndef INPUT_DRIVEN_NPDA_H_ #define INPUT_DRIVEN_NPDA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> -#include <ostream> -#include <sstream> #include <alib/algorithm> #include <core/components.hpp> @@ -37,7 +38,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -76,7 +76,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class InputDrivenNPDA final : public AutomatonBase, public core::Components < InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class InputDrivenNPDA final : public ext::CompareOperators < InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType > >, public core::Components < InputDrivenNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Transition function as mapping from a state times an input symbol on the left hand side to a set of states. @@ -517,15 +517,6 @@ public: */ bool isDeterministic ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h index 8f0fc030a0..e709a6daa5 100644 --- a/alib2data/src/automaton/PDA/NPDA.h +++ b/alib2data/src/automaton/PDA/NPDA.h @@ -24,12 +24,14 @@ #ifndef NPDA_H_ #define NPDA_H_ +#include <sstream> + #include <alib/set> #include <alib/map> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -38,7 +40,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -73,7 +74,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class NPDA final : public AutomatonBase, public core::Components < NPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class NPDA final : public ext::CompareOperators < NPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < NPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times an input symbol or epsilon times string of pushdown store symbols on the left hand side to a state times string of pushdown store symbols. */ @@ -527,15 +528,6 @@ public: */ ext::map < ext::tuple < StateType, ext::variant < EpsilonType, InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::set < ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > > && getTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/NPDTA.h b/alib2data/src/automaton/PDA/NPDTA.h index 0d5500ea30..856e132257 100644 --- a/alib2data/src/automaton/PDA/NPDTA.h +++ b/alib2data/src/automaton/PDA/NPDTA.h @@ -24,12 +24,13 @@ #ifndef NPDTA_H_ #define NPDTA_H_ +#include <sstream> + #include <alib/set> #include <alib/map> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> #include <core/components.hpp> @@ -38,7 +39,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -76,7 +76,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class OutputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class NPDTA final : public AutomatonBase, public core::Components < NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < OutputSymbolType >, component::Set, OutputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class NPDTA final : public ext::CompareOperators < NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < OutputSymbolType >, component::Set, OutputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state times an input symbol or epsilon times string of pushdown store symbols on the left hand side to a state times string of pushdown store symbols times string of output symbols. */ @@ -604,15 +604,6 @@ public: */ ext::map < ext::tuple < StateType, ext::variant < EpsilonType, InputSymbolType >, ext::vector < PushdownStoreSymbolType > >, ext::tuple < StateType, ext::vector < PushdownStoreSymbolType >, ext::vector < OutputSymbolType > > > getTransitionsFromState ( const StateType & from ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h index da51703288..a6c1e62cb9 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h @@ -24,12 +24,13 @@ #ifndef REAL_TIME_HEIGHT_DETERMINISTIC_DPDA_H_ #define REAL_TIME_HEIGHT_DETERMINISTIC_DPDA_H_ +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> #include <core/components.hpp> @@ -38,7 +39,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -90,7 +90,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class RealTimeHeightDeterministicDPDA final : public AutomatonBase, public core::Components < RealTimeHeightDeterministicDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class RealTimeHeightDeterministicDPDA final : public ext::CompareOperators < RealTimeHeightDeterministicDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < RealTimeHeightDeterministicDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Call transition function as mapping from a state times an input symbol or epsilon on the left hand side to a state times pushdown store symbol on the right hand side. @@ -730,15 +730,6 @@ public: */ ext::map < ext::pair < StateType, ext::variant < EpsilonType, InputSymbolType > >, StateType > && getLocalTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h index 43efb6d4c6..090e4f0296 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h @@ -24,12 +24,14 @@ #ifndef REAL_TIME_HEIGHT_DETERMINISTIC_NPDA_H_ #define REAL_TIME_HEIGHT_DETERMINISTIC_NPDA_H_ +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -38,7 +40,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -77,7 +78,7 @@ class InitialStates; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class RealTimeHeightDeterministicNPDA final : public AutomatonBase, public core::Components < RealTimeHeightDeterministicNPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { +class RealTimeHeightDeterministicNPDA final : public ext::CompareOperators < RealTimeHeightDeterministicNPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < RealTimeHeightDeterministicNPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { protected: /** * Call transition function as mapping from a state times an input symbol or epsilon on the left hand side to a state times pushdown store symbol on the right hand side. @@ -850,15 +851,6 @@ public: */ ext::map < ext::pair < StateType, ext::variant < EpsilonType, InputSymbolType > >, ext::set < StateType > > && getLocalTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h index 8369ae03d8..72174d34b7 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h @@ -24,13 +24,14 @@ #ifndef SINGLE_POP_DPDA_H_ #define SINGLE_POP_DPDA_H_ +#include <sstream> +#include <ostream> + #include <alib/set> #include <alib/map> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> -#include <ostream> #include <core/components.hpp> @@ -39,7 +40,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -79,7 +79,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class SinglePopDPDA final : public AutomatonBase, public core::Components < SinglePopDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class SinglePopDPDA final : public ext::CompareOperators < SinglePopDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < SinglePopDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Transition function as mapping from a state times an input symbol or epsilon times pushdown store symbol on the left hand side to a state times string of pushdown store symbols. @@ -493,15 +493,6 @@ public: */ ext::map < ext::tuple < StateType, ext::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > && getTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h index 7d15498d9e..470da84813 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h @@ -24,12 +24,14 @@ #ifndef SINGLE_POP_NPDA_H_ #define SINGLE_POP_NPDA_H_ +#include <sstream> + #include <alib/set> #include <alib/map> #include <alib/vector> #include <alib/variant> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -38,7 +40,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -73,7 +74,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class EpsilonType = DefaultEpsilonType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class SinglePopNPDA final : public AutomatonBase, public core::Components < SinglePopNPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class SinglePopNPDA final : public ext::CompareOperators < SinglePopNPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > >, public core::Components < SinglePopNPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, InputAlphabet, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, InitialSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Transition function as mapping from a state times an input symbol or epsilon times pushdown store symbol on the left hand side to a state times string of pushdown store symbols. @@ -528,15 +529,6 @@ public: */ ext::map < ext::tuple < StateType, ext::variant < EpsilonType, InputSymbolType >, PushdownStoreSymbolType >, ext::set < ext::pair < StateType, ext::vector < PushdownStoreSymbolType > > > > && getTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h index 3b5ed4101c..179a2ecdc2 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h @@ -24,11 +24,13 @@ #ifndef VISIBLY_PUSHDOWN_DPDA_H_ #define VISIBLY_PUSHDOWN_DPDA_H_ +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -37,7 +39,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -85,7 +86,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class VisiblyPushdownDPDA final : public AutomatonBase, public core::Components < VisiblyPushdownDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, std::tuple < CallAlphabet, ReturnAlphabet, LocalAlphabet >, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class VisiblyPushdownDPDA final : public ext::CompareOperators < VisiblyPushdownDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > >, public core::Components < VisiblyPushdownDPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, std::tuple < CallAlphabet, ReturnAlphabet, LocalAlphabet >, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { protected: /** * Call transition function as mapping from a state times an input symbol on the left hand side to a state times pushdown store symbol on the right hand side. @@ -670,15 +671,6 @@ public: */ ext::map < ext::pair < StateType, InputSymbolType >, StateType > && getLocalTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h index 4afc48ec7b..220504b2ea 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h @@ -24,11 +24,13 @@ #ifndef VISIBLY_PUSHDOWN_NPDA_H_ #define VISIBLY_PUSHDOWN_NPDA_H_ +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> #include <alib/algorithm> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -37,7 +39,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -81,7 +82,7 @@ class InitialStates; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class InputSymbolType = DefaultSymbolType, class PushdownStoreSymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class VisiblyPushdownNPDA final : public AutomatonBase, public core::Components < VisiblyPushdownNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, std::tuple < CallAlphabet, ReturnAlphabet, LocalAlphabet >, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { +class VisiblyPushdownNPDA final : public ext::CompareOperators < VisiblyPushdownNPDA < InputSymbolType, PushdownStoreSymbolType, StateType > >, public core::Components < VisiblyPushdownNPDA < InputSymbolType, PushdownStoreSymbolType, StateType >, ext::set < InputSymbolType >, component::Set, std::tuple < CallAlphabet, ReturnAlphabet, LocalAlphabet >, ext::set < PushdownStoreSymbolType >, component::Set, PushdownStoreAlphabet, PushdownStoreSymbolType, component::Value, BottomOfTheStackSymbol, ext::set < StateType >, component::Set, std::tuple < States, InitialStates, FinalStates > > { protected: /** * Call transition function as mapping from a state times an input symbol on the left hand side to a state times pushdown store symbol on the right hand side. @@ -722,15 +723,6 @@ public: */ ext::map < ext::pair < StateType, InputSymbolType >, ext::set < StateType > > && getLocalTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/TA/DFTA.h b/alib2data/src/automaton/TA/DFTA.h index eaf94ad836..b1782042b2 100644 --- a/alib2data/src/automaton/TA/DFTA.h +++ b/alib2data/src/automaton/TA/DFTA.h @@ -24,11 +24,13 @@ #ifndef DFTA_H_ #define DFTA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> -#include <ostream> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> #include <common/ranked_symbol.hpp> @@ -38,7 +40,6 @@ #include <common/DefaultRankType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -74,7 +75,7 @@ class FinalStates; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class RankType = DefaultRankType, class StateType = DefaultStateType > -class DFTA final : public AutomatonBase, public core::Components < DFTA < SymbolType, RankType, StateType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates > > { +class DFTA final : public ext::CompareOperators < DFTA < SymbolType, RankType, StateType > >, public core::Components < DFTA < SymbolType, RankType, StateType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates > > { /** * Transition function as mapping from a list of states times an input symbol on the left hand side to a state. */ @@ -313,15 +314,6 @@ public: */ unsigned transitionsSize ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/TA/NFTA.h b/alib2data/src/automaton/TA/NFTA.h index 78a55f34b0..1f458e0821 100644 --- a/alib2data/src/automaton/TA/NFTA.h +++ b/alib2data/src/automaton/TA/NFTA.h @@ -24,11 +24,13 @@ #ifndef NFTA_H_ #define NFTA_H_ +#include <ostream> +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/vector> -#include <ostream> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -39,7 +41,6 @@ #include <common/DefaultRankType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <core/normalize.hpp> #include <alphabet/common/SymbolNormalize.h> @@ -72,7 +73,7 @@ class FinalStates; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class RankType = DefaultRankType, class StateType = DefaultStateType > -class NFTA final : public AutomatonBase, public core::Components < NFTA < SymbolType, RankType, StateType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates > > { +class NFTA final : public ext::CompareOperators < NFTA < SymbolType, RankType, StateType > >, public core::Components < NFTA < SymbolType, RankType, StateType >, ext::set < common::ranked_symbol < SymbolType, RankType > >, component::Set, InputAlphabet, ext::set < StateType >, component::Set, std::tuple < States, FinalStates > > { /** * Transition function as mapping from a list of states times an input symbol on the left hand side to a set of states. */ @@ -343,15 +344,6 @@ public: */ unsigned transitionsSize ( ) const; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h index 5dc503042e..bbdc9d583c 100644 --- a/alib2data/src/automaton/TM/OneTapeDTM.h +++ b/alib2data/src/automaton/TM/OneTapeDTM.h @@ -25,10 +25,12 @@ #ifndef ONE_TAPE_DTM_H_ #define ONE_TAPE_DTM_H_ +#include <sstream> + #include <alib/map> #include <alib/set> #include <alib/tuple> -#include <sstream> +#include <alib/compare> #include <core/components.hpp> @@ -37,7 +39,6 @@ #include <common/DefaultSymbolType.h> #include <automaton/AutomatonException.h> -#include <automaton/AutomatonBase.h> #include <automaton/common/Shift.h> #include <core/normalize.hpp> @@ -72,7 +73,7 @@ class InitialState; * \tparam StateType used to the states, and the initial state of the automaton. */ template < class SymbolType = DefaultSymbolType, class StateType = DefaultStateType > -class OneTapeDTM final : public AutomatonBase, public core::Components < OneTapeDTM < SymbolType, StateType >, ext::set < SymbolType >, component::Set, std::tuple < TapeAlphabet, InputAlphabet >, SymbolType, component::Value, BlankSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { +class OneTapeDTM final : public ext::CompareOperators < OneTapeDTM < SymbolType, StateType > >, public core::Components < OneTapeDTM < SymbolType, StateType >, ext::set < SymbolType >, component::Set, std::tuple < TapeAlphabet, InputAlphabet >, SymbolType, component::Value, BlankSymbol, ext::set < StateType >, component::Set, std::tuple < States, FinalStates >, StateType, component::Value, InitialState > { /** * Transition function as mapping from a state \times a tape symbol on the left hand side to a state \times tape symbol \times shift on tape. */ @@ -417,15 +418,6 @@ public: */ ext::map < ext::pair < StateType, SymbolType >, ext::tuple < StateType, SymbolType, Shift > > && getTransitions ( ) &&; - /** - * @copydoc base::CommonBase < AutomatonBase >::compare ( const AutomatonBase & ) - */ - virtual int compare ( const AutomatonBase & other ) const override { - if ( ext::type_index ( typeid ( * this ) ) == ext::type_index ( typeid ( other ) ) ) return this->compare ( ( decltype ( * this ) )other ); - - return ext::type_index ( typeid ( * this ) ) - ext::type_index ( typeid ( other ) ); - } - /** * The actual compare method * -- GitLab