From a3a4776da3f28d1ca3c6720acbdb13351145744b Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Tue, 25 Sep 2018 14:57:18 +0200 Subject: [PATCH] document automaton accept algorithm --- alib2algo/src/automaton/run/Accept.h | 131 ++++++++++++++++++++++++++- 1 file changed, 129 insertions(+), 2 deletions(-) diff --git a/alib2algo/src/automaton/run/Accept.h b/alib2algo/src/automaton/run/Accept.h index 7651184918..2364ee560f 100644 --- a/alib2algo/src/automaton/run/Accept.h +++ b/alib2algo/src/automaton/run/Accept.h @@ -33,27 +33,154 @@ namespace run { class Accept { public: /** - * Performs conversion. - * @return left regular grammar equivalent to source automaton. + * Automaton run implementation resulting in boolean true if the automaton accepted the input. + * + * \tparam SymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string */ template < class SymbolType, class StateType > static bool accept ( const automaton::DFA < SymbolType, StateType > & automaton, const string::LinearString < SymbolType > & string ); + + /** + * \override + * + * \tparam SymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class SymbolType, class StateType > static bool accept ( const automaton::NFA < SymbolType, StateType > & automaton, const string::LinearString < SymbolType > & string ); + + /** + * \override + * + * \tparam SymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam EpsilonType type of epsilon in the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class SymbolType, class EpsilonType, class StateType > static bool accept ( const automaton::EpsilonNFA < SymbolType, EpsilonType, StateType > & automaton, const string::LinearString < SymbolType > & string ); + + /** + * \override + * + * \tparam SymbolType type of symbols of nodes and terminal symbols of the runned automaton + * \tparam RankType type of ranks of nodes and terminal symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class SymbolType, class RankType, class StateType > static bool accept ( const automaton::DFTA < SymbolType, RankType, StateType > & automaton, const tree::RankedTree < SymbolType, RankType > & tree ); + + /** + * \override + * + * \tparam SymbolType type of symbols of nodes and terminal symbols of the runned automaton + * \tparam RankType type of ranks of nodes and terminal symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class SymbolType, class RankType, class StateType > static bool accept ( const automaton::NFTA < SymbolType, RankType, StateType > & automaton, const tree::RankedTree < SymbolType, RankType > & tree ); + + /** + * \override + * + * \tparam InputSymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > static bool accept ( const automaton::InputDrivenDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ); + + /** + * \override + * + * \tparam InputSymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class InputSymbolType, class PushdownStoreSymbolType, class StateType > static bool accept ( const automaton::VisiblyPushdownDPDA < InputSymbolType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ); + + /** + * \override + * + * \tparam InputSymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam EpsilonType type of epsilon in the runned automaton + * \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > static bool accept ( const automaton::RealTimeHeightDeterministicDPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ); + + /** + * \override + * + * \tparam InputSymbolType type of symbols of the string and terminal symbols of the runned automaton + * \tparam EpsilonType type of epsilon in the runned automaton + * \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class InputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > static bool accept ( const automaton::DPDA < InputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ); + + /** + * \override + * + * \tparam InputSymbolType type of input symbols of the string and terminal symbols of the runned automaton + * \tparam OutputSymbolType type of output symbols of the runned automaton + * \tparam EpsilonType type of epsilon in the runned automaton + * \tparam PushdownStoreSymbolType type of pushdown store symbols of the runned automaton + * \tparam StateType type of states of the runned automaton + * + * \param automaton the runned automaton + * \param string the input of the automaton + * + * \return true if the automaton accepts given string + */ template < class InputSymbolType, class OutputSymbolType, class EpsilonType, class PushdownStoreSymbolType, class StateType > static bool accept ( const automaton::NPDTA < InputSymbolType, OutputSymbolType, EpsilonType, PushdownStoreSymbolType, StateType > & automaton, const string::LinearString < InputSymbolType > & string ); -- GitLab