From 278e747af48f64576b28e4dca74248d75e5b9050 Mon Sep 17 00:00:00 2001 From: Tomas Pecka <peckato1@fit.cvut.cz> Date: Thu, 4 Aug 2016 17:39:35 +0200 Subject: [PATCH] RTE: Constant alphabet shall now be known as Subst. alphabet --- .../rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp | 4 ++-- alib2algo/src/rte/glushkov/GlushkovTraversal.cpp | 4 ++-- alib2data/src/rte/RTE.cpp | 4 ++-- alib2data/src/rte/RTE.h | 2 +- alib2data/src/rte/RTEBase.h | 2 +- alib2data/src/rte/common/RTEAlphabet.cpp | 2 +- alib2data/src/rte/common/RTEAlphabet.h | 2 +- alib2data/src/rte/formal/FormalRTE.cpp | 8 ++++---- alib2data/src/rte/formal/FormalRTE.h | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) diff --git a/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp b/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp index d382900201..d6e747b599 100644 --- a/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp +++ b/alib2algo/src/rte/convert/ToPostfixPushdownAutomatonGlushkov.cpp @@ -55,12 +55,12 @@ automaton::NPDA ToPostfixPushdownAutomatonGlushkov::convert ( const rte::FormalR followSet.insert ( std::make_pair ( symbol, rte::GlushkovTraversal::follow ( indexedRTE, symbol ) ) ); /* check for exceptions -> there must be NO substitution symbol in first or follow sets */ - if ( isSubstSymbolPresent ( firstSet, rte.getConstantAlphabet ( ) ) ) + if ( isSubstSymbolPresent ( firstSet, rte.getSubstitutionAlphabet ( ) ) ) throw exception::CommonException ( "GlushkovRTE: Substitution symbol appeared in the first set" ); for ( const auto & kv : followSet ) for ( const auto & followTuple : kv.second ) - if ( isSubstSymbolPresent ( std::set < alphabet::RankedSymbol > ( followTuple.begin ( ), followTuple.end ( ) ), rte.getConstantAlphabet ( ) ) ) + if ( isSubstSymbolPresent ( std::set < alphabet::RankedSymbol > ( followTuple.begin ( ), followTuple.end ( ) ), rte.getSubstitutionAlphabet ( ) ) ) throw exception::CommonException ( "GlushkovRTE: Substitution symbol appeared in a follow set" ); /* check end */ diff --git a/alib2algo/src/rte/glushkov/GlushkovTraversal.cpp b/alib2algo/src/rte/glushkov/GlushkovTraversal.cpp index c29726e289..c74ab85e85 100644 --- a/alib2algo/src/rte/glushkov/GlushkovTraversal.cpp +++ b/alib2algo/src/rte/glushkov/GlushkovTraversal.cpp @@ -32,11 +32,11 @@ std::set < std::vector < alphabet::RankedSymbol > > GlushkovTraversal::follow ( std::map < alphabet::RankedSymbol, std::set < alphabet::RankedSymbol > > subMap; /* Init substitution map, ie \forall a \in K: sub[a] = \emptyset */ - for ( const alphabet::RankedSymbol & ssymb : rte.getConstantAlphabet ( ) ) + for ( const alphabet::RankedSymbol & ssymb : rte.getSubstitutionAlphabet ( ) ) subMap.insert ( std::make_pair ( ssymb, std::set < alphabet::RankedSymbol > { } ) ); /* recursively compute follow */ - return follow ( rte.getRTE ( ), symbol, rte.getConstantAlphabet ( ), subMap ); + return follow ( rte.getRTE ( ), symbol, rte.getSubstitutionAlphabet ( ), subMap ); } // ----------------------------------------------------------------------------- diff --git a/alib2data/src/rte/RTE.cpp b/alib2data/src/rte/RTE.cpp index e57226fc58..9c3db150b8 100644 --- a/alib2data/src/rte/RTE.cpp +++ b/alib2data/src/rte/RTE.cpp @@ -10,8 +10,8 @@ const std::set < alphabet::RankedSymbol > & RTE::getAlphabet ( ) const { return this->getData ( ).getAlphabet ( ); } -const std::set < alphabet::RankedSymbol > & RTE::getConstantAlphabet ( ) const { - return this->getData ( ).getConstantAlphabet ( ); +const std::set < alphabet::RankedSymbol > & RTE::getSubstitutionAlphabet ( ) const { + return this->getData ( ).getSubstitutionAlphabet ( ); } } /* namespace rte */ diff --git a/alib2data/src/rte/RTE.h b/alib2data/src/rte/RTE.h index 173cf311e4..93b77c7290 100644 --- a/alib2data/src/rte/RTE.h +++ b/alib2data/src/rte/RTE.h @@ -19,7 +19,7 @@ class RTE : public alib::WrapperBase < RTEBase > { public: const std::set < alphabet::RankedSymbol > & getAlphabet ( ) const; - const std::set < alphabet::RankedSymbol > & getConstantAlphabet ( ) const; + const std::set < alphabet::RankedSymbol > & getSubstitutionAlphabet ( ) const; static const std::string & getXmlTagRefName ( ) { static std::string xmlTagName = "RTERef"; diff --git a/alib2data/src/rte/RTEBase.h b/alib2data/src/rte/RTEBase.h index 51d730b0e6..aff76e528a 100644 --- a/alib2data/src/rte/RTEBase.h +++ b/alib2data/src/rte/RTEBase.h @@ -20,7 +20,7 @@ public: virtual RTEBase * plunder ( ) && = 0; virtual const std::set < alphabet::RankedSymbol > & getAlphabet ( ) const = 0; - virtual const std::set < alphabet::RankedSymbol > & getConstantAlphabet ( ) const = 0; + virtual const std::set < alphabet::RankedSymbol > & getSubstitutionAlphabet ( ) const = 0; }; } /* namespace rte */ diff --git a/alib2data/src/rte/common/RTEAlphabet.cpp b/alib2data/src/rte/common/RTEAlphabet.cpp index bae5e7aeed..4bbdc81e86 100644 --- a/alib2data/src/rte/common/RTEAlphabet.cpp +++ b/alib2data/src/rte/common/RTEAlphabet.cpp @@ -51,7 +51,7 @@ const std::set < alphabet::RankedSymbol > & RTEAlphabet::getAlphabet ( ) const { return alphabetF; } -const std::set < alphabet::RankedSymbol > & RTEAlphabet::getConstantAlphabet ( ) const { +const std::set < alphabet::RankedSymbol > & RTEAlphabet::getSubstitutionAlphabet ( ) const { return alphabetK; } diff --git a/alib2data/src/rte/common/RTEAlphabet.h b/alib2data/src/rte/common/RTEAlphabet.h index f013b8d96d..0f979def05 100644 --- a/alib2data/src/rte/common/RTEAlphabet.h +++ b/alib2data/src/rte/common/RTEAlphabet.h @@ -48,7 +48,7 @@ public: * @return the input alphabet */ const std::set < alphabet::RankedSymbol > & getAlphabet ( ) const; - const std::set < alphabet::RankedSymbol > & getConstantAlphabet ( ) const; + const std::set < alphabet::RankedSymbol > & getSubstitutionAlphabet ( ) const; }; } /* namespace rte */ diff --git a/alib2data/src/rte/formal/FormalRTE.cpp b/alib2data/src/rte/formal/FormalRTE.cpp index 1b6fa978c2..922c1f276a 100644 --- a/alib2data/src/rte/formal/FormalRTE.cpp +++ b/alib2data/src/rte/formal/FormalRTE.cpp @@ -62,7 +62,7 @@ void FormalRTE::setRTE ( const FormalRTEElement & rte ) { void FormalRTE::setRTE ( FormalRTEElement && param ) { this->rte = std::smart_ptr < FormalRTEElement > ( std::move ( param ).plunder ( ) ); - if ( !this->rte->checkAlphabet ( getAlphabet ( ), getConstantAlphabet ( ) ) ) + if ( !this->rte->checkAlphabet ( getAlphabet ( ), getSubstitutionAlphabet ( ) ) ) throw exception::CommonException ( "Symbols not matching alphabets." ); } @@ -71,8 +71,8 @@ void FormalRTE::operator >>( std::ostream & out ) const { } int FormalRTE::compare ( const FormalRTE & other ) const { - auto first = std::tie ( rte, getAlphabet ( ), getConstantAlphabet ( ) ); - auto second = std::tie ( rte, other.getAlphabet ( ), getConstantAlphabet ( ) ); + auto first = std::tie ( rte, getAlphabet ( ), getSubstitutionAlphabet ( ) ); + auto second = std::tie ( rte, other.getAlphabet ( ), getSubstitutionAlphabet ( ) ); std::compare < decltype ( first ) > comp; @@ -98,7 +98,7 @@ FormalRTE FormalRTE::parse ( std::deque < sax::Token >::iterator & input ) { void FormalRTE::compose ( std::deque < sax::Token > & out ) const { out.emplace_back ( FormalRTE::getXmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); - RTEToXMLComposer::composeAlphabet ( out, this->getAlphabet ( ), this->getConstantAlphabet ( ) ); + RTEToXMLComposer::composeAlphabet ( out, this->getAlphabet ( ), this->getSubstitutionAlphabet ( ) ); alib::xmlApi < FormalRTEElement >::compose ( out, this->getRTE ( ) ); out.emplace_back ( FormalRTE::getXmlTagName ( ), sax::Token::TokenType::END_ELEMENT ); } diff --git a/alib2data/src/rte/formal/FormalRTE.h b/alib2data/src/rte/formal/FormalRTE.h index a0904df266..af4be29085 100644 --- a/alib2data/src/rte/formal/FormalRTE.h +++ b/alib2data/src/rte/formal/FormalRTE.h @@ -62,7 +62,7 @@ public: accessComponent < GeneralAlphabet > ( ).remove ( symbol ); } - const std::set < alphabet::RankedSymbol > & getConstantAlphabet ( ) const { + const std::set < alphabet::RankedSymbol > & getSubstitutionAlphabet ( ) const { return accessComponent < ConstantAlphabet > ( ).get ( ); } -- GitLab