From 572cdc215fc74256a799a5e6349fc46c9d26ab6f Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sat, 5 Aug 2017 06:35:00 +0200 Subject: [PATCH] move tree types to namespace ext --- .../src/arbology/exact/ExactPatternMatch.h | 36 +++---- .../exact/ExactPatternMatchingAutomaton.cpp | 4 +- .../src/arbology/exact/ExactSubtreeMatch.h | 24 ++--- .../exact/ExactSubtreeMatchingAutomaton.cpp | 4 +- alib2algo/src/automaton/run/Run.h | 12 +-- .../stringology/indexing/PositionHeapNaive.h | 6 +- .../stringology/indexing/SuffixTrieNaive.h | 6 +- .../stringology/query/PositionHeapFactors.h | 6 +- .../src/stringology/query/SuffixTrieFactors.h | 6 +- alib2algo/src/tree/NormalizeTreeLabels.h | 10 +- .../src/tree/generate/RandomTreeFactory.cpp | 48 +++++----- .../properties/ExactSubtreeRepeatsNaive.h | 10 +- alib2common/src/container/ObjectsTree.h | 48 +++++----- alib2common/src/container/ObjectsTrie.h | 62 ++++++------ .../test-src/container/ContainerTest.cpp | 24 ++--- .../src/indexes/common/IndexesNormalize.h | 16 ++-- .../src/indexes/stringology/PositionHeap.h | 34 +++---- .../src/indexes/stringology/SuffixTrie.h | 36 +++---- .../regexp/formal/FormalRegExpAlternation.h | 4 +- .../regexp/formal/FormalRegExpConcatenation.h | 4 +- .../src/regexp/formal/FormalRegExpElement.h | 2 +- .../src/regexp/formal/FormalRegExpEmpty.h | 2 +- .../src/regexp/formal/FormalRegExpEpsilon.h | 2 +- .../src/regexp/formal/FormalRegExpIteration.h | 4 +- .../src/regexp/formal/FormalRegExpSymbol.h | 2 +- .../unbounded/UnboundedRegExpAlternation.h | 2 +- .../unbounded/UnboundedRegExpConcatenation.h | 2 +- .../regexp/unbounded/UnboundedRegExpElement.h | 2 +- .../regexp/unbounded/UnboundedRegExpEmpty.h | 2 +- .../regexp/unbounded/UnboundedRegExpEpsilon.h | 2 +- .../unbounded/UnboundedRegExpIteration.h | 4 +- .../regexp/unbounded/UnboundedRegExpSymbol.h | 2 +- .../src/rte/formal/FormalRTEAlternation.h | 4 +- alib2data/src/rte/formal/FormalRTEElement.h | 2 +- alib2data/src/rte/formal/FormalRTEIteration.h | 4 +- .../src/rte/formal/FormalRTESubstitution.h | 4 +- .../src/rte/formal/FormalRTESymbolAlphabet.h | 2 +- .../src/rte/formal/FormalRTESymbolSubst.h | 2 +- alib2data/src/tree/common/TreeAuxiliary.h | 36 +++---- alib2data/src/tree/common/TreeFromXMLParser.h | 14 +-- alib2data/src/tree/common/TreeNormalize.h | 20 ++-- alib2data/src/tree/common/TreeToXMLComposer.h | 6 +- alib2data/src/tree/ranked/PostfixRankedTree.h | 6 +- .../ranked/PrefixRankedBarNonlinearPattern.h | 6 +- .../src/tree/ranked/PrefixRankedBarPattern.h | 6 +- .../src/tree/ranked/PrefixRankedBarTree.h | 6 +- .../ranked/PrefixRankedNonlinearPattern.h | 6 +- .../src/tree/ranked/PrefixRankedPattern.h | 6 +- alib2data/src/tree/ranked/PrefixRankedTree.h | 6 +- .../src/tree/ranked/RankedNonlinearPattern.h | 42 ++++---- alib2data/src/tree/ranked/RankedPattern.h | 38 ++++---- alib2data/src/tree/ranked/RankedTree.h | 38 ++++---- alib2data/src/tree/unranked/PrefixBarTree.h | 6 +- .../tree/unranked/UnrankedNonlinearPattern.h | 36 +++---- alib2data/src/tree/unranked/UnrankedPattern.h | 28 +++--- alib2data/src/tree/unranked/UnrankedTree.h | 28 +++--- alib2data/test-src/tree/PatternTest.cpp | 48 +++++----- alib2data/test-src/tree/TreeTest.cpp | 96 +++++++++---------- alib2raw/src/tree/TreeFromRawParser.cpp | 6 +- alib2raw/src/tree/TreeFromRawParser.h | 2 +- alib2raw/src/tree/TreeToRawComposer.h | 12 +-- alib2std/src/extensions/tree.hpp | 16 ++-- alib2std/src/extensions/tree_base.hpp | 18 ++-- alib2std/src/extensions/trie.hpp | 12 +-- alib2std/test-src/extensions/TreeBaseTest.h | 12 +-- alib2std/test-src/extensions/TreeTest.cpp | 28 +++--- alib2std/test-src/extensions/TreeTest.h | 2 +- alib2std/test-src/extensions/TrieTest.cpp | 26 ++--- alib2std/test-src/extensions/TrieTest.h | 2 +- alib2str/src/tree/TreeFromStringParser.cpp | 46 ++++----- alib2str/src/tree/TreeFromStringParser.h | 4 +- alib2str/src/tree/TreeToStringComposer.h | 24 ++--- 72 files changed, 563 insertions(+), 571 deletions(-) diff --git a/alib2algo/src/arbology/exact/ExactPatternMatch.h b/alib2algo/src/arbology/exact/ExactPatternMatch.h index 7768a6bb8a..316bc41614 100644 --- a/alib2algo/src/arbology/exact/ExactPatternMatch.h +++ b/alib2algo/src/arbology/exact/ExactPatternMatch.h @@ -66,50 +66,50 @@ public: private: template < class SymbolType > - static bool matchHelper ( const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ); + static bool matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ); template < class SymbolType, class RankType > - static bool matchHelper ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ); + static bool matchHelper ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ); template < class SymbolType, class RankType > - static bool matchHelper ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const std::tree < common::ranked_symbol < unsigned, RankType > > & repeats, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & variablesSetting ); + static bool matchHelper ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const ext::tree < common::ranked_symbol < unsigned, RankType > > & repeats, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & variablesSetting ); template < class SymbolType > - static void matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ); + static void matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ); template < class SymbolType, class RankType > - static void matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ); + static void matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ); template < class SymbolType, class RankType > - static void matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const std::tree < common::ranked_symbol < unsigned, RankType > > & subjectRepeats ); + static void matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const ext::tree < common::ranked_symbol < unsigned, RankType > > & subjectRepeats ); }; template < class SymbolType > -bool ExactPatternMatch::matchHelper ( const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ) { +bool ExactPatternMatch::matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ) { if ( pattern.getData ( ) == subtreeVariable ) return true; if ( subject.getData ( ) != pattern.getData ( ) ) return false; if ( subject.getChildren ( ).size ( ) != pattern.getChildren ( ).size ( ) ) return false; - for ( const std::tuple < const std::tree < SymbolType >, const std::tree < SymbolType > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) + for ( const std::tuple < const ext::tree < SymbolType >, const ext::tree < SymbolType > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ), subtreeVariable ) ) return false; return true; } template < class SymbolType, class RankType > -bool ExactPatternMatch::matchHelper ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ) { +bool ExactPatternMatch::matchHelper ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ) { if ( pattern.getData ( ) == subtreeVariable ) return true; if ( subject.getData ( ) != pattern.getData ( ) ) return false; // ranked symbols are the same; test for number of children is not needed - for ( const std::tuple < const std::tree < common::ranked_symbol < SymbolType, RankType > >, const std::tree < common::ranked_symbol < SymbolType, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) + for ( const std::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < SymbolType, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ), subtreeVariable ) ) return false; return true; } template < class SymbolType, class RankType > -bool ExactPatternMatch::matchHelper ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const std::tree < common::ranked_symbol < unsigned, RankType > > & repeats, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & variablesSetting ) { +bool ExactPatternMatch::matchHelper ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const ext::tree < common::ranked_symbol < unsigned, RankType > > & repeats, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & variablesSetting ) { if ( pattern.getData ( ) == subtreeVariable ) return true; if ( nonlinearVariables.count ( pattern.getData ( ) ) ) { @@ -125,41 +125,41 @@ bool ExactPatternMatch::matchHelper ( const std::tree < common::ranked_symbol < if ( subject.getData ( ) != pattern.getData ( ) ) return false; // ranked symbols are the same; test for number of children is not needed - for ( const std::tuple < const std::tree < common::ranked_symbol < SymbolType, RankType > >, const std::tree < common::ranked_symbol < SymbolType, RankType > >, const std::tree < common::ranked_symbol < unsigned, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ), repeats.getChildren ( ) ) ) + for ( const std::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < unsigned, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ), repeats.getChildren ( ) ) ) if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ), subtreeVariable, nonlinearVariables, std::get < 2 > ( childs ), variablesSetting ) ) return false; return true; } template < class SymbolType > -void ExactPatternMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ) { +void ExactPatternMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ) { if ( matchHelper ( subject, pattern, subtreeVariable ) ) occ.insert ( index ); index++; - for ( const std::tree < SymbolType > & child : subject.getChildren ( ) ) + for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) matchInternal ( index, occ, child, pattern, subtreeVariable ); } template < class SymbolType, class RankType > -void ExactPatternMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ) { +void ExactPatternMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable ) { if ( matchHelper ( subject, pattern, subtreeVariable ) ) occ.insert ( index ); index++; - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : subject.getChildren ( ) ) + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : subject.getChildren ( ) ) matchInternal ( index, occ, child, pattern, subtreeVariable ); } template < class SymbolType, class RankType > -void ExactPatternMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const std::tree < common::ranked_symbol < unsigned, RankType > > & repeats ) { +void ExactPatternMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern, const common::ranked_symbol < SymbolType, RankType > & subtreeVariable, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const ext::tree < common::ranked_symbol < unsigned, RankType > > & repeats ) { std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > variablesSetting; if ( matchHelper ( subject, pattern, subtreeVariable, nonlinearVariables, repeats, variablesSetting ) ) occ.insert ( index ); index++; - for ( const std::tuple < const std::tree < common::ranked_symbol < SymbolType, RankType > >, const std::tree < common::ranked_symbol < unsigned, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), repeats.getChildren ( ) ) ) + for ( const std::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < unsigned, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), repeats.getChildren ( ) ) ) matchInternal ( index, occ, std::get < 0 > ( childs ), pattern, subtreeVariable, nonlinearVariables, std::get < 1 > ( childs ) ); } diff --git a/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp b/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp index c794c7321a..d741ff4992 100644 --- a/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactPatternMatchingAutomaton.cpp @@ -196,7 +196,7 @@ automaton::NFTA < > ExactPatternMatchingAutomaton::construct ( const tree::Ranke auto ExactPatternMatchingAutomatonRankedTree = registration::OverloadRegister < ExactPatternMatchingAutomaton, automaton::NFTA < >, tree::RankedTree < > > ( ExactPatternMatchingAutomaton::construct ); -DefaultStateType constructRecursivePattern ( const std::tree < common::ranked_symbol < > > & node, automaton::NFTA < > & res, const common::ranked_symbol < > & subtreeWildcard, const DefaultStateType & loopState, int & nextState ) { +DefaultStateType constructRecursivePattern ( const ext::tree < common::ranked_symbol < > > & node, automaton::NFTA < > & res, const common::ranked_symbol < > & subtreeWildcard, const DefaultStateType & loopState, int & nextState ) { if ( node.getData ( ) == subtreeWildcard ) { DefaultStateType state = DefaultStateType ( nextState++ ); res.addState ( state ); @@ -216,7 +216,7 @@ DefaultStateType constructRecursivePattern ( const std::tree < common::ranked_sy std::vector < DefaultStateType > states; states.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); - for ( const std::tree < common::ranked_symbol < > > & child : node.getChildren ( ) ) + for ( const ext::tree < common::ranked_symbol < > > & child : node.getChildren ( ) ) states.push_back ( constructRecursivePattern ( child, res, subtreeWildcard, loopState, nextState ) ); DefaultStateType state = DefaultStateType ( nextState++ ); diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatch.h b/alib2algo/src/arbology/exact/ExactSubtreeMatch.h index 52f89f9d8a..308f4d9bf0 100644 --- a/alib2algo/src/arbology/exact/ExactSubtreeMatch.h +++ b/alib2algo/src/arbology/exact/ExactSubtreeMatch.h @@ -46,57 +46,57 @@ public: static std::set<unsigned> match(const tree::PrefixRankedBarTree < SymbolType, RankType > & subject, const tree::PrefixRankedBarTree < SymbolType, RankType > & pattern); private: template < class SymbolType > - static bool matchHelper(const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern); + static bool matchHelper(const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern); template < class SymbolType, class RankType > - static bool matchHelper(const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern); + static bool matchHelper(const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern); template < class SymbolType > - static void matchInternal(unsigned& index, std::set<unsigned>& occ, const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern); + static void matchInternal(unsigned& index, std::set<unsigned>& occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern); template < class SymbolType, class RankType > - static void matchInternal(unsigned& index, std::set<unsigned>& occ, const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern); + static void matchInternal(unsigned& index, std::set<unsigned>& occ, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern); }; template < class SymbolType > -bool ExactSubtreeMatch::matchHelper ( const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern ) { +bool ExactSubtreeMatch::matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern ) { if ( subject.getData ( ) != pattern.getData ( ) ) return false; if ( subject.getChildren ( ).size ( ) != pattern.getChildren ( ).size ( ) ) return false; - for ( const std::tuple < const std::tree < SymbolType >, const std::tree < SymbolType > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) + for ( const std::tuple < const ext::tree < SymbolType >, const ext::tree < SymbolType > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ) ) ) return false; return true; } template < class SymbolType, class RankType > -bool ExactSubtreeMatch::matchHelper ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) { +bool ExactSubtreeMatch::matchHelper ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) { if ( subject.getData ( ) != pattern.getData ( ) ) return false; // ranked symbols are the same; test for number of children is not needed - for ( const std::tuple < const std::tree < common::ranked_symbol < SymbolType, RankType > >, const std::tree < common::ranked_symbol < SymbolType, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) + for ( const std::tuple < const ext::tree < common::ranked_symbol < SymbolType, RankType > >, const ext::tree < common::ranked_symbol < SymbolType, RankType > > > & childs : std::make_tuple_foreach ( subject.getChildren ( ), pattern.getChildren ( ) ) ) if ( !matchHelper ( std::get < 0 > ( childs ), std::get < 1 > ( childs ) ) ) return false; return true; } template < class SymbolType > -void ExactSubtreeMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < SymbolType > & subject, const std::tree < SymbolType > & pattern ) { +void ExactSubtreeMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern ) { if ( matchHelper ( subject, pattern ) ) occ.insert ( index ); index++; - for ( const std::tree < SymbolType > & child : subject.getChildren ( ) ) + for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) matchInternal ( index, occ, child, pattern ); } template < class SymbolType, class RankType > -void ExactSubtreeMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const std::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) { +void ExactSubtreeMatch::matchInternal ( unsigned & index, std::set < unsigned > & occ, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & subject, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) { if ( matchHelper ( subject, pattern ) ) occ.insert ( index ); index++; - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : subject.getChildren ( ) ) + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : subject.getChildren ( ) ) matchInternal ( index, occ, child, pattern ); } diff --git a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp index 5d0ffb6da0..7d939372e0 100644 --- a/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp +++ b/alib2algo/src/arbology/exact/ExactSubtreeMatchingAutomaton.cpp @@ -84,12 +84,12 @@ automaton::InputDrivenNPDA < > ExactSubtreeMatchingAutomaton::construct ( const auto ExactSubtreeMatchingAutomatonPrefixRankedBarTree = registration::OverloadRegister < ExactSubtreeMatchingAutomaton, automaton::InputDrivenNPDA < >, tree::PrefixRankedBarTree < > > ( ExactSubtreeMatchingAutomaton::construct ); -DefaultStateType constructRecursive ( const std::tree < common::ranked_symbol < > > & node, automaton::NFTA < > & res, int & nextState ) { +DefaultStateType constructRecursive ( const ext::tree < common::ranked_symbol < > > & node, automaton::NFTA < > & res, int & nextState ) { std::vector < DefaultStateType > states; states.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); - for ( const std::tree < common::ranked_symbol < > > & child : node.getChildren ( ) ) + for ( const ext::tree < common::ranked_symbol < > > & child : node.getChildren ( ) ) states.push_back ( constructRecursive ( child, res, nextState ) ); DefaultStateType state = DefaultStateType ( nextState++ ); diff --git a/alib2algo/src/automaton/run/Run.h b/alib2algo/src/automaton/run/Run.h index 9bdd5842e3..1c96c999fb 100644 --- a/alib2algo/src/automaton/run/Run.h +++ b/alib2algo/src/automaton/run/Run.h @@ -36,9 +36,9 @@ namespace run { class Run { template < class SymbolType, class RankType, class StateType > - static std::pair < bool, StateType > calculateState ( const automaton::DFTA < SymbolType, RankType, StateType > & automaton, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ); + static std::pair < bool, StateType > calculateState ( const automaton::DFTA < SymbolType, RankType, StateType > & automaton, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ); template < class SymbolType, class RankType, class StateType > - static std::pair < bool, std::set < StateType > > calculateStates ( const automaton::NFTA < SymbolType, RankType, StateType > & automaton, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ); + static std::pair < bool, std::set < StateType > > calculateStates ( const automaton::NFTA < SymbolType, RankType, StateType > & automaton, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ); template < class SymbolType > static bool canPop ( const std::deque < SymbolType > & pushdownStore, const std::vector < SymbolType > & pop ); @@ -145,7 +145,7 @@ std::tuple < bool, std::set < StateType >, std::set < unsigned > > Run::calculat // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- template < class SymbolType, class RankType, class StateType > -std::pair < bool, StateType > Run::calculateState ( const automaton::DFTA < SymbolType, RankType, StateType > & automaton, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ) { +std::pair < bool, StateType > Run::calculateState ( const automaton::DFTA < SymbolType, RankType, StateType > & automaton, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ) { std::vector < StateType > states; states.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); @@ -155,7 +155,7 @@ std::pair < bool, StateType > Run::calculateState ( const automaton::DFTA < Symb bool sign = true; - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren ( ) ) { + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren ( ) ) { std::pair < bool, StateType > res = calculateState ( automaton, child, occ, i ); if ( res.first == false ) @@ -192,7 +192,7 @@ std::tuple < bool, StateType, std::set < unsigned > > Run::calculateState ( cons // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- template < class SymbolType, class RankType, class StateType > -std::pair < bool, std::set < StateType > > Run::calculateStates ( const automaton::NFTA < SymbolType, RankType, StateType > & automaton, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ) { +std::pair < bool, std::set < StateType > > Run::calculateStates ( const automaton::NFTA < SymbolType, RankType, StateType > & automaton, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::set < unsigned > & occ, unsigned & i ) { std::vector < std::set < StateType > > resStates; resStates.reserve ( ( size_t ) node.getData ( ).getRank ( ) ); @@ -202,7 +202,7 @@ std::pair < bool, std::set < StateType > > Run::calculateStates ( const automato bool sign = true; - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren ( ) ) { + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren ( ) ) { std::pair < bool, std::set < StateType > > childStates = calculateStates ( automaton, child, occ, i ); if ( childStates.second.empty ( ) ) diff --git a/alib2algo/src/stringology/indexing/PositionHeapNaive.h b/alib2algo/src/stringology/indexing/PositionHeapNaive.h index 0a75ea655b..98eb5416f6 100644 --- a/alib2algo/src/stringology/indexing/PositionHeapNaive.h +++ b/alib2algo/src/stringology/indexing/PositionHeapNaive.h @@ -44,17 +44,17 @@ indexes::stringology::PositionHeap < SymbolType > PositionHeapNaive::construct ( if ( w.getContent ( ).size ( ) == 0 ) throw exception::CommonException ( "Position heap can't index empty string" ); - std::trie < SymbolType, unsigned > trie ( 1 ); + ext::trie < SymbolType, unsigned > trie ( 1 ); for ( unsigned i = w.getContent ( ).size ( ) - 1; i > 0; i-- ) { unsigned k = i - 1; - std::trie < SymbolType, unsigned > * n = & trie; + ext::trie < SymbolType, unsigned > * n = & trie; while ( n->getChildren ( ).count ( w.getContent ( )[k] ) ) n = & n->getChildren ( ).find ( w.getContent ( )[k++] )->second; unsigned node = w.getContent ( ).size ( ) - i + 1; - n = & n->getChildren ( ).insert ( std::make_pair ( w.getContent ( )[k], std::trie < SymbolType, unsigned > ( node ) ) ).first->second; + n = & n->getChildren ( ).insert ( std::make_pair ( w.getContent ( )[k], ext::trie < SymbolType, unsigned > ( node ) ) ).first->second; } return indexes::stringology::PositionHeap < SymbolType > ( w.getAlphabet ( ), trie, w.getContent ( ) ); diff --git a/alib2algo/src/stringology/indexing/SuffixTrieNaive.h b/alib2algo/src/stringology/indexing/SuffixTrieNaive.h index 003379d461..4096ea477a 100644 --- a/alib2algo/src/stringology/indexing/SuffixTrieNaive.h +++ b/alib2algo/src/stringology/indexing/SuffixTrieNaive.h @@ -39,11 +39,11 @@ public: template < class SymbolType > indexes::stringology::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( const string::LinearString < SymbolType > & w ) { - std::trie < SymbolType, ext::variant < void, unsigned > > trie ( ext::variant < void, unsigned > ( ( unsigned ) w.getContent ( ).size ( ) ) ); + ext::trie < SymbolType, ext::variant < void, unsigned > > trie ( ext::variant < void, unsigned > ( ( unsigned ) w.getContent ( ).size ( ) ) ); for ( unsigned i = w.getContent ( ).size ( ); i > 0; i-- ) { unsigned k = i - 1; - std::trie < SymbolType, ext::variant < void, unsigned > > * n = & trie; + ext::trie < SymbolType, ext::variant < void, unsigned > > * n = & trie; // inlined slow_find_one from MI-EVY lectures while ( n->getChildren ( ).count ( w.getContent ( )[k] ) ) @@ -51,7 +51,7 @@ indexes::stringology::SuffixTrie < SymbolType > SuffixTrieNaive::construct ( con for ( ; k < w.getContent ( ).size ( ); k++ ) { ext::variant < void, unsigned > node = k + 1 < w.getContent ( ).size ( ) ? ext::variant < void, unsigned >::from < void > ( ) : ext::variant < void, unsigned > ( i - 1 ); - n = & n->getChildren ( ).insert ( std::make_pair ( w.getContent ( )[k], std::trie < SymbolType, ext::variant < void, unsigned > > ( node ) ) ).first->second; + n = & n->getChildren ( ).insert ( std::make_pair ( w.getContent ( )[k], ext::trie < SymbolType, ext::variant < void, unsigned > > ( node ) ) ).first->second; } } diff --git a/alib2algo/src/stringology/query/PositionHeapFactors.h b/alib2algo/src/stringology/query/PositionHeapFactors.h index 88c9028203..b4a6d1ab9a 100644 --- a/alib2algo/src/stringology/query/PositionHeapFactors.h +++ b/alib2algo/src/stringology/query/PositionHeapFactors.h @@ -28,10 +28,10 @@ namespace query { class PositionHeapFactors : public alib::SingleDispatchFirstStaticParam < PositionHeapFactors, std::set < unsigned >, const indexes::stringology::PositionHeap < DefaultSymbolType > &, const string::StringBase & > { template < class SymbolType > - static void accumulateResult ( const std::trie < SymbolType, unsigned > & trie, std::set < unsigned > & res, unsigned indexedStringSize ) { + static void accumulateResult ( const ext::trie < SymbolType, unsigned > & trie, std::set < unsigned > & res, unsigned indexedStringSize ) { res.insert ( indexedStringSize - trie.getData ( ) ); - for ( const std::pair < SymbolType, std::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { + for ( const std::pair < SymbolType, ext::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { accumulateResult ( child.second, res, indexedStringSize ); } } @@ -66,7 +66,7 @@ template < class SymbolType > std::set < unsigned > PositionHeapFactors::query ( const indexes::stringology::PositionHeap < SymbolType > & positionHeap, const string::LinearString < SymbolType > & string ) { std::set < unsigned > res; - const std::trie < SymbolType, unsigned > * node = & positionHeap.getRoot ( ); + const ext::trie < SymbolType, unsigned > * node = & positionHeap.getRoot ( ); unsigned depth = 0; unsigned indexedStringSize = positionHeap.getString ( ).size ( ); diff --git a/alib2algo/src/stringology/query/SuffixTrieFactors.h b/alib2algo/src/stringology/query/SuffixTrieFactors.h index b9e8bb15a9..893d93153e 100644 --- a/alib2algo/src/stringology/query/SuffixTrieFactors.h +++ b/alib2algo/src/stringology/query/SuffixTrieFactors.h @@ -25,11 +25,11 @@ namespace query { class SuffixTrieFactors : public alib::SingleDispatchFirstStaticParam < SuffixTrieFactors, std::set < unsigned >, const indexes::stringology::SuffixTrie < DefaultSymbolType > &, const string::StringBase & > { template < class SymbolType > - static void accumulateResult ( const std::trie < SymbolType, ext::variant < void, unsigned > > & trie, std::set < unsigned > & res ) { + static void accumulateResult ( const ext::trie < SymbolType, ext::variant < void, unsigned > > & trie, std::set < unsigned > & res ) { if ( trie.getData ( ).template is < unsigned > ( ) ) res.insert ( trie.getData ( ).template get < unsigned > ( ) ); - for ( const std::pair < SymbolType, std::trie < SymbolType, ext::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { + for ( const std::pair < SymbolType, ext::trie < SymbolType, ext::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { accumulateResult ( child.second, res ); } } @@ -50,7 +50,7 @@ public: template < class SymbolType > std::set < unsigned > SuffixTrieFactors::query ( const indexes::stringology::SuffixTrie < SymbolType > & suffixTrie, const string::LinearString < SymbolType > & string ) { - const std::trie < SymbolType, ext::variant < void, unsigned > > * node = & suffixTrie.getRoot ( ); + const ext::trie < SymbolType, ext::variant < void, unsigned > > * node = & suffixTrie.getRoot ( ); for ( const SymbolType & symbol : string.getContent ( ) ) { auto iter = node->getChildren ( ).find ( symbol ); if ( iter == node->getChildren ( ).end ( ) ) { diff --git a/alib2algo/src/tree/NormalizeTreeLabels.h b/alib2algo/src/tree/NormalizeTreeLabels.h index 28cea081f0..85d7eb245b 100644 --- a/alib2algo/src/tree/NormalizeTreeLabels.h +++ b/alib2algo/src/tree/NormalizeTreeLabels.h @@ -30,7 +30,7 @@ namespace tree { */ class NormalizeTreeLabels : public alib::SingleDispatch < NormalizeTreeLabels, tree::Tree, const tree::TreeBase & > { template < class SymbolType, class RankType > - static std::tree < common::ranked_symbol < unsigned, RankType > > normalize ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & mapping, unsigned & counter ); + static ext::tree < common::ranked_symbol < unsigned, RankType > > normalize ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & mapping, unsigned & counter ); public: /** @@ -49,11 +49,11 @@ public: }; template < class SymbolType, class RankType > -std::tree < common::ranked_symbol < unsigned, RankType > > NormalizeTreeLabels::normalize ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & mapping, unsigned & counter ) { +ext::tree < common::ranked_symbol < unsigned, RankType > > NormalizeTreeLabels::normalize ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree, std::map < common::ranked_symbol < SymbolType, RankType >, unsigned > & mapping, unsigned & counter ) { - std::vector < std::tree < common::ranked_symbol < unsigned, RankType > > > children; + std::vector < ext::tree < common::ranked_symbol < unsigned, RankType > > > children; - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : tree ) + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : tree ) children.push_back ( normalize < SymbolType, RankType > ( child, mapping, counter ) ); auto newLabelIt = mapping.find ( tree.getData ( ) ); @@ -67,7 +67,7 @@ std::tree < common::ranked_symbol < unsigned, RankType > > NormalizeTreeLabels:: newLabel = newLabelIt->second; } - return std::tree < common::ranked_symbol < unsigned, RankType > > ( common::ranked_symbol < unsigned, RankType > ( newLabel, tree.getData ( ).getRank ( ) ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < unsigned, RankType > > ( common::ranked_symbol < unsigned, RankType > ( newLabel, tree.getData ( ).getRank ( ) ), std::move ( children ) ); } diff --git a/alib2algo/src/tree/generate/RandomTreeFactory.cpp b/alib2algo/src/tree/generate/RandomTreeFactory.cpp index a6fe0490f5..e5958872b1 100644 --- a/alib2algo/src/tree/generate/RandomTreeFactory.cpp +++ b/alib2algo/src/tree/generate/RandomTreeFactory.cpp @@ -105,78 +105,78 @@ struct Node { } } - std::tree < DefaultSymbolType > createUnrankedNode ( ) { - std::vector < std::tree < DefaultSymbolType > > children; + ext::tree < DefaultSymbolType > createUnrankedNode ( ) { + std::vector < ext::tree < DefaultSymbolType > > children; Node * nextChild = child; for ( int i = 0; i < rank; i++ ) { - children.emplace_back ( std::tree < DefaultSymbolType > ( nextChild->createUnrankedNode ( ) ) ); + children.emplace_back ( ext::tree < DefaultSymbolType > ( nextChild->createUnrankedNode ( ) ) ); nextChild = nextChild->right; } - return std::tree < DefaultSymbolType > ( DefaultSymbolType ( symbol ), std::move ( children ) ); + return ext::tree < DefaultSymbolType > ( DefaultSymbolType ( symbol ), std::move ( children ) ); } - std::tree < DefaultSymbolType > createUnrankedPatternNode ( ) { + ext::tree < DefaultSymbolType > createUnrankedPatternNode ( ) { if ( rank == 0 ) { - return std::tree < DefaultSymbolType > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), { } ); + return ext::tree < DefaultSymbolType > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), { } ); } else { - std::vector < std::tree < DefaultSymbolType > > children; + std::vector < ext::tree < DefaultSymbolType > > children; Node * nextChild = child; for ( int i = 0; i < rank; i++ ) { - children.emplace_back ( std::tree < DefaultSymbolType > ( nextChild->createUnrankedPatternNode ( ) ) ); + children.emplace_back ( ext::tree < DefaultSymbolType > ( nextChild->createUnrankedPatternNode ( ) ) ); nextChild = nextChild->right; } - return std::tree < DefaultSymbolType > ( DefaultSymbolType ( symbol ), std::move ( children ) ); + return ext::tree < DefaultSymbolType > ( DefaultSymbolType ( symbol ), std::move ( children ) ); } } - std::tree < common::ranked_symbol < > > createRankedNode ( ) { - std::vector < std::tree < common::ranked_symbol < > > > children; + ext::tree < common::ranked_symbol < > > createRankedNode ( ) { + std::vector < ext::tree < common::ranked_symbol < > > > children; Node * nextChild = child; for ( int i = 0; i < rank; i++ ) { - children.emplace_back ( std::tree < common::ranked_symbol < > > ( nextChild->createRankedNode ( ) ) ); + children.emplace_back ( ext::tree < common::ranked_symbol < > > ( nextChild->createRankedNode ( ) ) ); nextChild = nextChild->right; } - return std::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( symbol, rank ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( symbol, rank ), std::move ( children ) ); } - std::tree < common::ranked_symbol < > > createRankedPatternNode ( ) { + ext::tree < common::ranked_symbol < > > createRankedPatternNode ( ) { if ( rank == 0 ) { - return std::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), 0 ), { } ); + return ext::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), 0 ), { } ); } else { - std::vector < std::tree < common::ranked_symbol < > > > children; + std::vector < ext::tree < common::ranked_symbol < > > > children; Node * nextChild = child; for ( int i = 0; i < rank; i++ ) { - children.emplace_back ( std::tree < common::ranked_symbol < > > ( nextChild->createRankedPatternNode ( ) ) ); + children.emplace_back ( ext::tree < common::ranked_symbol < > > ( nextChild->createRankedPatternNode ( ) ) ); nextChild = nextChild->right; } - return std::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( symbol, rank ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( symbol, rank ), std::move ( children ) ); } } - std::tree < common::ranked_symbol < > > createRankedNonlinearPatternNode ( bool singleNonlinearVariable ) { + ext::tree < common::ranked_symbol < > > createRankedNonlinearPatternNode ( bool singleNonlinearVariable ) { if ( rank == 0 ) { if ( singleNonlinearVariable ) - return std::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( DefaultSymbolType ( alphabet::NonlinearVariableSymbol < > ( DefaultSymbolType ( "A" ) ) ), 0 ), { } ); + return ext::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( DefaultSymbolType ( alphabet::NonlinearVariableSymbol < > ( DefaultSymbolType ( "A" ) ) ), 0 ), { } ); else - return std::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( DefaultSymbolType ( alphabet::NonlinearVariableSymbol < > ( symbol ) ), 0 ), { } ); + return ext::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( DefaultSymbolType ( alphabet::NonlinearVariableSymbol < > ( symbol ) ), 0 ), { } ); } else { - std::vector < std::tree < common::ranked_symbol < > > > children; + std::vector < ext::tree < common::ranked_symbol < > > > children; Node * nextChild = child; for ( int i = 0; i < rank; i++ ) { - children.emplace_back ( std::tree < common::ranked_symbol < > > ( nextChild->createRankedNonlinearPatternNode ( singleNonlinearVariable ) ) ); + children.emplace_back ( ext::tree < common::ranked_symbol < > > ( nextChild->createRankedNonlinearPatternNode ( singleNonlinearVariable ) ) ); nextChild = nextChild->right; } - return std::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( symbol, rank ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < > > ( common::ranked_symbol < > ( symbol, rank ), std::move ( children ) ); } } diff --git a/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h b/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h index 6339009b33..dd12479d98 100644 --- a/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h +++ b/alib2algo/src/tree/properties/ExactSubtreeRepeatsNaive.h @@ -35,7 +35,7 @@ namespace properties { */ class ExactSubtreeRepeatsNaive : public alib::SingleDispatch < ExactSubtreeRepeatsNaive, tree::Tree, const tree::TreeBase & > { template < class SymbolType, class RankType > - static std::tree < common::ranked_symbol < unsigned, RankType > > repeats ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::map < std::pair < common::ranked_symbol < SymbolType, RankType >, std::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId ); + static ext::tree < common::ranked_symbol < unsigned, RankType > > repeats ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::map < std::pair < common::ranked_symbol < SymbolType, RankType >, std::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId ); template < class SymbolType, class RankType > static common::ranked_symbol < unsigned, RankType > repeatsPrefixRanked ( const std::vector < common::ranked_symbol < SymbolType, RankType > > & symbols, std::vector < common::ranked_symbol < unsigned, RankType > > & res, std::map < std::pair < common::ranked_symbol < SymbolType, RankType >, std::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId, int & index ); template < class SymbolType, class RankType > @@ -66,11 +66,11 @@ public: }; template < class SymbolType, class RankType > -std::tree < common::ranked_symbol < unsigned, RankType > > ExactSubtreeRepeatsNaive::repeats ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::map < std::pair < common::ranked_symbol < SymbolType, RankType >, std::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId ) { - std::vector < std::tree < common::ranked_symbol < unsigned, RankType > > > children; +ext::tree < common::ranked_symbol < unsigned, RankType > > ExactSubtreeRepeatsNaive::repeats ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, std::map < std::pair < common::ranked_symbol < SymbolType, RankType >, std::vector < common::ranked_symbol < unsigned, RankType > > >, unsigned > & data, unsigned & minId ) { + std::vector < ext::tree < common::ranked_symbol < unsigned, RankType > > > children; std::pair < common::ranked_symbol < SymbolType, RankType >, std::vector < common::ranked_symbol < unsigned, RankType > > > childRepeatsKey ( node.getData ( ), std::vector < common::ranked_symbol < unsigned, RankType > > ( ) ); - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren() ) { + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren() ) { children.push_back ( repeats ( child, data, minId ) ); childRepeatsKey.second.push_back ( children.back ( ).getData ( ) ); } @@ -79,7 +79,7 @@ std::tree < common::ranked_symbol < unsigned, RankType > > ExactSubtreeRepeatsNa if ( uniqueRepeatId == 0 ) uniqueRepeatId = minId++; - return std::tree < common::ranked_symbol < unsigned, RankType > > ( common::ranked_symbol < unsigned, RankType > ( uniqueRepeatId, node.getData ( ).getRank ( ) ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < unsigned, RankType > > ( common::ranked_symbol < unsigned, RankType > ( uniqueRepeatId, node.getData ( ).getRank ( ) ), std::move ( children ) ); } template < class SymbolType, class RankType > diff --git a/alib2common/src/container/ObjectsTree.h b/alib2common/src/container/ObjectsTree.h index 5869d3a9fd..af308a5d07 100644 --- a/alib2common/src/container/ObjectsTree.h +++ b/alib2common/src/container/ObjectsTree.h @@ -26,9 +26,9 @@ namespace container { * Contains reason why the container occured. */ template < class ElementType > -class ObjectsTree final : public std::tree < ElementType >, public ContainerBase { +class ObjectsTree final : public ext::tree < ElementType >, public ContainerBase { public: - explicit ObjectsTree ( std::tree < ElementType > ); + explicit ObjectsTree ( ext::tree < ElementType > ); virtual ContainerBase * clone ( ) const; @@ -53,21 +53,21 @@ public: } static ObjectsTree parse ( std::deque < sax::Token >::iterator & input ); - static std::tree < ElementType > parseRaw ( std::deque < sax::Token >::iterator & input ); + static ext::tree < ElementType > parseRaw ( std::deque < sax::Token >::iterator & input ); void compose ( std::deque < sax::Token > & out ) const; - static void compose ( std::deque < sax::Token > & out, const std::tree < ElementType > & input ); + static void compose ( std::deque < sax::Token > & out, const ext::tree < ElementType > & input ); virtual alib::ObjectBase * inc ( ) &&; - std::tree < alib::Object > normalizeRaw ( std::tree < ElementType > && node ) { - std::vector < std::tree < alib::Object > > children; + ext::tree < alib::Object > normalizeRaw ( ext::tree < ElementType > && node ) { + std::vector < ext::tree < alib::Object > > children; - for ( std::tree < ElementType > & child : node.getChildren ( ) ) { + for ( ext::tree < ElementType > & child : node.getChildren ( ) ) { children.push_back ( normalizeRaw ( std::move ( child ) ) ); } - return std::tree < alib::Object > ( alib::Object ( alib::AnyObject < ElementType > ( std::move ( node.getData ( ) ) ) ), std::move ( children ) ); + return ext::tree < alib::Object > ( alib::Object ( alib::AnyObject < ElementType > ( std::move ( node.getData ( ) ) ) ), std::move ( children ) ); } typedef ObjectsTree < > normalized_type; @@ -78,7 +78,7 @@ public: }; template < class ElementType > -ObjectsTree < ElementType >::ObjectsTree ( std::tree < ElementType > raw ) : std::tree < ElementType > ( std::move ( raw ) ) { +ObjectsTree < ElementType >::ObjectsTree ( ext::tree < ElementType > raw ) : ext::tree < ElementType > ( std::move ( raw ) ) { } template < class ElementType > @@ -93,14 +93,14 @@ ContainerBase * ObjectsTree < ElementType >::plunder ( ) && { template < class ElementType > int ObjectsTree < ElementType >::compare ( const ObjectsTree & other ) const { - static ext::compare < std::tree < ElementType > > comp; + static ext::compare < ext::tree < ElementType > > comp; - return comp ( static_cast < const std::tree < ElementType > & > ( * this ), static_cast < const std::tree < ElementType > & > ( other ) ); + return comp ( static_cast < const ext::tree < ElementType > & > ( * this ), static_cast < const ext::tree < ElementType > & > ( other ) ); } template < class ElementType > void ObjectsTree < ElementType >::operator >>( std::ostream & os ) const { - os << "(ObjectsTree " << static_cast < const std::tree < ElementType > & > ( * this ) << ")"; + os << "(ObjectsTree " << static_cast < const ext::tree < ElementType > & > ( * this ) << ")"; } template < class ElementType > @@ -121,13 +121,13 @@ void ObjectsTree < ElementType >::compose ( std::deque < sax::Token > & out ) co } template < class ElementType > -std::tree < ElementType > ObjectsTree < ElementType >::parseRaw ( std::deque < sax::Token >::iterator & input ) { +ext::tree < ElementType > ObjectsTree < ElementType >::parseRaw ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, ObjectsTree < >::getXmlTagName ( ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "Root" ); - std::tree < ElementType > tree ( alib::xmlApi < ElementType >::parse ( input ) ); + ext::tree < ElementType > tree ( alib::xmlApi < ElementType >::parse ( input ) ); - typename std::tree < ElementType >::const_children_iterator under = tree.root ( ); + typename ext::tree < ElementType >::const_children_iterator under = tree.root ( ); unsigned level = 0; @@ -157,13 +157,13 @@ std::tree < ElementType > ObjectsTree < ElementType >::parseRaw ( std::deque < s } template < class ElementType > -void ObjectsTree < ElementType >::compose ( std::deque < sax::Token > & out, const std::tree < ElementType > & input ) { +void ObjectsTree < ElementType >::compose ( std::deque < sax::Token > & out, const ext::tree < ElementType > & input ) { out.emplace_back ( ObjectsTree < >::getXmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); out.emplace_back ( "Root", sax::Token::TokenType::START_ELEMENT ); unsigned level = 0; - for ( typename std::tree < ElementType >::const_prefix_iterator iter = input.prefix_begin ( ); iter != input.prefix_end ( ); ) { + for ( typename ext::tree < ElementType >::const_prefix_iterator iter = input.prefix_begin ( ); iter != input.prefix_end ( ); ) { while ( iter.getLevel ( ) > level ) { out.emplace_back ( "Children", sax::Token::TokenType::START_ELEMENT ); ++level; @@ -192,30 +192,30 @@ alib::ObjectBase* ObjectsTree < ElementType >::inc() && { namespace alib { template < typename T > -struct xmlApi < std::tree < T > > { - static std::tree < T > parse ( std::deque < sax::Token >::iterator & input ); +struct xmlApi < ext::tree < T > > { + static ext::tree < T > parse ( std::deque < sax::Token >::iterator & input ); static bool first ( const std::deque < sax::Token >::const_iterator & input ); static std::string xmlTagName ( ); - static void compose ( std::deque < sax::Token > & output, const std::tree < T > & data ); + static void compose ( std::deque < sax::Token > & output, const ext::tree < T > & data ); }; template < typename T > -std::tree < T > xmlApi < std::tree < T > >::parse ( std::deque < sax::Token >::iterator & input ) { +ext::tree < T > xmlApi < ext::tree < T > >::parse ( std::deque < sax::Token >::iterator & input ) { return container::ObjectsTree < T >::parseRaw ( input ); } template < typename T > -bool xmlApi < std::tree < T > >::first ( const std::deque < sax::Token >::const_iterator & input ) { +bool xmlApi < ext::tree < T > >::first ( const std::deque < sax::Token >::const_iterator & input ) { return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); } template < typename T > -std::string xmlApi < std::tree < T > >::xmlTagName ( ) { +std::string xmlApi < ext::tree < T > >::xmlTagName ( ) { return container::ObjectsTree < >::getXmlTagName ( ); } template < typename T > -void xmlApi < std::tree < T > >::compose ( std::deque < sax::Token > & output, const std::tree < T > & input ) { +void xmlApi < ext::tree < T > >::compose ( std::deque < sax::Token > & output, const ext::tree < T > & input ) { return container::ObjectsTree < T >::compose ( output, input ); } diff --git a/alib2common/src/container/ObjectsTrie.h b/alib2common/src/container/ObjectsTrie.h index 6eaa7f15fe..ccf87c4b3e 100644 --- a/alib2common/src/container/ObjectsTrie.h +++ b/alib2common/src/container/ObjectsTrie.h @@ -26,9 +26,9 @@ namespace container { * Contains reason why the container occured. */ template < class KeyType, class ValueType > -class ObjectsTrie final : public std::trie < KeyType, ValueType >, public ContainerBase { +class ObjectsTrie final : public ext::trie < KeyType, ValueType >, public ContainerBase { public: - explicit ObjectsTrie ( std::trie < KeyType, ValueType > ); + explicit ObjectsTrie ( ext::trie < KeyType, ValueType > ); virtual ContainerBase * clone ( ) const; @@ -53,23 +53,23 @@ public: } static ObjectsTrie parse ( std::deque < sax::Token >::iterator & input ); - static std::map < KeyType, std::trie < KeyType, ValueType > > parseChildren ( std::deque < sax::Token >::iterator & input ); - static std::trie < KeyType, ValueType > parseRaw ( std::deque < sax::Token >::iterator & input ); + static std::map < KeyType, ext::trie < KeyType, ValueType > > parseChildren ( std::deque < sax::Token >::iterator & input ); + static ext::trie < KeyType, ValueType > parseRaw ( std::deque < sax::Token >::iterator & input ); void compose ( std::deque < sax::Token > & out ) const; - static void composeChildren ( std::deque < sax::Token > & out, const std::map < KeyType, std::trie < KeyType, ValueType > > & children ); - static void compose ( std::deque < sax::Token > & out, const std::trie < KeyType, ValueType > & input ); + static void composeChildren ( std::deque < sax::Token > & out, const std::map < KeyType, ext::trie < KeyType, ValueType > > & children ); + static void compose ( std::deque < sax::Token > & out, const ext::trie < KeyType, ValueType > & input ); virtual alib::ObjectBase * inc ( ) &&; - std::trie < alib::Object, alib::Object > normalizeRaw ( std::trie < KeyType, ValueType > && node ) { - std::map < alib::Object, std::trie < alib::Object, alib::Object > > children; + ext::trie < alib::Object, alib::Object > normalizeRaw ( ext::trie < KeyType, ValueType > && node ) { + std::map < alib::Object, ext::trie < alib::Object, alib::Object > > children; - for ( std::pair < KeyType, std::trie < KeyType, ValueType > > && child : std::make_moveable_map ( node.getChildren ( ) ) ) { + for ( std::pair < KeyType, ext::trie < KeyType, ValueType > > && child : std::make_moveable_map ( node.getChildren ( ) ) ) { children.insert ( std::make_pair ( alib::Object ( alib::AnyObject < KeyType > ( std::move ( child.first ) ) ), normalizeRaw ( std::move ( child.second ) ) ) ); } - return std::trie < alib::Object, alib::Object > ( alib::Object ( alib::AnyObject < ValueType > ( std::move ( node.getData ( ) ) ) ), std::move ( children ) ); + return ext::trie < alib::Object, alib::Object > ( alib::Object ( alib::AnyObject < ValueType > ( std::move ( node.getData ( ) ) ) ), std::move ( children ) ); } typedef ObjectsTrie < > normalized_type; @@ -80,7 +80,7 @@ public: }; template < class KeyType, class ValueType > -ObjectsTrie < KeyType, ValueType >::ObjectsTrie ( std::trie < KeyType, ValueType > raw ) : std::trie < KeyType, ValueType > ( std::move ( raw ) ) { +ObjectsTrie < KeyType, ValueType >::ObjectsTrie ( ext::trie < KeyType, ValueType > raw ) : ext::trie < KeyType, ValueType > ( std::move ( raw ) ) { } template < class KeyType, class ValueType > @@ -95,14 +95,14 @@ ContainerBase * ObjectsTrie < KeyType, ValueType >::plunder ( ) && { template < class KeyType, class ValueType > int ObjectsTrie < KeyType, ValueType >::compare ( const ObjectsTrie & other ) const { - static ext::compare < std::trie < KeyType, ValueType > > comp; + static ext::compare < ext::trie < KeyType, ValueType > > comp; - return comp ( static_cast < const std::trie < KeyType, ValueType > & > ( * this ), static_cast < const std::trie < KeyType, ValueType > & > ( other ) ); + return comp ( static_cast < const ext::trie < KeyType, ValueType > & > ( * this ), static_cast < const ext::trie < KeyType, ValueType > & > ( other ) ); } template < class KeyType, class ValueType > void ObjectsTrie < KeyType, ValueType >::operator >>( std::ostream & os ) const { - os << "(ObjectsTrie " << static_cast < const std::trie < KeyType, ValueType > & > ( * this ) << ")"; + os << "(ObjectsTrie " << static_cast < const ext::trie < KeyType, ValueType > & > ( * this ) << ")"; } template < class KeyType, class ValueType > @@ -123,17 +123,17 @@ void ObjectsTrie < KeyType, ValueType >::compose ( std::deque < sax::Token > & o } template < class KeyType, class ValueType > -std::map < KeyType, std::trie < KeyType, ValueType > > ObjectsTrie < KeyType, ValueType >::parseChildren ( std::deque < sax::Token >::iterator & input ) { - std::map < KeyType, std::trie < KeyType, ValueType > > children; +std::map < KeyType, ext::trie < KeyType, ValueType > > ObjectsTrie < KeyType, ValueType >::parseChildren ( std::deque < sax::Token >::iterator & input ) { + std::map < KeyType, ext::trie < KeyType, ValueType > > children; while ( sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, "Child" ) ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "Child" ); KeyType key = alib::xmlApi < KeyType >::parse ( input ); ValueType value = alib::xmlApi < ValueType >::parse ( input ); - std::map < KeyType, std::trie < KeyType, ValueType > > innerChildren = parseChildren ( input ); + std::map < KeyType, ext::trie < KeyType, ValueType > > innerChildren = parseChildren ( input ); - children.insert ( std::make_pair ( std::move ( key ), std::trie < KeyType, ValueType > ( std::move ( value ), std::move ( innerChildren ) ) ) ); + children.insert ( std::make_pair ( std::move ( key ), ext::trie < KeyType, ValueType > ( std::move ( value ), std::move ( innerChildren ) ) ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, "Child" ); } @@ -142,20 +142,20 @@ std::map < KeyType, std::trie < KeyType, ValueType > > ObjectsTrie < KeyType, Va } template < class KeyType, class ValueType > -std::trie < KeyType, ValueType > ObjectsTrie < KeyType, ValueType >::parseRaw ( std::deque < sax::Token >::iterator & input ) { +ext::trie < KeyType, ValueType > ObjectsTrie < KeyType, ValueType >::parseRaw ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, ObjectsTrie < >::getXmlTagName ( ) ); ValueType value = alib::xmlApi < ValueType >::parse ( input ); - std::map < KeyType, std::trie < KeyType, ValueType > > children = parseChildren ( input ); + std::map < KeyType, ext::trie < KeyType, ValueType > > children = parseChildren ( input ); - std::trie < KeyType, ValueType > trie ( std::move ( value ), std::move ( children ) ); + ext::trie < KeyType, ValueType > trie ( std::move ( value ), std::move ( children ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, ObjectsTrie < >::getXmlTagName ( ) ); return trie; } template < class KeyType, class ValueType > -void ObjectsTrie < KeyType, ValueType >::composeChildren ( std::deque < sax::Token > & out, const std::map < KeyType, std::trie < KeyType, ValueType > > & children ) { - for ( const std::pair < const KeyType, std::trie < KeyType, ValueType > > & child : children ) { +void ObjectsTrie < KeyType, ValueType >::composeChildren ( std::deque < sax::Token > & out, const std::map < KeyType, ext::trie < KeyType, ValueType > > & children ) { + for ( const std::pair < const KeyType, ext::trie < KeyType, ValueType > > & child : children ) { out.emplace_back ( "Child", sax::Token::TokenType::START_ELEMENT ); alib::xmlApi < KeyType >::compose ( out, child.first ); @@ -167,7 +167,7 @@ void ObjectsTrie < KeyType, ValueType >::composeChildren ( std::deque < sax::Tok } template < class KeyType, class ValueType > -void ObjectsTrie < KeyType, ValueType >::compose ( std::deque < sax::Token > & out, const std::trie < KeyType, ValueType > & input ) { +void ObjectsTrie < KeyType, ValueType >::compose ( std::deque < sax::Token > & out, const ext::trie < KeyType, ValueType > & input ) { out.emplace_back ( ObjectsTrie < >::getXmlTagName ( ), sax::Token::TokenType::START_ELEMENT ); alib::xmlApi < ValueType >::compose ( out, input.getData ( ) ); composeChildren ( out, input.getChildren ( ) ); @@ -184,30 +184,30 @@ alib::ObjectBase* ObjectsTrie < KeyType, ValueType >::inc() && { namespace alib { template < typename T, typename R > -struct xmlApi < std::trie < T, R > > { - static std::trie < T, R > parse ( std::deque < sax::Token >::iterator & input ); +struct xmlApi < ext::trie < T, R > > { + static ext::trie < T, R > parse ( std::deque < sax::Token >::iterator & input ); static bool first ( const std::deque < sax::Token >::const_iterator & input ); static std::string xmlTagName ( ); - static void compose ( std::deque < sax::Token > & output, const std::trie < T, R > & data ); + static void compose ( std::deque < sax::Token > & output, const ext::trie < T, R > & data ); }; template < typename T, typename R > -std::trie < T, R > xmlApi < std::trie < T, R > >::parse ( std::deque < sax::Token >::iterator & input ) { +ext::trie < T, R > xmlApi < ext::trie < T, R > >::parse ( std::deque < sax::Token >::iterator & input ) { return container::ObjectsTrie < T, R >::parseRaw ( input ); } template < typename T, typename R > -bool xmlApi < std::trie < T, R > >::first ( const std::deque < sax::Token >::const_iterator & input ) { +bool xmlApi < ext::trie < T, R > >::first ( const std::deque < sax::Token >::const_iterator & input ) { return sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, xmlTagName ( ) ); } template < typename T, typename R > -std::string xmlApi < std::trie < T, R > >::xmlTagName ( ) { +std::string xmlApi < ext::trie < T, R > >::xmlTagName ( ) { return container::ObjectsTrie < >::getXmlTagName ( ); } template < typename T, typename R > -void xmlApi < std::trie < T, R > >::compose ( std::deque < sax::Token > & output, const std::trie < T, R > & input ) { +void xmlApi < ext::trie < T, R > >::compose ( std::deque < sax::Token > & output, const ext::trie < T, R > & input ) { return container::ObjectsTrie < T, R >::compose ( output, input ); } diff --git a/alib2common/test-src/container/ContainerTest.cpp b/alib2common/test-src/container/ContainerTest.cpp index 25a0cf3cc7..e36c9c0152 100644 --- a/alib2common/test-src/container/ContainerTest.cpp +++ b/alib2common/test-src/container/ContainerTest.cpp @@ -73,32 +73,32 @@ void ContainerTest::testVariantParsing ( ) { void ContainerTest::testTreeParsing ( ) { { - std::tree < int > t ( 1 ); + ext::tree < int > t ( 1 ); std::string string = alib::XmlDataFactory::toString ( t ); std::cout << string << std::endl; - std::tree < int > t2 = alib::XmlDataFactory::fromString ( string ); + ext::tree < int > t2 = alib::XmlDataFactory::fromString ( string ); CPPUNIT_ASSERT ( t == t2 ); } { - std::tree < int > t ( 1, std::tree < int > ( 2 ), std::tree < int > ( 4 ) ); + ext::tree < int > t ( 1, ext::tree < int > ( 2 ), ext::tree < int > ( 4 ) ); std::string string = alib::XmlDataFactory::toString ( t ); std::cout << string << std::endl; - std::tree < int > t2 = alib::XmlDataFactory::fromString ( string ); + ext::tree < int > t2 = alib::XmlDataFactory::fromString ( string ); CPPUNIT_ASSERT ( t == t2 ); } { - std::tree < int > t ( 1, std::tree < int > ( 2, std::tree < int > ( 3 ) ), std::tree < int > ( 4 ) ); + ext::tree < int > t ( 1, ext::tree < int > ( 2, ext::tree < int > ( 3 ) ), ext::tree < int > ( 4 ) ); std::string string = alib::XmlDataFactory::toString ( t ); std::cout << string << std::endl; - std::tree < int > t2 = alib::XmlDataFactory::fromString ( string ); + ext::tree < int > t2 = alib::XmlDataFactory::fromString ( string ); CPPUNIT_ASSERT ( t == t2 ); } @@ -106,32 +106,32 @@ void ContainerTest::testTreeParsing ( ) { void ContainerTest::testTrieParsing ( ) { { - std::trie < char, int > t ( 1 ); + ext::trie < char, int > t ( 1 ); std::string string = alib::XmlDataFactory::toString ( t ); std::cout << string << std::endl; - std::trie < char, int > t2 = alib::XmlDataFactory::fromString ( string ); + ext::trie < char, int > t2 = alib::XmlDataFactory::fromString ( string ); CPPUNIT_ASSERT ( t == t2 ); } { - std::trie < char, int > t ( 0, std::map < char, std::trie < char, int > > { std::make_pair ( 'a', std::trie < char, int > ( 1 ) ), std::make_pair ( 'b', std::trie < char, int > ( 2 ) ) } ); + ext::trie < char, int > t ( 0, std::map < char, ext::trie < char, int > > { std::make_pair ( 'a', ext::trie < char, int > ( 1 ) ), std::make_pair ( 'b', ext::trie < char, int > ( 2 ) ) } ); std::string string = alib::XmlDataFactory::toString ( t ); std::cout << string << std::endl; - std::trie < char, int > t2 = alib::XmlDataFactory::fromString ( string ); + ext::trie < char, int > t2 = alib::XmlDataFactory::fromString ( string ); CPPUNIT_ASSERT ( t == t2 ); } { - std::trie < char, int > t ( 0, std::map < char, std::trie < char, int > > { std::make_pair ( 'a', std::trie < char, int > ( 1, std::map < char, std::trie < char, int > > { std::make_pair ( 'a', std::trie < char, int > ( 3 ) ), std::make_pair ( 'b', std::trie < char, int > ( 4 ) ) } ) ), std::make_pair ( 'b', std::trie < char, int > ( 2, std::map < char, std::trie < char, int > > { std::make_pair ( 'a', std::trie < char, int > ( 5 ) ), std::make_pair ( 'b', std::trie < char, int > ( 6 ) ) } ) ) } ); + ext::trie < char, int > t ( 0, std::map < char, ext::trie < char, int > > { std::make_pair ( 'a', ext::trie < char, int > ( 1, std::map < char, ext::trie < char, int > > { std::make_pair ( 'a', ext::trie < char, int > ( 3 ) ), std::make_pair ( 'b', ext::trie < char, int > ( 4 ) ) } ) ), std::make_pair ( 'b', ext::trie < char, int > ( 2, std::map < char, ext::trie < char, int > > { std::make_pair ( 'a', ext::trie < char, int > ( 5 ) ), std::make_pair ( 'b', ext::trie < char, int > ( 6 ) ) } ) ) } ); std::string string = alib::XmlDataFactory::toString ( t ); std::cout << string << std::endl; - std::trie < char, int > t2 = alib::XmlDataFactory::fromString ( string ); + ext::trie < char, int > t2 = alib::XmlDataFactory::fromString ( string ); CPPUNIT_ASSERT ( t == t2 ); } diff --git a/alib2data/src/indexes/common/IndexesNormalize.h b/alib2data/src/indexes/common/IndexesNormalize.h index d8a09df7cc..51b60e6ec7 100644 --- a/alib2data/src/indexes/common/IndexesNormalize.h +++ b/alib2data/src/indexes/common/IndexesNormalize.h @@ -23,31 +23,31 @@ namespace indexes { */ class IndexesNormalize { template < class SymbolType, class ValueType > - static std::trie < DefaultSymbolType, ValueType > normalizeTrieInner ( std::trie < SymbolType, ValueType > && node ) { - std::map < DefaultSymbolType, std::trie < DefaultSymbolType, ValueType > > children; + static ext::trie < DefaultSymbolType, ValueType > normalizeTrieInner ( ext::trie < SymbolType, ValueType > && node ) { + std::map < DefaultSymbolType, ext::trie < DefaultSymbolType, ValueType > > children; - for ( std::pair < SymbolType, std::trie < SymbolType, ValueType > > && child : std::make_moveable_map ( node.getChildren ( ) ) ) { + for ( std::pair < SymbolType, ext::trie < SymbolType, ValueType > > && child : std::make_moveable_map ( node.getChildren ( ) ) ) { children.insert ( std::make_pair ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( child.first ) ), normalizeTrieInner ( std::move ( child.second ) ) ) ); } - return std::trie < DefaultSymbolType, ValueType > ( std::move ( node.getData ( ) ), std::move ( children ) ); + return ext::trie < DefaultSymbolType, ValueType > ( std::move ( node.getData ( ) ), std::move ( children ) ); } public: template < class SymbolType > - static std::trie < DefaultSymbolType, unsigned > normalizeTrie ( std::trie < SymbolType, unsigned > && trie ); + static ext::trie < DefaultSymbolType, unsigned > normalizeTrie ( ext::trie < SymbolType, unsigned > && trie ); template < class SymbolType > - static std::trie < DefaultSymbolType, ext::variant < void, unsigned > > normalizeTrie ( std::trie < SymbolType, ext::variant < void, unsigned > > && trie ); + static ext::trie < DefaultSymbolType, ext::variant < void, unsigned > > normalizeTrie ( ext::trie < SymbolType, ext::variant < void, unsigned > > && trie ); }; template < class SymbolType > -std::trie < DefaultSymbolType, unsigned > IndexesNormalize::normalizeTrie ( std::trie < SymbolType, unsigned > && trie ) { +ext::trie < DefaultSymbolType, unsigned > IndexesNormalize::normalizeTrie ( ext::trie < SymbolType, unsigned > && trie ) { return normalizeTrieInner ( std::move ( trie ) ) ; } template < class SymbolType > -std::trie < DefaultSymbolType, ext::variant < void, unsigned > > IndexesNormalize::normalizeTrie ( std::trie < SymbolType, ext::variant < void, unsigned > > && trie ) { +ext::trie < DefaultSymbolType, ext::variant < void, unsigned > > IndexesNormalize::normalizeTrie ( ext::trie < SymbolType, ext::variant < void, unsigned > > && trie ) { return normalizeTrieInner ( std::move ( trie ) ) ; } diff --git a/alib2data/src/indexes/stringology/PositionHeap.h b/alib2data/src/indexes/stringology/PositionHeap.h index 836d5fb827..520df3289f 100644 --- a/alib2data/src/indexes/stringology/PositionHeap.h +++ b/alib2data/src/indexes/stringology/PositionHeap.h @@ -49,7 +49,7 @@ class GeneralAlphabet; template < class SymbolType = DefaultSymbolType > class PositionHeap final : public alib::ObjectBase, public alib::Components < PositionHeap < SymbolType >, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > { protected: - std::trie < SymbolType, unsigned > m_trie; + ext::trie < SymbolType, unsigned > m_trie; std::vector < SymbolType > m_string; public: @@ -63,15 +63,15 @@ public: */ virtual ObjectBase * plunder ( ) &&; - explicit PositionHeap ( std::set < SymbolType > edgeAlphabet, std::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ); - explicit PositionHeap ( std::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ); + explicit PositionHeap ( std::set < SymbolType > edgeAlphabet, ext::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ); + explicit PositionHeap ( ext::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ); - void checkTrie ( const std::trie < SymbolType, unsigned > & trie ); + void checkTrie ( const ext::trie < SymbolType, unsigned > & trie ); /** * @return Root node of the trie */ - const std::trie < SymbolType, unsigned > & getRoot ( ) const; + const ext::trie < SymbolType, unsigned > & getRoot ( ) const; const std::vector < SymbolType > & getString ( ) const; @@ -83,7 +83,7 @@ public: * Sets the root node of the regular expression tree * @param tree root node to set */ - void setTree ( std::trie < SymbolType, unsigned > tree ); + void setTree ( ext::trie < SymbolType, unsigned > tree ); /** * Removes symbol from the alphabet of symbol available in the regular expression @@ -126,7 +126,7 @@ public: PositionHeap < > normalizeRaw ( ) && { std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::trie < DefaultSymbolType, unsigned > trie = IndexesNormalize::normalizeTrie ( std::move ( m_trie ) ); + ext::trie < DefaultSymbolType, unsigned > trie = IndexesNormalize::normalizeTrie ( std::move ( m_trie ) ); std::vector < DefaultSymbolType > string = alphabet::SymbolNormalize::normalizeSymbols ( std::move ( m_string ) ); return PositionHeap < > ( std::move ( alphabet ), std::move ( trie ), std::move ( string ) ); @@ -149,13 +149,13 @@ namespace indexes { namespace stringology { template < class SymbolType > -PositionHeap < SymbolType >::PositionHeap ( std::set < SymbolType > edgeAlphabet, std::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ) : alib::Components < PositionHeap, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( edgeAlphabet ) ), std::tuple < > ( ) ), m_trie ( std::move ( trie ) ), m_string ( std::move ( string ) ) { +PositionHeap < SymbolType >::PositionHeap ( std::set < SymbolType > edgeAlphabet, ext::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ) : alib::Components < PositionHeap, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( edgeAlphabet ) ), std::tuple < > ( ) ), m_trie ( std::move ( trie ) ), m_string ( std::move ( string ) ) { checkTrie ( this->m_trie ); // TODO check validity of the string like in LinearString } template < class SymbolType > -PositionHeap < SymbolType >::PositionHeap ( std::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ) : PositionHeap ( computeMinimalEdgeAlphabet ( trie ), trie, std::move ( string ) ) { +PositionHeap < SymbolType >::PositionHeap ( ext::trie < SymbolType, unsigned > trie, std::vector < SymbolType > string ) : PositionHeap ( computeMinimalEdgeAlphabet ( trie ), trie, std::move ( string ) ) { } template < class SymbolType > @@ -169,8 +169,8 @@ alib::ObjectBase * PositionHeap < SymbolType >::plunder ( ) && { } template < class SymbolType > -void PositionHeap < SymbolType >::checkTrie ( const std::trie < SymbolType, unsigned > & trie ) { - for ( const std::pair < const SymbolType, std::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { +void PositionHeap < SymbolType >::checkTrie ( const ext::trie < SymbolType, unsigned > & trie ) { + for ( const std::pair < const SymbolType, ext::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { if ( ! getAlphabet ( ).count ( child.first ) ) throw exception::CommonException ( "Symbol " + ext::to_string ( child.first ) + "not in the alphabet." ); checkTrie ( child.second ); @@ -178,7 +178,7 @@ void PositionHeap < SymbolType >::checkTrie ( const std::trie < SymbolType, unsi } template < class SymbolType > -const std::trie < SymbolType, unsigned > & PositionHeap < SymbolType >::getRoot ( ) const { +const ext::trie < SymbolType, unsigned > & PositionHeap < SymbolType >::getRoot ( ) const { return m_trie; } @@ -188,7 +188,7 @@ const std::vector < SymbolType > & PositionHeap < SymbolType >::getString ( ) co } template < class SymbolType > -void PositionHeap < SymbolType >::setTree ( std::trie < SymbolType, unsigned > trie ) { +void PositionHeap < SymbolType >::setTree ( ext::trie < SymbolType, unsigned > trie ) { checkTrie ( trie ); this->m_trie = std::move ( trie ).plunder ( ); } @@ -219,7 +219,7 @@ template < class SymbolType > PositionHeap < SymbolType > PositionHeap < SymbolType >::parse ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, PositionHeap::getXmlTagName() ); std::set < SymbolType > edgeAlphabet = alib::xmlApi < std::set < SymbolType > >::parse ( input ); - std::trie < SymbolType, unsigned > root = alib::xmlApi < std::trie < SymbolType, unsigned > >::parse ( input ); + ext::trie < SymbolType, unsigned > root = alib::xmlApi < ext::trie < SymbolType, unsigned > >::parse ( input ); std::vector < SymbolType > string = alib::xmlApi < std::vector < SymbolType > >::parse ( input ); PositionHeap < SymbolType > trie ( std::move ( edgeAlphabet ), std::move ( root ), std::move ( string ) ); @@ -231,7 +231,7 @@ template < class SymbolType > void PositionHeap < SymbolType >::compose ( std::deque < sax::Token > & out ) const { out.emplace_back ( PositionHeap::getXmlTagName(), sax::Token::TokenType::START_ELEMENT ); alib::xmlApi < std::set < SymbolType > >::compose ( out, getAlphabet ( ) ); - alib::xmlApi < std::trie < SymbolType, unsigned > >::compose ( out, getRoot ( ) ); + alib::xmlApi < ext::trie < SymbolType, unsigned > >::compose ( out, getRoot ( ) ); alib::xmlApi < std::vector < SymbolType > >::compose ( out, getString ( ) ); out.emplace_back ( PositionHeap::getXmlTagName(), sax::Token::TokenType::END_ELEMENT ); } @@ -250,8 +250,8 @@ namespace alib { template < class SymbolType > class ComponentConstraint < indexes::stringology::PositionHeap < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { - static bool used ( const std::trie < SymbolType, unsigned > & trie, const SymbolType & symbol ) { - for ( const std::pair < const SymbolType, std::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { + static bool used ( const ext::trie < SymbolType, unsigned > & trie, const SymbolType & symbol ) { + for ( const std::pair < const SymbolType, ext::trie < SymbolType, unsigned > > & child : trie.getChildren ( ) ) { if ( symbol == child.first || checkTrie ( trie, child.second ) ) return true; } diff --git a/alib2data/src/indexes/stringology/SuffixTrie.h b/alib2data/src/indexes/stringology/SuffixTrie.h index 84e9e2ac17..fcc638606f 100644 --- a/alib2data/src/indexes/stringology/SuffixTrie.h +++ b/alib2data/src/indexes/stringology/SuffixTrie.h @@ -51,7 +51,7 @@ class GeneralAlphabet; template < class SymbolType = DefaultSymbolType > class SuffixTrie final : public alib::ObjectBase, public alib::Components < SuffixTrie < SymbolType >, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > { protected: - std::trie < SymbolType, ext::variant < void, unsigned > > m_trie; + ext::trie < SymbolType, ext::variant < void, unsigned > > m_trie; public: /** @@ -65,15 +65,15 @@ public: virtual ObjectBase * plunder ( ) &&; explicit SuffixTrie ( std::set < SymbolType > edgeAlphabet ); - explicit SuffixTrie ( std::set < SymbolType > edgeAlphabet, std::trie < SymbolType, ext::variant < void, unsigned > > trie ); - explicit SuffixTrie ( std::trie < SymbolType, ext::variant < void, unsigned > > trie ); + explicit SuffixTrie ( std::set < SymbolType > edgeAlphabet, ext::trie < SymbolType, ext::variant < void, unsigned > > trie ); + explicit SuffixTrie ( ext::trie < SymbolType, ext::variant < void, unsigned > > trie ); - void checkTrie ( const std::trie < SymbolType, ext::variant < void, unsigned > > & trie ); + void checkTrie ( const ext::trie < SymbolType, ext::variant < void, unsigned > > & trie ); /** * @return Root node of the trie */ - const std::trie < SymbolType, ext::variant < void, unsigned > > & getRoot ( ) const; + const ext::trie < SymbolType, ext::variant < void, unsigned > > & getRoot ( ) const; const std::set < SymbolType > & getAlphabet ( ) const { return this->template accessComponent < GeneralAlphabet > ( ).get ( ); @@ -83,7 +83,7 @@ public: * Sets the root node of the regular expression tree * @param tree root node to set */ - void setTree ( std::trie < SymbolType, ext::variant < void, unsigned > > tree ); + void setTree ( ext::trie < SymbolType, ext::variant < void, unsigned > > tree ); /** * Removes symbol from the alphabet of symbol available in the regular expression @@ -129,7 +129,7 @@ public: return this; std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::trie < DefaultSymbolType, ext::variant < void, unsigned > > trie = IndexesNormalize::normalizeTrie ( std::move ( m_trie ) ); + ext::trie < DefaultSymbolType, ext::variant < void, unsigned > > trie = IndexesNormalize::normalizeTrie ( std::move ( m_trie ) ); return new SuffixTrie < > ( std::move ( alphabet ), std::move ( trie ) ); } @@ -144,16 +144,16 @@ namespace indexes { namespace stringology { template < class SymbolType > -SuffixTrie < SymbolType >::SuffixTrie ( std::set < SymbolType > edgeAlphabet ) : SuffixTrie ( std::move ( edgeAlphabet ), std::trie < SymbolType, ext::variant < void, unsigned > > ( ext::variant < void, unsigned >::template from < void > ( ) ) ) { +SuffixTrie < SymbolType >::SuffixTrie ( std::set < SymbolType > edgeAlphabet ) : SuffixTrie ( std::move ( edgeAlphabet ), ext::trie < SymbolType, ext::variant < void, unsigned > > ( ext::variant < void, unsigned >::template from < void > ( ) ) ) { } template < class SymbolType > -SuffixTrie < SymbolType >::SuffixTrie ( std::set < SymbolType > edgeAlphabet, std::trie < SymbolType, ext::variant < void, unsigned > > trie ) : alib::Components < SuffixTrie, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( edgeAlphabet ) ), std::tuple < > ( ) ), m_trie ( std::move ( trie ) ) { +SuffixTrie < SymbolType >::SuffixTrie ( std::set < SymbolType > edgeAlphabet, ext::trie < SymbolType, ext::variant < void, unsigned > > trie ) : alib::Components < SuffixTrie, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( edgeAlphabet ) ), std::tuple < > ( ) ), m_trie ( std::move ( trie ) ) { checkTrie ( this->m_trie ); } template < class SymbolType > -SuffixTrie < SymbolType >::SuffixTrie ( std::trie < SymbolType, ext::variant < void, unsigned > > trie ) : SuffixTrie ( computeMinimalEdgeAlphabet ( trie ), trie ) { +SuffixTrie < SymbolType >::SuffixTrie ( ext::trie < SymbolType, ext::variant < void, unsigned > > trie ) : SuffixTrie ( computeMinimalEdgeAlphabet ( trie ), trie ) { } template < class SymbolType > @@ -167,8 +167,8 @@ alib::ObjectBase * SuffixTrie < SymbolType >::plunder ( ) && { } template < class SymbolType > -void SuffixTrie < SymbolType >::checkTrie ( const std::trie < SymbolType, ext::variant < void, unsigned > > & trie ) { - for ( const std::pair < const SymbolType, std::trie < SymbolType, ext::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { +void SuffixTrie < SymbolType >::checkTrie ( const ext::trie < SymbolType, ext::variant < void, unsigned > > & trie ) { + for ( const std::pair < const SymbolType, ext::trie < SymbolType, ext::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { if ( ! getAlphabet ( ).count ( child.first ) ) throw exception::CommonException ( "Symbol " + ext::to_string ( child.first ) + "not in the alphabet." ); checkTrie ( child.second ); @@ -176,12 +176,12 @@ void SuffixTrie < SymbolType >::checkTrie ( const std::trie < SymbolType, ext::v } template < class SymbolType > -const std::trie < SymbolType, ext::variant < void, unsigned > > & SuffixTrie < SymbolType >::getRoot ( ) const { +const ext::trie < SymbolType, ext::variant < void, unsigned > > & SuffixTrie < SymbolType >::getRoot ( ) const { return m_trie; } template < class SymbolType > -void SuffixTrie < SymbolType >::setTree ( std::trie < SymbolType, ext::variant < void, unsigned > > trie ) { +void SuffixTrie < SymbolType >::setTree ( ext::trie < SymbolType, ext::variant < void, unsigned > > trie ) { checkTrie ( trie ); this->m_trie = std::move ( trie ).plunder ( ); } @@ -212,7 +212,7 @@ template < class SymbolType > SuffixTrie < SymbolType > SuffixTrie < SymbolType >::parse ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, SuffixTrie::getXmlTagName() ); std::set < SymbolType > edgeAlphabet = alib::xmlApi < std::set < SymbolType > >::parse ( input ); - std::trie < SymbolType, ext::variant < void, unsigned > > root = alib::xmlApi < std::trie < SymbolType, ext::variant < void, unsigned > > >::parse ( input ); + ext::trie < SymbolType, ext::variant < void, unsigned > > root = alib::xmlApi < ext::trie < SymbolType, ext::variant < void, unsigned > > >::parse ( input ); SuffixTrie < SymbolType > trie ( std::move ( edgeAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, SuffixTrie::getXmlTagName() ); @@ -223,7 +223,7 @@ template < class SymbolType > void SuffixTrie < SymbolType >::compose ( std::deque < sax::Token > & out ) const { out.emplace_back ( SuffixTrie::getXmlTagName(), sax::Token::TokenType::START_ELEMENT ); alib::xmlApi < std::set < SymbolType > >::compose ( out, getAlphabet ( ) ); - alib::xmlApi < std::trie < SymbolType, ext::variant < void, unsigned > > >::compose ( out, getRoot ( ) ); + alib::xmlApi < ext::trie < SymbolType, ext::variant < void, unsigned > > >::compose ( out, getRoot ( ) ); out.emplace_back ( SuffixTrie::getXmlTagName(), sax::Token::TokenType::END_ELEMENT ); } @@ -241,8 +241,8 @@ namespace alib { template < class SymbolType > class ComponentConstraint < indexes::stringology::SuffixTrie < SymbolType >, SymbolType, indexes::stringology::GeneralAlphabet > { - static bool used ( const std::trie < SymbolType, ext::variant < void, unsigned > > & trie, const SymbolType & symbol ) { - for ( const std::pair < const SymbolType, std::trie < SymbolType, ext::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { + static bool used ( const ext::trie < SymbolType, ext::variant < void, unsigned > > & trie, const SymbolType & symbol ) { + for ( const std::pair < const SymbolType, ext::trie < SymbolType, ext::variant < void, unsigned > > > & child : trie.getChildren ( ) ) { if ( symbol == child.first || checkTrie ( trie, child.second ) ) return true; } diff --git a/alib2data/src/regexp/formal/FormalRegExpAlternation.h b/alib2data/src/regexp/formal/FormalRegExpAlternation.h index 717b050acc..6930af952a 100644 --- a/alib2data/src/regexp/formal/FormalRegExpAlternation.h +++ b/alib2data/src/regexp/formal/FormalRegExpAlternation.h @@ -22,7 +22,7 @@ namespace regexp { * as operands of the operator. */ template < class SymbolType > -class FormalRegExpAlternation : public FormalRegExpElement < SymbolType >, public std::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpAlternation < SymbolType > > { +class FormalRegExpAlternation : public FormalRegExpElement < SymbolType >, public ext::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpAlternation < SymbolType > > { public: void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); @@ -113,7 +113,7 @@ public: namespace regexp { template < class SymbolType > -FormalRegExpAlternation < SymbolType >::FormalRegExpAlternation ( FormalRegExpElement < SymbolType > && leftElement, FormalRegExpElement < SymbolType > && rightElement ) : std::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpAlternation < SymbolType > > ( std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( leftElement ).plunder ( ) ), std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( rightElement ).plunder ( ) ) ) { +FormalRegExpAlternation < SymbolType >::FormalRegExpAlternation ( FormalRegExpElement < SymbolType > && leftElement, FormalRegExpElement < SymbolType > && rightElement ) : ext::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpAlternation < SymbolType > > ( std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( leftElement ).plunder ( ) ), std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( rightElement ).plunder ( ) ) ) { } template < class SymbolType > diff --git a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h index e2c5ead04d..8e417f39d5 100644 --- a/alib2data/src/regexp/formal/FormalRegExpConcatenation.h +++ b/alib2data/src/regexp/formal/FormalRegExpConcatenation.h @@ -22,7 +22,7 @@ namespace regexp { * as operands of the operator. */ template < class SymbolType > -class FormalRegExpConcatenation : public FormalRegExpElement < SymbolType >, public std::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpConcatenation < SymbolType > > { +class FormalRegExpConcatenation : public FormalRegExpElement < SymbolType >, public ext::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpConcatenation < SymbolType > > { public: void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); @@ -109,7 +109,7 @@ public: namespace regexp { template < class SymbolType > -FormalRegExpConcatenation < SymbolType >::FormalRegExpConcatenation ( FormalRegExpElement < SymbolType > && leftElement, FormalRegExpElement < SymbolType > && rightElement ) : std::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpConcatenation < SymbolType > > ( std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( leftElement ).plunder ( ) ), std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( rightElement ).plunder ( ) ) ) { +FormalRegExpConcatenation < SymbolType >::FormalRegExpConcatenation ( FormalRegExpElement < SymbolType > && leftElement, FormalRegExpElement < SymbolType > && rightElement ) : ext::BinaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpConcatenation < SymbolType > > ( std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( leftElement ).plunder ( ) ), std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( rightElement ).plunder ( ) ) ) { } template < class SymbolType > diff --git a/alib2data/src/regexp/formal/FormalRegExpElement.h b/alib2data/src/regexp/formal/FormalRegExpElement.h index f73477f5fa..9e7994bb9d 100644 --- a/alib2data/src/regexp/formal/FormalRegExpElement.h +++ b/alib2data/src/regexp/formal/FormalRegExpElement.h @@ -19,7 +19,7 @@ namespace regexp { * Abstract class representing element in the formal regular expression. Can be operator or symbol. */ template < class SymbolType > -class FormalRegExpElement : public alib::CommonBaseMiddle < FormalRegExpElement < SymbolType > >, public std::BaseNode < FormalRegExpElement < SymbolType > > { +class FormalRegExpElement : public alib::CommonBaseMiddle < FormalRegExpElement < SymbolType > >, public ext::BaseNode < FormalRegExpElement < SymbolType > > { public: class Visitor { public: diff --git a/alib2data/src/regexp/formal/FormalRegExpEmpty.h b/alib2data/src/regexp/formal/FormalRegExpEmpty.h index e3ba960d00..1b1eb8cd43 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEmpty.h +++ b/alib2data/src/regexp/formal/FormalRegExpEmpty.h @@ -18,7 +18,7 @@ namespace regexp { * Represents empty regular expression in the regular expression. */ template < class SymbolType > -class FormalRegExpEmpty : public FormalRegExpElement < SymbolType >, public std::NullaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpSymbol < SymbolType > > { +class FormalRegExpEmpty : public FormalRegExpElement < SymbolType >, public ext::NullaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpSymbol < SymbolType > > { public: void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h index d06a89c807..53894519d8 100644 --- a/alib2data/src/regexp/formal/FormalRegExpEpsilon.h +++ b/alib2data/src/regexp/formal/FormalRegExpEpsilon.h @@ -18,7 +18,7 @@ namespace regexp { * Represents epsilon in the regular expression. */ template < class SymbolType > -class FormalRegExpEpsilon : public FormalRegExpElement < SymbolType >, public std::NullaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpSymbol < SymbolType > > { +class FormalRegExpEpsilon : public FormalRegExpElement < SymbolType >, public ext::NullaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpSymbol < SymbolType > > { public: void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/regexp/formal/FormalRegExpIteration.h b/alib2data/src/regexp/formal/FormalRegExpIteration.h index 98d2a15c22..4ec67e3d52 100644 --- a/alib2data/src/regexp/formal/FormalRegExpIteration.h +++ b/alib2data/src/regexp/formal/FormalRegExpIteration.h @@ -22,7 +22,7 @@ namespace regexp { * as operand. */ template < class SymbolType > -class FormalRegExpIteration : public FormalRegExpElement < SymbolType >, public std::UnaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpIteration < SymbolType > > { +class FormalRegExpIteration : public FormalRegExpElement < SymbolType >, public ext::UnaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpIteration < SymbolType > > { public: void accept ( typename FormalRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); @@ -105,7 +105,7 @@ public: namespace regexp { template < class SymbolType > -FormalRegExpIteration < SymbolType >::FormalRegExpIteration ( FormalRegExpElement < SymbolType > && element ) : std::UnaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpIteration < SymbolType > > ( std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( element ).plunder ( ) ) ) { +FormalRegExpIteration < SymbolType >::FormalRegExpIteration ( FormalRegExpElement < SymbolType > && element ) : ext::UnaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpIteration < SymbolType > > ( std::smart_ptr < FormalRegExpElement < SymbolType > > ( std::move ( element ).plunder ( ) ) ) { } template < class SymbolType > diff --git a/alib2data/src/regexp/formal/FormalRegExpSymbol.h b/alib2data/src/regexp/formal/FormalRegExpSymbol.h index c6ac9daa59..9e4e90b5c5 100644 --- a/alib2data/src/regexp/formal/FormalRegExpSymbol.h +++ b/alib2data/src/regexp/formal/FormalRegExpSymbol.h @@ -19,7 +19,7 @@ namespace regexp { * Represents symbol in the regular expression. Contains name of the symbol. */ template < class SymbolType > -class FormalRegExpSymbol : public FormalRegExpElement < SymbolType >, public std::NullaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpSymbol < SymbolType > > { +class FormalRegExpSymbol : public FormalRegExpElement < SymbolType >, public ext::NullaryNode < std::smart_ptr < FormalRegExpElement < SymbolType > >, std::smart_ptr < const FormalRegExpElement < SymbolType > >, FormalRegExpSymbol < SymbolType > > { SymbolType m_symbol; public: diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h index 6819ba0834..8673f18ae2 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpAlternation.h @@ -22,7 +22,7 @@ namespace regexp { * as operands of the operator. */ template < class SymbolType > -class UnboundedRegExpAlternation : public UnboundedRegExpElement < SymbolType >, public std::VararyNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpAlternation < SymbolType > > { +class UnboundedRegExpAlternation : public UnboundedRegExpElement < SymbolType >, public ext::VararyNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpAlternation < SymbolType > > { public: void accept ( typename UnboundedRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h index 154770fcad..ad092f9348 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpConcatenation.h @@ -22,7 +22,7 @@ namespace regexp { * as operands of the operator. */ template < class SymbolType > -class UnboundedRegExpConcatenation : public UnboundedRegExpElement < SymbolType >, public std::VararyNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpConcatenation < SymbolType > > { +class UnboundedRegExpConcatenation : public UnboundedRegExpElement < SymbolType >, public ext::VararyNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpConcatenation < SymbolType > > { public: void accept ( typename UnboundedRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h index ec34ff6441..bc2ea68884 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpElement.h @@ -19,7 +19,7 @@ namespace regexp { * Abstract class representing element in the regular expression. Can be operator or symbol. */ template < class SymbolType > -class UnboundedRegExpElement : public alib::CommonBaseMiddle < UnboundedRegExpElement < SymbolType > >, public std::BaseNode < UnboundedRegExpElement < SymbolType > > { +class UnboundedRegExpElement : public alib::CommonBaseMiddle < UnboundedRegExpElement < SymbolType > >, public ext::BaseNode < UnboundedRegExpElement < SymbolType > > { public: class Visitor { public: diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h index 2f3c42e884..88a2521d19 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEmpty.h @@ -18,7 +18,7 @@ namespace regexp { * Represents empty regular expression in the regular expression. */ template < class SymbolType > -class UnboundedRegExpEmpty : public UnboundedRegExpElement < SymbolType >, public std::NullaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpSymbol < SymbolType > > { +class UnboundedRegExpEmpty : public UnboundedRegExpElement < SymbolType >, public ext::NullaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpSymbol < SymbolType > > { public: void accept ( typename UnboundedRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h index c5460bfc47..cd6c3c7bc9 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpEpsilon.h @@ -18,7 +18,7 @@ namespace regexp { * Represents epsilon in the regular expression. */ template < class SymbolType > -class UnboundedRegExpEpsilon : public UnboundedRegExpElement < SymbolType >, public std::NullaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpSymbol < SymbolType > > { +class UnboundedRegExpEpsilon : public UnboundedRegExpElement < SymbolType >, public ext::NullaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpSymbol < SymbolType > > { public: void accept ( typename UnboundedRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h index 6a0cd632c8..3518ade973 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpIteration.h @@ -21,7 +21,7 @@ namespace regexp { * as operand. */ template < class SymbolType > -class UnboundedRegExpIteration : public UnboundedRegExpElement < SymbolType >, public std::UnaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpIteration < SymbolType > > { +class UnboundedRegExpIteration : public UnboundedRegExpElement < SymbolType >, public ext::UnaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpIteration < SymbolType > > { public: void accept ( typename UnboundedRegExpElement < SymbolType >::Visitor & visitor ) const override { visitor.visit ( * this ); @@ -104,7 +104,7 @@ public: namespace regexp { template < class SymbolType > -UnboundedRegExpIteration < SymbolType >::UnboundedRegExpIteration ( UnboundedRegExpElement < SymbolType > && element ) : std::UnaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpIteration < SymbolType > > ( std::smart_ptr < UnboundedRegExpElement < SymbolType > > ( std::move ( element ).plunder ( ) ) ) { +UnboundedRegExpIteration < SymbolType >::UnboundedRegExpIteration ( UnboundedRegExpElement < SymbolType > && element ) : ext::UnaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpIteration < SymbolType > > ( std::smart_ptr < UnboundedRegExpElement < SymbolType > > ( std::move ( element ).plunder ( ) ) ) { } template < class SymbolType > diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h index c17d68d898..76b0182233 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExpSymbol.h @@ -19,7 +19,7 @@ namespace regexp { * Represents symbol in the regular expression. Contains name of the symbol. */ template < class SymbolType > -class UnboundedRegExpSymbol : public UnboundedRegExpElement < SymbolType >, public std::NullaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpSymbol < SymbolType > > { +class UnboundedRegExpSymbol : public UnboundedRegExpElement < SymbolType >, public ext::NullaryNode < std::smart_ptr < UnboundedRegExpElement < SymbolType > >, std::smart_ptr < const UnboundedRegExpElement < SymbolType > >, UnboundedRegExpSymbol < SymbolType > > { SymbolType m_symbol; public: diff --git a/alib2data/src/rte/formal/FormalRTEAlternation.h b/alib2data/src/rte/formal/FormalRTEAlternation.h index 25d0b04f59..59b54c0f78 100644 --- a/alib2data/src/rte/formal/FormalRTEAlternation.h +++ b/alib2data/src/rte/formal/FormalRTEAlternation.h @@ -22,7 +22,7 @@ namespace rte { * as operands of the operator. */ template < class SymbolType, class RankType > -class FormalRTEAlternation : public FormalRTEElement < SymbolType, RankType >, public std::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTEAlternation < SymbolType, RankType > > { +class FormalRTEAlternation : public FormalRTEElement < SymbolType, RankType >, public ext::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTEAlternation < SymbolType, RankType > > { public: virtual void accept ( typename FormalRTEElement < SymbolType, RankType >::Visitor & visitor ) const override { visitor.visit ( * this ); @@ -101,7 +101,7 @@ public: }; template < class SymbolType, class RankType > -FormalRTEAlternation < SymbolType, RankType >::FormalRTEAlternation ( FormalRTEElement < SymbolType, RankType > && left, FormalRTEElement < SymbolType, RankType > && right ) : std::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTEAlternation < SymbolType, RankType > > ( std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( left ).plunder ( ) ), std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( right ).plunder ( ) ) ) { +FormalRTEAlternation < SymbolType, RankType >::FormalRTEAlternation ( FormalRTEElement < SymbolType, RankType > && left, FormalRTEElement < SymbolType, RankType > && right ) : ext::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTEAlternation < SymbolType, RankType > > ( std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( left ).plunder ( ) ), std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( right ).plunder ( ) ) ) { } template < class SymbolType, class RankType > diff --git a/alib2data/src/rte/formal/FormalRTEElement.h b/alib2data/src/rte/formal/FormalRTEElement.h index e89b5cf74c..90aba5158a 100644 --- a/alib2data/src/rte/formal/FormalRTEElement.h +++ b/alib2data/src/rte/formal/FormalRTEElement.h @@ -17,7 +17,7 @@ namespace rte { template < class SymbolType, class RankType > -class FormalRTEElement : public alib::CommonBaseMiddle < FormalRTEElement < SymbolType, RankType > >, public std::BaseNode < FormalRTEElement < SymbolType, RankType > > { +class FormalRTEElement : public alib::CommonBaseMiddle < FormalRTEElement < SymbolType, RankType > >, public ext::BaseNode < FormalRTEElement < SymbolType, RankType > > { public: class Visitor { public: diff --git a/alib2data/src/rte/formal/FormalRTEIteration.h b/alib2data/src/rte/formal/FormalRTEIteration.h index e85c3be79e..5bd783ba3c 100644 --- a/alib2data/src/rte/formal/FormalRTEIteration.h +++ b/alib2data/src/rte/formal/FormalRTEIteration.h @@ -23,7 +23,7 @@ namespace rte { * as operand. */ template < class SymbolType, class RankType > -class FormalRTEIteration : public FormalRTEElement < SymbolType, RankType >, public std::UnaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < const FormalRTEElement < SymbolType, RankType > >, FormalRTEIteration < SymbolType, RankType > > { +class FormalRTEIteration : public FormalRTEElement < SymbolType, RankType >, public ext::UnaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < const FormalRTEElement < SymbolType, RankType > >, FormalRTEIteration < SymbolType, RankType > > { protected: std::smart_ptr < FormalRTESymbolSubst < SymbolType, RankType > > m_substitutionSymbol; @@ -101,7 +101,7 @@ public: }; template < class SymbolType, class RankType > -FormalRTEIteration < SymbolType, RankType >::FormalRTEIteration ( FormalRTEElement < SymbolType, RankType > && element, FormalRTESymbolSubst < SymbolType, RankType > substitutionSymbol ) : std::UnaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < const FormalRTEElement < SymbolType, RankType > >, FormalRTEIteration < SymbolType, RankType > > ( std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( element ).plunder ( ) ) ), m_substitutionSymbol ( std::smart_ptr < FormalRTESymbolSubst < SymbolType, RankType > > ( std::move ( substitutionSymbol ).plunder ( ) ) ) { +FormalRTEIteration < SymbolType, RankType >::FormalRTEIteration ( FormalRTEElement < SymbolType, RankType > && element, FormalRTESymbolSubst < SymbolType, RankType > substitutionSymbol ) : ext::UnaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < const FormalRTEElement < SymbolType, RankType > >, FormalRTEIteration < SymbolType, RankType > > ( std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( element ).plunder ( ) ) ), m_substitutionSymbol ( std::smart_ptr < FormalRTESymbolSubst < SymbolType, RankType > > ( std::move ( substitutionSymbol ).plunder ( ) ) ) { } template < class SymbolType, class RankType > diff --git a/alib2data/src/rte/formal/FormalRTESubstitution.h b/alib2data/src/rte/formal/FormalRTESubstitution.h index 391fa3a61f..3ff11f99e2 100644 --- a/alib2data/src/rte/formal/FormalRTESubstitution.h +++ b/alib2data/src/rte/formal/FormalRTESubstitution.h @@ -22,7 +22,7 @@ namespace rte { * as operands of the operator. */ template < class SymbolType, class RankType > -class FormalRTESubstitution : public FormalRTEElement < SymbolType, RankType >, public std::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTESubstitution < SymbolType, RankType > > { +class FormalRTESubstitution : public FormalRTEElement < SymbolType, RankType >, public ext::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTESubstitution < SymbolType, RankType > > { protected: std::smart_ptr < FormalRTESymbolSubst < SymbolType, RankType > > m_substitutionSymbol; // substite this in left by right @@ -104,7 +104,7 @@ public: }; template < class SymbolType, class RankType > -FormalRTESubstitution < SymbolType, RankType >::FormalRTESubstitution ( FormalRTEElement < SymbolType, RankType > && left, FormalRTEElement < SymbolType, RankType > && right, FormalRTESymbolSubst < SymbolType, RankType > substitutionSymbol ) : std::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTESubstitution < SymbolType, RankType > > ( std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( left ).plunder ( ) ), std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( right ).plunder ( ) ) ), m_substitutionSymbol ( std::smart_ptr < FormalRTESymbolSubst < SymbolType, RankType > > ( std::move ( substitutionSymbol ).plunder ( ) ) ) { +FormalRTESubstitution < SymbolType, RankType >::FormalRTESubstitution ( FormalRTEElement < SymbolType, RankType > && left, FormalRTEElement < SymbolType, RankType > && right, FormalRTESymbolSubst < SymbolType, RankType > substitutionSymbol ) : ext::BinaryNode < std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, std::smart_ptr < FormalRTEElement < SymbolType, RankType > >, FormalRTESubstitution < SymbolType, RankType > > ( std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( left ).plunder ( ) ), std::smart_ptr < FormalRTEElement < SymbolType, RankType > > ( std::move ( right ).plunder ( ) ) ), m_substitutionSymbol ( std::smart_ptr < FormalRTESymbolSubst < SymbolType, RankType > > ( std::move ( substitutionSymbol ).plunder ( ) ) ) { } template < class SymbolType, class RankType > diff --git a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h index 2a3ea9f552..7b0d8e62b3 100644 --- a/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h +++ b/alib2data/src/rte/formal/FormalRTESymbolAlphabet.h @@ -21,7 +21,7 @@ namespace rte { * Represents symbol in the regular expression. Contains name of the symbol. */ template < class SymbolType, class RankType > -class FormalRTESymbolAlphabet : public FormalRTESymbol < SymbolType, RankType >, public std::VararyNode < std::smart_ptr < FormalRTESymbol < SymbolType, RankType > >, std::smart_ptr < const FormalRTESymbol < SymbolType, RankType > >, FormalRTESymbolAlphabet < SymbolType, RankType > > { +class FormalRTESymbolAlphabet : public FormalRTESymbol < SymbolType, RankType >, public ext::VararyNode < std::smart_ptr < FormalRTESymbol < SymbolType, RankType > >, std::smart_ptr < const FormalRTESymbol < SymbolType, RankType > >, FormalRTESymbolAlphabet < SymbolType, RankType > > { public: virtual void accept ( typename FormalRTEElement < SymbolType, RankType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/rte/formal/FormalRTESymbolSubst.h b/alib2data/src/rte/formal/FormalRTESymbolSubst.h index c597f121b8..d8b6e6c793 100644 --- a/alib2data/src/rte/formal/FormalRTESymbolSubst.h +++ b/alib2data/src/rte/formal/FormalRTESymbolSubst.h @@ -20,7 +20,7 @@ namespace rte { * Represents constant symbol (element of alphabet K) in the regular expression. Contains name of the symbol. */ template < class SymbolType, class RankType > -class FormalRTESymbolSubst : public FormalRTESymbol < SymbolType, RankType >, public std::NullaryNode < FormalRTESymbolSubst < SymbolType, RankType > > { +class FormalRTESymbolSubst : public FormalRTESymbol < SymbolType, RankType >, public ext::NullaryNode < FormalRTESymbolSubst < SymbolType, RankType > > { public: virtual void accept ( typename FormalRTEElement < SymbolType, RankType >::Visitor & visitor ) const override { visitor.visit ( * this ); diff --git a/alib2data/src/tree/common/TreeAuxiliary.h b/alib2data/src/tree/common/TreeAuxiliary.h index 775d1eea22..74370036c9 100644 --- a/alib2data/src/tree/common/TreeAuxiliary.h +++ b/alib2data/src/tree/common/TreeAuxiliary.h @@ -27,11 +27,11 @@ public: static std::set < common::ranked_symbol < SymbolType, RankType > > computeBars ( const std::set < common::ranked_symbol < SymbolType, RankType > > & alphabet, const SymbolType & barBase ); template < class SymbolType, class RankType > - static std::tree < common::ranked_symbol < SymbolType, RankType > > toRankedTree ( const std::tree < SymbolType > & from ); + static ext::tree < common::ranked_symbol < SymbolType, RankType > > toRankedTree ( const ext::tree < SymbolType > & from ); template < class SymbolType, class RankType > - static std::tree < common::ranked_symbol < SymbolType, RankType > > toRankedTree (const std::vector < common::ranked_symbol < SymbolType, RankType > > & from); + static ext::tree < common::ranked_symbol < SymbolType, RankType > > toRankedTree (const std::vector < common::ranked_symbol < SymbolType, RankType > > & from); template < class SymbolType, class RankType > - static std::tree < SymbolType > toUnrankedTree ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & from ); + static ext::tree < SymbolType > toUnrankedTree ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & from ); }; @@ -50,39 +50,39 @@ std::set < common::ranked_symbol < SymbolType, RankType > > TreeAuxiliary::compu } template < class SymbolType, class RankType > -std::tree < common::ranked_symbol < SymbolType, RankType > > TreeAuxiliary::toRankedTree ( const std::tree < SymbolType > & tree ) { - std::vector < std::tree < common::ranked_symbol < SymbolType, RankType > > > children; +ext::tree < common::ranked_symbol < SymbolType, RankType > > TreeAuxiliary::toRankedTree ( const ext::tree < SymbolType > & tree ) { + std::vector < ext::tree < common::ranked_symbol < SymbolType, RankType > > > children; - for ( const std::tree < SymbolType > & child : tree ) { + for ( const ext::tree < SymbolType > & child : tree ) { children.push_back ( toRankedTree < SymbolType, RankType > ( child ) ); } unsigned size = children.size ( ); - return std::tree < common::ranked_symbol < SymbolType, RankType > > ( common::ranked_symbol < SymbolType, RankType > ( tree.getData ( ), size ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < SymbolType, RankType > > ( common::ranked_symbol < SymbolType, RankType > ( tree.getData ( ), size ), std::move ( children ) ); } template < class SymbolType, class RankType > -std::tree < common::ranked_symbol < SymbolType, RankType > > TreeAuxiliary::toRankedTree ( const std::vector < common::ranked_symbol < SymbolType, RankType > > & from ) { +ext::tree < common::ranked_symbol < SymbolType, RankType > > TreeAuxiliary::toRankedTree ( const std::vector < common::ranked_symbol < SymbolType, RankType > > & from ) { - std::stack < std::tree < common::ranked_symbol < SymbolType, RankType > > > tree_stack; + std::stack < ext::tree < common::ranked_symbol < SymbolType, RankType > > > tree_stack; for ( auto x : from ) { if ( ( unsigned ) x.getRank ( ) == 0 ) { - tree_stack.push ( std::tree < common::ranked_symbol < SymbolType, RankType > > ( common::ranked_symbol < SymbolType, RankType > ( x.getSymbol ( ), x.getRank ( ) ), std::vector < std::tree < common::ranked_symbol < SymbolType, RankType > > > ( ) ) ); + tree_stack.push ( ext::tree < common::ranked_symbol < SymbolType, RankType > > ( common::ranked_symbol < SymbolType, RankType > ( x.getSymbol ( ), x.getRank ( ) ), std::vector < ext::tree < common::ranked_symbol < SymbolType, RankType > > > ( ) ) ); } else { unsigned children_size = ( unsigned ) x.getRank ( ); - std::list < std::tree < common::ranked_symbol < SymbolType, RankType > > > childrenList; + std::list < ext::tree < common::ranked_symbol < SymbolType, RankType > > > childrenList; for ( unsigned i = 0; i < children_size; ++i ) { - std::tree < common::ranked_symbol < SymbolType, RankType > > child = tree_stack.top ( ); + ext::tree < common::ranked_symbol < SymbolType, RankType > > child = tree_stack.top ( ); tree_stack.pop ( ); childrenList.push_front ( child ); } - std::vector < std::tree < common::ranked_symbol < SymbolType, RankType > > > children { + std::vector < ext::tree < common::ranked_symbol < SymbolType, RankType > > > children { std::begin ( childrenList ), std::end ( childrenList ) }; - tree_stack.push ( std::tree < common::ranked_symbol < SymbolType, RankType > > ( common::ranked_symbol < SymbolType, RankType > ( x.getSymbol ( ), x.getRank ( ) ), std::move ( children ) ) ); + tree_stack.push ( ext::tree < common::ranked_symbol < SymbolType, RankType > > ( common::ranked_symbol < SymbolType, RankType > ( x.getSymbol ( ), x.getRank ( ) ), std::move ( children ) ) ); } } @@ -91,14 +91,14 @@ std::tree < common::ranked_symbol < SymbolType, RankType > > TreeAuxiliary::toRa template < class SymbolType, class RankType > -std::tree < SymbolType > TreeAuxiliary::toUnrankedTree ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { - std::vector < std::tree < SymbolType > > children; +ext::tree < SymbolType > TreeAuxiliary::toUnrankedTree ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { + std::vector < ext::tree < SymbolType > > children; - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : tree ) { + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : tree ) { children.push_back ( toUnrankedTree < SymbolType, RankType > ( child ) ); } - return std::tree < SymbolType > ( tree.getData ( ).getSymbol ( ), std::move ( children ) ); + return ext::tree < SymbolType > ( tree.getData ( ).getSymbol ( ), std::move ( children ) ); } } /* namespace tree */ diff --git a/alib2data/src/tree/common/TreeFromXMLParser.h b/alib2data/src/tree/common/TreeFromXMLParser.h index 006c74f025..951997c3fd 100644 --- a/alib2data/src/tree/common/TreeFromXMLParser.h +++ b/alib2data/src/tree/common/TreeFromXMLParser.h @@ -24,13 +24,13 @@ namespace tree { */ class TreeFromXMLParser { template < class SymbolType > - static std::tree < SymbolType > parseTreeChild ( std::deque < sax::Token >::iterator & input ); + static ext::tree < SymbolType > parseTreeChild ( std::deque < sax::Token >::iterator & input ); public: template < class SymbolType > static std::vector < SymbolType > parseLinearContent ( std::deque < sax::Token >::iterator & input ); template < class SymbolType > - static std::tree < SymbolType > parseTreeContent ( std::deque < sax::Token >::iterator & input ); + static ext::tree < SymbolType > parseTreeContent ( std::deque < sax::Token >::iterator & input ); template < class SymbolType > static std::set < SymbolType > parseAlphabet ( std::deque < sax::Token >::iterator & input ); @@ -114,10 +114,10 @@ std::vector < SymbolType > TreeFromXMLParser::parseLinearContent ( std::deque < } template < class SymbolType > -std::tree < SymbolType > TreeFromXMLParser::parseTreeChild ( std::deque < sax::Token >::iterator & input ) { +ext::tree < SymbolType > TreeFromXMLParser::parseTreeChild ( std::deque < sax::Token >::iterator & input ) { SymbolType symbol = alib::xmlApi < SymbolType >::parse ( input ); - std::vector < std::tree < SymbolType > > children; + std::vector < ext::tree < SymbolType > > children; if ( sax::FromXMLParserHelper::isToken ( input, sax::Token::TokenType::START_ELEMENT, "Children" ) ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "Children" ); @@ -129,14 +129,14 @@ std::tree < SymbolType > TreeFromXMLParser::parseTreeChild ( std::deque < sax::T sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, "Children" ); } - return std::tree < SymbolType > ( symbol, std::move( children ) ); + return ext::tree < SymbolType > ( symbol, std::move( children ) ); } template < class SymbolType > -std::tree < SymbolType > TreeFromXMLParser::parseTreeContent ( std::deque < sax::Token >::iterator & input ) { +ext::tree < SymbolType > TreeFromXMLParser::parseTreeContent ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, "content" ); - std::tree < SymbolType > data = TreeFromXMLParser::parseTreeChild < SymbolType > ( input ); + ext::tree < SymbolType > data = TreeFromXMLParser::parseTreeChild < SymbolType > ( input ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, "content" ); return data; diff --git a/alib2data/src/tree/common/TreeNormalize.h b/alib2data/src/tree/common/TreeNormalize.h index 0d7e33937d..f255935abb 100644 --- a/alib2data/src/tree/common/TreeNormalize.h +++ b/alib2data/src/tree/common/TreeNormalize.h @@ -21,33 +21,33 @@ namespace tree { class TreeNormalize { public: template < class SymbolType > - static std::tree < DefaultSymbolType > normalizeTree ( std::tree < SymbolType > && tree ); + static ext::tree < DefaultSymbolType > normalizeTree ( ext::tree < SymbolType > && tree ); template < class SymbolType, class RankType > - static std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > normalizeRankedTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > && tree ); + static ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > normalizeRankedTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > && tree ); }; template < class SymbolType > -std::tree < DefaultSymbolType > TreeNormalize::normalizeTree ( std::tree < SymbolType > && tree ) { - std::vector < std::tree < DefaultSymbolType > > children; +ext::tree < DefaultSymbolType > TreeNormalize::normalizeTree ( ext::tree < SymbolType > && tree ) { + std::vector < ext::tree < DefaultSymbolType > > children; - for ( std::tree < SymbolType > & child : tree.getChildren ( ) ) { + for ( ext::tree < SymbolType > & child : tree.getChildren ( ) ) { children.push_back ( normalizeTree ( std::move ( child ) ) ); } - return std::tree < DefaultSymbolType > ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( tree.getData ( ) ) ), std::move ( children ) ); + return ext::tree < DefaultSymbolType > ( alphabet::SymbolNormalize::normalizeSymbol ( std::move ( tree.getData ( ) ) ), std::move ( children ) ); } template < class SymbolType, class RankType > -std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > TreeNormalize::normalizeRankedTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > && tree ) { - std::vector < std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > > children; +ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > TreeNormalize::normalizeRankedTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > && tree ) { + std::vector < ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > > children; - for ( std::tree < common::ranked_symbol < SymbolType, RankType > > & child : tree.getChildren ( ) ) { + for ( ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : tree.getChildren ( ) ) { children.push_back ( normalizeRankedTree ( std::move ( child ) ) ); } - return std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > ( alphabet::SymbolNormalize::normalizeRankedSymbol ( std::move ( tree.getData ( ) ) ), std::move ( children ) ); + return ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > ( alphabet::SymbolNormalize::normalizeRankedSymbol ( std::move ( tree.getData ( ) ) ), std::move ( children ) ); } } /* namespace tree */ diff --git a/alib2data/src/tree/common/TreeToXMLComposer.h b/alib2data/src/tree/common/TreeToXMLComposer.h index 4bbbd89815..a5fc31c397 100644 --- a/alib2data/src/tree/common/TreeToXMLComposer.h +++ b/alib2data/src/tree/common/TreeToXMLComposer.h @@ -38,7 +38,7 @@ public: template < class SymbolType > static void composeContent ( std::deque < sax::Token > & out, const std::vector < SymbolType > & content ); template < class SymbolType > - static void composeContent ( std::deque < sax::Token > & out, const std::tree < SymbolType > & content ); + static void composeContent ( std::deque < sax::Token > & out, const ext::tree < SymbolType > & content ); template < class SymbolType > static void composeNonlinearVariables ( std::deque < sax::Token > & out, const std::set < SymbolType > & symbols ); @@ -96,12 +96,12 @@ void TreeToXMLComposer::composeContent ( std::deque < sax::Token > & out, const } template < class SymbolType > -void TreeToXMLComposer::composeContent ( std::deque < sax::Token > & out, const std::tree < SymbolType > & content ) { +void TreeToXMLComposer::composeContent ( std::deque < sax::Token > & out, const ext::tree < SymbolType > & content ) { out.emplace_back ( "content", sax::Token::TokenType::START_ELEMENT ); unsigned level = 0; - for ( typename std::tree < SymbolType >::const_prefix_iterator iter = content.prefix_begin ( ); iter != content.prefix_end ( ); ) { + for ( typename ext::tree < SymbolType >::const_prefix_iterator iter = content.prefix_begin ( ); iter != content.prefix_end ( ); ) { while ( iter.getLevel ( ) > level ) { out.emplace_back ( "Children", sax::Token::TokenType::START_ELEMENT ); ++level; diff --git a/alib2data/src/tree/ranked/PostfixRankedTree.h b/alib2data/src/tree/ranked/PostfixRankedTree.h index bb44d57cec..ead44a42dc 100644 --- a/alib2data/src/tree/ranked/PostfixRankedTree.h +++ b/alib2data/src/tree/ranked/PostfixRankedTree.h @@ -39,7 +39,7 @@ template < class SymbolType, class RankType > class PostfixRankedTree final : public RankedTreeBase, public alib::Components < PostfixRankedTree < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPostfixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPostfixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); public: explicit PostfixRankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -129,10 +129,10 @@ PostfixRankedTree < SymbolType, RankType >::PostfixRankedTree ( const RankedTree } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PostfixRankedTree < SymbolType, RankType >::toPostfixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PostfixRankedTree < SymbolType, RankType >::toPostfixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_postfix_iterator iter = tree.postfix_begin ( ); iter != tree.postfix_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_postfix_iterator iter = tree.postfix_begin ( ); iter != tree.postfix_end ( ); ++iter ) res.push_back ( * iter ); return res; diff --git a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h index 6d6d43607b..b3e524d68d 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarNonlinearPattern.h @@ -48,7 +48,7 @@ template < class SymbolType, class RankType > class PrefixRankedBarNonlinearPattern final : public RankedTreeBase, public alib::Components < PrefixRankedBarNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, NonlinearAlphabet, BarSymbols >, std::tuple < SubtreeWildcard, VariablesBarSymbol > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRankedBar ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRankedBar ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ); public: explicit PrefixRankedBarNonlinearPattern ( std::set < common::ranked_symbol < SymbolType, RankType > > bars, common::ranked_symbol < SymbolType, RankType > variablesBar, common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -197,10 +197,10 @@ PrefixRankedBarNonlinearPattern < SymbolType, RankType >::PrefixRankedBarNonline } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedBarNonlinearPattern < SymbolType, RankType >::toPrefixRankedBar ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedBarNonlinearPattern < SymbolType, RankType >::toPrefixRankedBar ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const std::set < common::ranked_symbol < SymbolType, RankType > > & nonlinearVariables, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) if ( iter.getVirtual ( ) ) if ( ( * iter == subtreeWildcard ) || nonlinearVariables.count ( * iter ) ) res.push_back ( variablesBar ); diff --git a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h index 8bf320a2a5..13f4d1ea50 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarPattern.h @@ -47,7 +47,7 @@ template < class SymbolType, class RankType > class PrefixRankedBarPattern final : public RankedTreeBase, public alib::Components < PrefixRankedBarPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, BarSymbols >, std::tuple < SubtreeWildcard, VariablesBarSymbol > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRankedBar ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRankedBar ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ); public: explicit PrefixRankedBarPattern ( std::set < common::ranked_symbol < SymbolType, RankType > > bar, common::ranked_symbol < SymbolType, RankType > variablesBar, common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -162,10 +162,10 @@ PrefixRankedBarPattern < SymbolType, RankType >::PrefixRankedBarPattern ( const } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedBarPattern < SymbolType, RankType >::toPrefixRankedBar ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedBarPattern < SymbolType, RankType >::toPrefixRankedBar ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const SymbolType & barBase, const common::ranked_symbol < SymbolType, RankType > & variablesBar ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) if ( iter.getVirtual ( ) ) if ( ( * iter == subtreeWildcard ) ) res.push_back ( variablesBar ); diff --git a/alib2data/src/tree/ranked/PrefixRankedBarTree.h b/alib2data/src/tree/ranked/PrefixRankedBarTree.h index debdf9af54..c44f533e92 100644 --- a/alib2data/src/tree/ranked/PrefixRankedBarTree.h +++ b/alib2data/src/tree/ranked/PrefixRankedBarTree.h @@ -43,7 +43,7 @@ template < class SymbolType, class RankType > class PrefixRankedBarTree final : public RankedTreeBase, public alib::Components < PrefixRankedBarTree < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, BarSymbols >, std::tuple < > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRankedBar ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & node, const SymbolType & barBase ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRankedBar ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node, const SymbolType & barBase ); public: explicit PrefixRankedBarTree ( std::set < common::ranked_symbol < SymbolType, RankType > > bars, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -142,10 +142,10 @@ PrefixRankedBarTree < SymbolType, RankType >::PrefixRankedBarTree ( const Ranked } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedBarTree < SymbolType, RankType >::toPrefixRankedBar ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree, const SymbolType & barBase ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedBarTree < SymbolType, RankType >::toPrefixRankedBar ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree, const SymbolType & barBase ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) if ( iter.getVirtual ( ) ) res.push_back ( common::ranked_symbol < SymbolType, RankType > ( barBase, iter->getRank ( ) ) ); else diff --git a/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h b/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h index e083182af1..d6773fe55c 100644 --- a/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedNonlinearPattern.h @@ -43,7 +43,7 @@ template < class SymbolType, class RankType > class PrefixRankedNonlinearPattern final : public RankedTreeBase, public alib::Components < PrefixRankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); public: explicit PrefixRankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -171,10 +171,10 @@ PrefixRankedNonlinearPattern < SymbolType, RankType >::PrefixRankedNonlinearPatt } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedNonlinearPattern < SymbolType, RankType >::toPrefixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedNonlinearPattern < SymbolType, RankType >::toPrefixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_prefix_iterator iter = tree.prefix_begin ( ); iter != tree.prefix_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_prefix_iterator iter = tree.prefix_begin ( ); iter != tree.prefix_end ( ); ++iter ) res.push_back ( * iter ); return res; diff --git a/alib2data/src/tree/ranked/PrefixRankedPattern.h b/alib2data/src/tree/ranked/PrefixRankedPattern.h index 14c845f87d..322b8619e1 100644 --- a/alib2data/src/tree/ranked/PrefixRankedPattern.h +++ b/alib2data/src/tree/ranked/PrefixRankedPattern.h @@ -42,7 +42,7 @@ template < class SymbolType, class RankType > class PrefixRankedPattern final : public RankedTreeBase, public alib::Components < PrefixRankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); public: explicit PrefixRankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -142,10 +142,10 @@ PrefixRankedPattern < SymbolType, RankType >::PrefixRankedPattern ( const Ranked } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedPattern < SymbolType, RankType >::toPrefixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedPattern < SymbolType, RankType >::toPrefixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_prefix_iterator iter = tree.prefix_begin ( ); iter != tree.prefix_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_prefix_iterator iter = tree.prefix_begin ( ); iter != tree.prefix_end ( ); ++iter ) res.push_back ( * iter ); return res; diff --git a/alib2data/src/tree/ranked/PrefixRankedTree.h b/alib2data/src/tree/ranked/PrefixRankedTree.h index eb1999e4a3..f9951379a9 100644 --- a/alib2data/src/tree/ranked/PrefixRankedTree.h +++ b/alib2data/src/tree/ranked/PrefixRankedTree.h @@ -39,7 +39,7 @@ template < class SymbolType, class RankType > class PrefixRankedTree final : public RankedTreeBase, public alib::Components < PrefixRankedTree < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < > > { std::vector < common::ranked_symbol < SymbolType, RankType > > m_Data; - static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); + static std::vector < common::ranked_symbol < SymbolType, RankType > > toPrefixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ); public: explicit PrefixRankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::vector < common::ranked_symbol < SymbolType, RankType > > data ); @@ -128,10 +128,10 @@ PrefixRankedTree < SymbolType, RankType >::PrefixRankedTree ( const RankedTree < } template < class SymbolType, class RankType > -std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedTree < SymbolType, RankType >::toPrefixRanked ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { +std::vector < common::ranked_symbol < SymbolType, RankType > > PrefixRankedTree < SymbolType, RankType >::toPrefixRanked ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & tree ) { std::vector < common::ranked_symbol < SymbolType, RankType > > res; - for ( typename std::tree < common::ranked_symbol < SymbolType, RankType > >::const_prefix_iterator iter = tree.prefix_begin ( ); iter != tree.prefix_end ( ); ++iter ) + for ( typename ext::tree < common::ranked_symbol < SymbolType, RankType > >::const_prefix_iterator iter = tree.prefix_begin ( ); iter != tree.prefix_end ( ); ++iter ) res.push_back ( * iter ); return res; diff --git a/alib2data/src/tree/ranked/RankedNonlinearPattern.h b/alib2data/src/tree/ranked/RankedNonlinearPattern.h index 09f779667d..31d935333d 100644 --- a/alib2data/src/tree/ranked/RankedNonlinearPattern.h +++ b/alib2data/src/tree/ranked/RankedNonlinearPattern.h @@ -40,32 +40,32 @@ class NonlinearAlphabet; */ template < class SymbolType, class RankType > class RankedNonlinearPattern final : public RankedTreeBase, public alib::Components < RankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > { - std::tree < common::ranked_symbol < SymbolType, RankType > > m_content; + ext::tree < common::ranked_symbol < SymbolType, RankType > > m_content; - void checkAlphabet ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const; + void checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const; - void checkArities ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const; + void checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const; public: /** - * @copydoc std::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const + * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const */ virtual RankedTreeBase * clone ( ) const; /** - * @copydoc std::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const + * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const */ virtual RankedTreeBase * plunder ( ) &&; - explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); - explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); - explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + explicit RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); explicit RankedNonlinearPattern ( const UnrankedNonlinearPattern < SymbolType > & other ); /** * @return Root node of the regular expression pattern */ - const std::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const; + const ext::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const; const std::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const { return this->template accessComponent < GeneralAlphabet > ( ).get ( ); @@ -87,7 +87,7 @@ public: * Sets the root node of the regular expression pattern * @param pattern root node to set */ - void setTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + void setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); /** * Prints XML representation of the pattern to the output stream. @@ -129,7 +129,7 @@ public: common::ranked_symbol < DefaultSymbolType, DefaultRankType > wildcard = alphabet::SymbolNormalize::normalizeRankedSymbol ( std::move ( this->template accessElement < SubtreeWildcard > ( ).get ( ) ) ); std::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > nonlinearAlphabet = alphabet::SymbolNormalize::normalizeRankedAlphabet ( std::move ( this->template accessComponent < NonlinearAlphabet > ( ).get ( ) ) ); std::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > alphabet = alphabet::SymbolNormalize::normalizeRankedAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > content = TreeNormalize::normalizeRankedTree ( std::move ( m_content ) ); + ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > content = TreeNormalize::normalizeRankedTree ( std::move ( m_content ) ); return new RankedNonlinearPattern < > ( std::move ( wildcard ), std::move ( nonlinearAlphabet ), std::move ( alphabet ), std::move ( content ) ); } @@ -142,17 +142,17 @@ public: namespace tree { template < class SymbolType, class RankType > -RankedNonlinearPattern < SymbolType, RankType >::RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : alib::Components < RankedNonlinearPattern, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ), std::move ( nonlinearVariables ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { +RankedNonlinearPattern < SymbolType, RankType >::RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : alib::Components < RankedNonlinearPattern, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ), std::move ( nonlinearVariables ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { checkAlphabet ( m_content ); checkArities ( m_content ); } template < class SymbolType, class RankType > -RankedNonlinearPattern < SymbolType, RankType >::RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : RankedNonlinearPattern ( subtreeWildcard, nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + nonlinearVariables + std::set < common::ranked_symbol < SymbolType, RankType > > { subtreeWildcard }, pattern ) { +RankedNonlinearPattern < SymbolType, RankType >::RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : RankedNonlinearPattern ( subtreeWildcard, nonlinearVariables, std::set < common::ranked_symbol < SymbolType, RankType > > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + nonlinearVariables + std::set < common::ranked_symbol < SymbolType, RankType > > { subtreeWildcard }, pattern ) { } template < class SymbolType, class RankType > -RankedNonlinearPattern < SymbolType, RankType >::RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : RankedNonlinearPattern ( subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > { }, pattern ) { +RankedNonlinearPattern < SymbolType, RankType >::RankedNonlinearPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : RankedNonlinearPattern ( subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > { }, pattern ) { } template < class SymbolType, class RankType > @@ -170,12 +170,12 @@ RankedTreeBase * RankedNonlinearPattern < SymbolType, RankType >::plunder ( ) && } template < class SymbolType, class RankType > -const std::tree < common::ranked_symbol < SymbolType, RankType > > & RankedNonlinearPattern < SymbolType, RankType >::getContent ( ) const { +const ext::tree < common::ranked_symbol < SymbolType, RankType > > & RankedNonlinearPattern < SymbolType, RankType >::getContent ( ) const { return m_content; } template < class SymbolType, class RankType > -void RankedNonlinearPattern < SymbolType, RankType >::checkAlphabet ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { +void RankedNonlinearPattern < SymbolType, RankType >::checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { std::set < common::ranked_symbol < SymbolType, RankType > > minimalAlphabet ( data.prefix_begin ( ), data.prefix_end ( ) ); std::set < common::ranked_symbol < SymbolType, RankType > > unknownSymbols; std::set_difference ( minimalAlphabet.begin ( ), minimalAlphabet.end ( ), getAlphabet().begin ( ), getAlphabet().end ( ), std::inserter ( unknownSymbols, unknownSymbols.end ( ) ) ); @@ -185,16 +185,16 @@ void RankedNonlinearPattern < SymbolType, RankType >::checkAlphabet ( const std: } template < class SymbolType, class RankType > -void RankedNonlinearPattern < SymbolType, RankType >::checkArities ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { +void RankedNonlinearPattern < SymbolType, RankType >::checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { if ( ( size_t ) data.getData ( ).getRank ( ) != data.getChildren ( ).size ( ) ) throw exception::CommonException ( "Invalid rank." ); - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : data ) + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : data ) checkArities ( child ); } template < class SymbolType, class RankType > -void RankedNonlinearPattern < SymbolType, RankType >::setTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) { +void RankedNonlinearPattern < SymbolType, RankType >::setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) { checkAlphabet ( pattern ); checkArities ( pattern ); @@ -234,7 +234,7 @@ RankedNonlinearPattern < SymbolType, RankType > RankedNonlinearPattern < SymbolT common::ranked_symbol < SymbolType, RankType > subtreeWildcardSymbol = TreeFromXMLParser::parseSubtreeWildcardSymbol < common::ranked_symbol < SymbolType, RankType > > ( input ); std::set < common::ranked_symbol < SymbolType, RankType > > nonlinearVariables = TreeFromXMLParser::parseNonlinearVariables < common::ranked_symbol < SymbolType, RankType > > ( input ); std::set < common::ranked_symbol < SymbolType, RankType > > rankedAlphabet = TreeFromXMLParser::parseAlphabet < common::ranked_symbol < SymbolType, RankType > > ( input ); - std::tree < common::ranked_symbol < SymbolType, RankType > > root = TreeFromXMLParser::parseTreeContent < common::ranked_symbol < SymbolType, RankType > > ( input ); + ext::tree < common::ranked_symbol < SymbolType, RankType > > root = TreeFromXMLParser::parseTreeContent < common::ranked_symbol < SymbolType, RankType > > ( input ); RankedNonlinearPattern < SymbolType, RankType > tree ( std::move ( subtreeWildcardSymbol ), std::move ( nonlinearVariables ), std::move ( rankedAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, RankedNonlinearPattern::getXmlTagName() ); @@ -264,7 +264,7 @@ template < class SymbolType, class RankType > class ComponentConstraint< ::tree::RankedNonlinearPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, ::tree::GeneralAlphabet > { public: static bool used ( const ::tree::RankedNonlinearPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) { - const std::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( ); + const ext::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( ); return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end() || pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol || pattern.template accessComponent < ::tree::NonlinearAlphabet > ( ).get ( ).count ( symbol ); } diff --git a/alib2data/src/tree/ranked/RankedPattern.h b/alib2data/src/tree/ranked/RankedPattern.h index 1d8a5c7749..b648c2113a 100644 --- a/alib2data/src/tree/ranked/RankedPattern.h +++ b/alib2data/src/tree/ranked/RankedPattern.h @@ -39,31 +39,31 @@ class SubtreeWildcard; */ template < class SymbolType, class RankType > class RankedPattern final : public RankedTreeBase, public alib::Components < RankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > { - std::tree < common::ranked_symbol < SymbolType, RankType > > m_content; + ext::tree < common::ranked_symbol < SymbolType, RankType > > m_content; - void checkAlphabet ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const; + void checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const; - void checkArities ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const; + void checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const; public: /** - * @copydoc std::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const + * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const */ virtual RankedTreeBase * clone ( ) const; /** - * @copydoc std::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const + * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const */ virtual RankedTreeBase * plunder ( ) &&; - explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); - explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + explicit RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); explicit RankedPattern ( const UnrankedPattern < SymbolType > & other ); /** * @return Root node of the regular expression pattern */ - const std::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const; + const ext::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const; const std::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const { return this->template accessComponent < GeneralAlphabet > ( ).get ( ); @@ -81,7 +81,7 @@ public: * Sets the root node of the regular expression pattern * @param pattern root node to set */ - void setTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); + void setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ); /** * Prints XML representation of the pattern to the output stream. @@ -122,7 +122,7 @@ public: common::ranked_symbol < DefaultSymbolType, DefaultRankType > wildcard = alphabet::SymbolNormalize::normalizeRankedSymbol ( std::move ( this->template accessElement < SubtreeWildcard > ( ).get ( ) ) ); std::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > alphabet = alphabet::SymbolNormalize::normalizeRankedAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > content = TreeNormalize::normalizeRankedTree ( std::move ( m_content ) ); + ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > content = TreeNormalize::normalizeRankedTree ( std::move ( m_content ) ); return new RankedPattern < > ( std::move ( wildcard ), std::move ( alphabet ), std::move ( content ) ); } @@ -135,13 +135,13 @@ public: namespace tree { template < class SymbolType, class RankType > -RankedPattern < SymbolType, RankType >::RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : alib::Components < RankedPattern, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { +RankedPattern < SymbolType, RankType >::RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : alib::Components < RankedPattern, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { checkAlphabet ( m_content ); checkArities ( m_content ); } template < class SymbolType, class RankType > -RankedPattern < SymbolType, RankType >::RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : RankedPattern ( subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + std::set < common::ranked_symbol < SymbolType, RankType > > { subtreeWildcard }, pattern ) { +RankedPattern < SymbolType, RankType >::RankedPattern ( common::ranked_symbol < SymbolType, RankType > subtreeWildcard, ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) : RankedPattern ( subtreeWildcard, std::set < common::ranked_symbol < SymbolType, RankType > > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + std::set < common::ranked_symbol < SymbolType, RankType > > { subtreeWildcard }, pattern ) { } template < class SymbolType, class RankType > @@ -159,12 +159,12 @@ RankedTreeBase * RankedPattern < SymbolType, RankType >::plunder ( ) && { } template < class SymbolType, class RankType > -const std::tree < common::ranked_symbol < SymbolType, RankType > > & RankedPattern < SymbolType, RankType >::getContent ( ) const { +const ext::tree < common::ranked_symbol < SymbolType, RankType > > & RankedPattern < SymbolType, RankType >::getContent ( ) const { return m_content; } template < class SymbolType, class RankType > -void RankedPattern < SymbolType, RankType >::checkAlphabet ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { +void RankedPattern < SymbolType, RankType >::checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { std::set < common::ranked_symbol < SymbolType, RankType > > minimalAlphabet ( data.prefix_begin ( ), data.prefix_end ( ) ); std::set < common::ranked_symbol < SymbolType, RankType > > unknownSymbols; std::set_difference ( minimalAlphabet.begin ( ), minimalAlphabet.end ( ), getAlphabet().begin ( ), getAlphabet().end ( ), std::inserter ( unknownSymbols, unknownSymbols.end ( ) ) ); @@ -174,16 +174,16 @@ void RankedPattern < SymbolType, RankType >::checkAlphabet ( const std::tree < c } template < class SymbolType, class RankType > -void RankedPattern < SymbolType, RankType >::checkArities ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { +void RankedPattern < SymbolType, RankType >::checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { if ( ( size_t ) data.getData ( ).getRank ( ) != data.getChildren ( ).size ( ) ) throw exception::CommonException ( "Invalid rank." ); - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : data ) + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : data ) checkArities ( child ); } template < class SymbolType, class RankType > -void RankedPattern < SymbolType, RankType >::setTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) { +void RankedPattern < SymbolType, RankType >::setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > pattern ) { checkAlphabet ( pattern ); checkArities ( pattern ); @@ -222,7 +222,7 @@ RankedPattern < SymbolType, RankType > RankedPattern < SymbolType, RankType >::p sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, RankedPattern::getXmlTagName() ); common::ranked_symbol < SymbolType, RankType > subtreeWildcardSymbol = TreeFromXMLParser::parseSubtreeWildcardSymbol < common::ranked_symbol < SymbolType, RankType > > ( input ); std::set < common::ranked_symbol < SymbolType, RankType > > rankedAlphabet = TreeFromXMLParser::parseAlphabet < common::ranked_symbol < SymbolType, RankType > > ( input ); - std::tree < common::ranked_symbol < SymbolType, RankType > > root = TreeFromXMLParser::parseTreeContent < common::ranked_symbol < SymbolType, RankType > > ( input ); + ext::tree < common::ranked_symbol < SymbolType, RankType > > root = TreeFromXMLParser::parseTreeContent < common::ranked_symbol < SymbolType, RankType > > ( input ); RankedPattern < SymbolType, RankType > tree ( std::move ( subtreeWildcardSymbol ), std::move ( rankedAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, RankedPattern::getXmlTagName() ); @@ -251,7 +251,7 @@ template < class SymbolType, class RankType > class ComponentConstraint< ::tree::RankedPattern < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, ::tree::GeneralAlphabet > { public: static bool used ( const ::tree::RankedPattern < SymbolType, RankType > & pattern, const common::ranked_symbol < SymbolType, RankType > & symbol ) { - const std::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( ); + const ext::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = pattern.getContent ( ); return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end() || pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol; } diff --git a/alib2data/src/tree/ranked/RankedTree.h b/alib2data/src/tree/ranked/RankedTree.h index a483fcbd93..b026b9997d 100644 --- a/alib2data/src/tree/ranked/RankedTree.h +++ b/alib2data/src/tree/ranked/RankedTree.h @@ -39,32 +39,32 @@ class GeneralAlphabet; */ template < class SymbolType, class RankType > class RankedTree final : public RankedTreeBase, public alib::Components < RankedTree < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < > > { - std::tree < common::ranked_symbol < SymbolType, RankType > > m_content; + ext::tree < common::ranked_symbol < SymbolType, RankType > > m_content; - void checkAlphabet ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const; + void checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & pattern ) const; - void checkArities ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const; + void checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const; public: /** - * @copydoc std::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const + * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::clone() const */ virtual RankedTreeBase * clone ( ) const; /** - * @copydoc std::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const + * @copydoc ext::tree < common::ranked_symbol < SymbolType, RankType > >::plunder() const */ virtual RankedTreeBase * plunder ( ) &&; - explicit RankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::tree < common::ranked_symbol < SymbolType, RankType > > tree ); - explicit RankedTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > tree ); + explicit RankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > tree ); + explicit RankedTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > tree ); explicit RankedTree ( const UnrankedTree < SymbolType > & other ); explicit RankedTree ( const PostfixRankedTree < SymbolType, RankType > & other ); /** * @return Root node of the regular expression tree */ - const std::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const; + const ext::tree < common::ranked_symbol < SymbolType, RankType > > & getContent ( ) const; const std::set < common::ranked_symbol < SymbolType, RankType > > & getAlphabet ( ) const { return this->template accessComponent < GeneralAlphabet > ( ).get ( ); @@ -78,7 +78,7 @@ public: * Sets the root node of the regular expression tree * @param tree root node to set */ - void setTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > tree ); + void setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > tree ); /** * Prints XML representation of the tree to the output stream. @@ -118,7 +118,7 @@ public: return this; std::set < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > alphabet = alphabet::SymbolNormalize::normalizeRankedAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > content = TreeNormalize::normalizeRankedTree ( std::move ( m_content ) ); + ext::tree < common::ranked_symbol < DefaultSymbolType, DefaultRankType > > content = TreeNormalize::normalizeRankedTree ( std::move ( m_content ) ); return new RankedTree < > ( std::move ( alphabet ), std::move ( content ) ); } @@ -132,13 +132,13 @@ public: namespace tree { template < class SymbolType, class RankType > -RankedTree < SymbolType, RankType >::RankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, std::tree < common::ranked_symbol < SymbolType, RankType > > tree ) : alib::Components < RankedTree, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_content ( std::move ( tree ) ) { +RankedTree < SymbolType, RankType >::RankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > alphabet, ext::tree < common::ranked_symbol < SymbolType, RankType > > tree ) : alib::Components < RankedTree, common::ranked_symbol < SymbolType, RankType >, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_content ( std::move ( tree ) ) { checkAlphabet ( m_content ); checkArities ( m_content ); } template < class SymbolType, class RankType > -RankedTree < SymbolType, RankType >::RankedTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > tree ) : RankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > ( tree.prefix_begin ( ), tree.prefix_end ( ) ), tree ) { +RankedTree < SymbolType, RankType >::RankedTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > tree ) : RankedTree ( std::set < common::ranked_symbol < SymbolType, RankType > > ( tree.prefix_begin ( ), tree.prefix_end ( ) ), tree ) { } template < class SymbolType, class RankType > @@ -160,12 +160,12 @@ RankedTreeBase * RankedTree < SymbolType, RankType >::plunder ( ) && { } template < class SymbolType, class RankType > -const std::tree < common::ranked_symbol < SymbolType, RankType > > & RankedTree < SymbolType, RankType >::getContent ( ) const { +const ext::tree < common::ranked_symbol < SymbolType, RankType > > & RankedTree < SymbolType, RankType >::getContent ( ) const { return m_content; } template < class SymbolType, class RankType > -void RankedTree < SymbolType, RankType >::checkAlphabet ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { +void RankedTree < SymbolType, RankType >::checkAlphabet ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { std::set < common::ranked_symbol < SymbolType, RankType > > minimalAlphabet ( data.prefix_begin ( ), data.prefix_end ( ) ); std::set < common::ranked_symbol < SymbolType, RankType > > unknownSymbols; std::set_difference ( minimalAlphabet.begin ( ), minimalAlphabet.end ( ), getAlphabet().begin ( ), getAlphabet().end ( ), std::inserter ( unknownSymbols, unknownSymbols.end ( ) ) ); @@ -175,16 +175,16 @@ void RankedTree < SymbolType, RankType >::checkAlphabet ( const std::tree < comm } template < class SymbolType, class RankType > -void RankedTree < SymbolType, RankType >::checkArities ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { +void RankedTree < SymbolType, RankType >::checkArities ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & data ) const { if ( ( size_t ) data.getData ( ).getRank ( ) != data.getChildren ( ).size ( ) ) throw exception::CommonException ( "Invalid rank." ); - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : data ) + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : data ) checkArities ( child ); } template < class SymbolType, class RankType > -void RankedTree < SymbolType, RankType >::setTree ( std::tree < common::ranked_symbol < SymbolType, RankType > > tree ) { +void RankedTree < SymbolType, RankType >::setTree ( ext::tree < common::ranked_symbol < SymbolType, RankType > > tree ) { checkAlphabet ( tree ); checkArities ( tree ); @@ -222,7 +222,7 @@ template < class SymbolType, class RankType > RankedTree < SymbolType, RankType > RankedTree < SymbolType, RankType >::parse ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, RankedTree::getXmlTagName() ); std::set < common::ranked_symbol < SymbolType, RankType > > rankedAlphabet = TreeFromXMLParser::parseAlphabet < common::ranked_symbol < SymbolType, RankType > > ( input ); - std::tree < common::ranked_symbol < SymbolType, RankType > > root = TreeFromXMLParser::parseTreeContent < common::ranked_symbol < SymbolType, RankType > > ( input ); + ext::tree < common::ranked_symbol < SymbolType, RankType > > root = TreeFromXMLParser::parseTreeContent < common::ranked_symbol < SymbolType, RankType > > ( input ); RankedTree < SymbolType, RankType > tree ( std::move ( rankedAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, RankedTree::getXmlTagName() ); @@ -250,7 +250,7 @@ template < class SymbolType, class RankType > class ComponentConstraint< ::tree::RankedTree < SymbolType, RankType >, common::ranked_symbol < SymbolType, RankType >, ::tree::GeneralAlphabet > { public: static bool used ( const ::tree::RankedTree < SymbolType, RankType > & tree, const common::ranked_symbol < SymbolType, RankType > & symbol ) { - const std::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = tree.getContent ( ); + const ext::tree < common::ranked_symbol < SymbolType, RankType > > & m_content = tree.getContent ( ); return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end(); } diff --git a/alib2data/src/tree/unranked/PrefixBarTree.h b/alib2data/src/tree/unranked/PrefixBarTree.h index 2a63aeb111..d9fb841983 100644 --- a/alib2data/src/tree/unranked/PrefixBarTree.h +++ b/alib2data/src/tree/unranked/PrefixBarTree.h @@ -40,7 +40,7 @@ template < class SymbolType > class PrefixBarTree final : public UnrankedTreeBase, public alib::Components < PrefixBarTree < SymbolType >, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < BarSymbol > > { std::vector < SymbolType > m_Data; - static std::vector < SymbolType > toPrefixBar ( const std::tree < SymbolType > & tree, const SymbolType & bar ); + static std::vector < SymbolType > toPrefixBar ( const ext::tree < SymbolType > & tree, const SymbolType & bar ); public: explicit PrefixBarTree ( SymbolType bar, std::set < SymbolType > alphabet, std::vector < SymbolType > data ); @@ -139,10 +139,10 @@ PrefixBarTree < SymbolType >::PrefixBarTree ( const UnrankedTree < SymbolType > } template < class SymbolType > -std::vector < SymbolType > PrefixBarTree < SymbolType >::toPrefixBar ( const std::tree < SymbolType > & tree, const SymbolType & bar ) { +std::vector < SymbolType > PrefixBarTree < SymbolType >::toPrefixBar ( const ext::tree < SymbolType > & tree, const SymbolType & bar ) { std::vector < SymbolType > res; - for ( typename std::tree < SymbolType >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) + for ( typename ext::tree < SymbolType >::const_structure_iterator iter = tree.structure_begin ( ); iter != tree.structure_end ( ); ++iter ) if ( iter.getVirtual ( ) ) res.push_back ( bar ); else diff --git a/alib2data/src/tree/unranked/UnrankedNonlinearPattern.h b/alib2data/src/tree/unranked/UnrankedNonlinearPattern.h index 0445eee882..6a996c3dae 100644 --- a/alib2data/src/tree/unranked/UnrankedNonlinearPattern.h +++ b/alib2data/src/tree/unranked/UnrankedNonlinearPattern.h @@ -39,31 +39,31 @@ class NonlinearAlphabet; */ template < class SymbolType > class UnrankedNonlinearPattern final : public UnrankedTreeBase, public alib::Components < UnrankedNonlinearPattern < SymbolType >, SymbolType, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > { - std::tree < SymbolType > m_content; + ext::tree < SymbolType > m_content; - void checkAlphabet ( const std::tree < SymbolType > & pattern ) const; + void checkAlphabet ( const ext::tree < SymbolType > & pattern ) const; public: /** - * @copydoc std::tree < SymbolType >::clone() const + * @copydoc ext::tree < SymbolType >::clone() const */ virtual UnrankedTreeBase * clone ( ) const; /** - * @copydoc std::tree < SymbolType >::plunder() const + * @copydoc ext::tree < SymbolType >::plunder() const */ virtual UnrankedTreeBase * plunder ( ) &&; - explicit UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, std::set < SymbolType > alphabet, std::tree < SymbolType > pattern ); - explicit UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, std::tree < SymbolType > pattern ); - explicit UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::tree < SymbolType > pattern ); + explicit UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, std::set < SymbolType > alphabet, ext::tree < SymbolType > pattern ); + explicit UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, ext::tree < SymbolType > pattern ); + explicit UnrankedNonlinearPattern ( SymbolType subtreeWildcard, ext::tree < SymbolType > pattern ); template < class RankType > explicit UnrankedNonlinearPattern ( const RankedNonlinearPattern < SymbolType, RankType > & other ); /** * @return Content of the pattern */ - const std::tree < SymbolType > & getContent ( ) const; + const ext::tree < SymbolType > & getContent ( ) const; const std::set < SymbolType > & getAlphabet ( ) const { return this->template accessComponent < GeneralAlphabet > ( ).get ( ); @@ -85,7 +85,7 @@ public: * Sets the root node of the regular expression pattern * @param pattern root node to set */ - void setTree ( std::tree < SymbolType > pattern ); + void setTree ( ext::tree < SymbolType > pattern ); /** * Removes symbol from the alphabet of symbol available in the regular expression @@ -133,7 +133,7 @@ public: DefaultSymbolType wildcard = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( this->template accessElement < SubtreeWildcard > ( ).get ( ) ) ); std::set < DefaultSymbolType > nonlinearAlphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < NonlinearAlphabet > ( ).get ( ) ) ); std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::tree < DefaultSymbolType > content = TreeNormalize::normalizeTree ( std::move ( m_content ) ); + ext::tree < DefaultSymbolType > content = TreeNormalize::normalizeTree ( std::move ( m_content ) ); return new UnrankedNonlinearPattern < > ( std::move ( wildcard ), std::move ( nonlinearAlphabet ), std::move ( alphabet ), std::move ( content ) ); } @@ -146,16 +146,16 @@ public: namespace tree { template < class SymbolType > -UnrankedNonlinearPattern < SymbolType >::UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, std::set < SymbolType > alphabet, std::tree < SymbolType > pattern ) : alib::Components < UnrankedNonlinearPattern, SymbolType, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ), std::move ( nonlinearVariables ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { +UnrankedNonlinearPattern < SymbolType >::UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, std::set < SymbolType > alphabet, ext::tree < SymbolType > pattern ) : alib::Components < UnrankedNonlinearPattern, SymbolType, std::tuple < GeneralAlphabet, NonlinearAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ), std::move ( nonlinearVariables ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { checkAlphabet ( m_content ); } template < class SymbolType > -UnrankedNonlinearPattern < SymbolType >::UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, std::tree < SymbolType > pattern ) : UnrankedNonlinearPattern ( subtreeWildcard, nonlinearVariables, std::set < SymbolType > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + nonlinearVariables + std::set < SymbolType > { subtreeWildcard }, pattern ) { +UnrankedNonlinearPattern < SymbolType >::UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::set < SymbolType > nonlinearVariables, ext::tree < SymbolType > pattern ) : UnrankedNonlinearPattern ( subtreeWildcard, nonlinearVariables, std::set < SymbolType > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + nonlinearVariables + std::set < SymbolType > { subtreeWildcard }, pattern ) { } template < class SymbolType > -UnrankedNonlinearPattern < SymbolType >::UnrankedNonlinearPattern ( SymbolType subtreeWildcard, std::tree < SymbolType > pattern ) : UnrankedNonlinearPattern ( subtreeWildcard, std::set < SymbolType > { }, pattern ) { +UnrankedNonlinearPattern < SymbolType >::UnrankedNonlinearPattern ( SymbolType subtreeWildcard, ext::tree < SymbolType > pattern ) : UnrankedNonlinearPattern ( subtreeWildcard, std::set < SymbolType > { }, pattern ) { } template < class SymbolType > @@ -174,12 +174,12 @@ UnrankedTreeBase * UnrankedNonlinearPattern < SymbolType >::plunder ( ) && { } template < class SymbolType > -const std::tree < SymbolType > & UnrankedNonlinearPattern < SymbolType >::getContent ( ) const { +const ext::tree < SymbolType > & UnrankedNonlinearPattern < SymbolType >::getContent ( ) const { return m_content; } template < class SymbolType > -void UnrankedNonlinearPattern < SymbolType >::checkAlphabet ( const std::tree < SymbolType > & data ) const { +void UnrankedNonlinearPattern < SymbolType >::checkAlphabet ( const ext::tree < SymbolType > & data ) const { std::set < SymbolType > minimalAlphabet ( data.prefix_begin ( ), data.prefix_end ( ) ); std::set < SymbolType > unknownSymbols; std::set_difference ( minimalAlphabet.begin ( ), minimalAlphabet.end ( ), getAlphabet().begin ( ), getAlphabet().end ( ), std::inserter ( unknownSymbols, unknownSymbols.end ( ) ) ); @@ -189,7 +189,7 @@ void UnrankedNonlinearPattern < SymbolType >::checkAlphabet ( const std::tree < } template < class SymbolType > -void UnrankedNonlinearPattern < SymbolType >::setTree ( std::tree < SymbolType > pattern ) { +void UnrankedNonlinearPattern < SymbolType >::setTree ( ext::tree < SymbolType > pattern ) { checkAlphabet ( pattern ); this->m_content = std::move ( pattern ); @@ -228,7 +228,7 @@ UnrankedNonlinearPattern < SymbolType > UnrankedNonlinearPattern < SymbolType >: SymbolType subtreeWildcardSymbol = TreeFromXMLParser::parseSubtreeWildcardSymbol < SymbolType > ( input ); std::set < SymbolType > nonlinearVariables = TreeFromXMLParser::parseNonlinearVariables < SymbolType > ( input ); std::set < SymbolType > rankedAlphabet = TreeFromXMLParser::parseAlphabet < SymbolType > ( input ); - std::tree < SymbolType > root = TreeFromXMLParser::parseTreeContent < SymbolType > ( input ); + ext::tree < SymbolType > root = TreeFromXMLParser::parseTreeContent < SymbolType > ( input ); UnrankedNonlinearPattern < SymbolType > tree ( std::move ( subtreeWildcardSymbol ), std::move ( nonlinearVariables ), std::move ( rankedAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, UnrankedNonlinearPattern::getXmlTagName() ); @@ -258,7 +258,7 @@ template < class SymbolType > class ComponentConstraint< ::tree::UnrankedNonlinearPattern < SymbolType >, SymbolType, ::tree::GeneralAlphabet > { public: static bool used ( const ::tree::UnrankedNonlinearPattern < SymbolType > & pattern, const SymbolType & symbol ) { - const std::tree<SymbolType>& m_content = pattern.getContent ( ); + const ext::tree<SymbolType>& m_content = pattern.getContent ( ); return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end() || pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol || pattern.template accessComponent < ::tree::NonlinearAlphabet > ( ).get ( ).count ( symbol ); } diff --git a/alib2data/src/tree/unranked/UnrankedPattern.h b/alib2data/src/tree/unranked/UnrankedPattern.h index ad6e0cd3f4..f3cfc2e243 100644 --- a/alib2data/src/tree/unranked/UnrankedPattern.h +++ b/alib2data/src/tree/unranked/UnrankedPattern.h @@ -38,9 +38,9 @@ class SubtreeWildcard; */ template < class SymbolType > class UnrankedPattern final : public UnrankedTreeBase, public alib::Components < UnrankedPattern < SymbolType >, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > { - std::tree < SymbolType > m_content; + ext::tree < SymbolType > m_content; - void checkAlphabet ( const std::tree < SymbolType > & pattern ) const; + void checkAlphabet ( const ext::tree < SymbolType > & pattern ) const; public: /** @@ -53,15 +53,15 @@ public: */ virtual UnrankedTreeBase * plunder ( ) &&; - explicit UnrankedPattern ( SymbolType subtreeWildcard, std::set < SymbolType > alphabet, std::tree < SymbolType > pattern ); - explicit UnrankedPattern ( SymbolType subtreeWildcard, std::tree < SymbolType > pattern ); + explicit UnrankedPattern ( SymbolType subtreeWildcard, std::set < SymbolType > alphabet, ext::tree < SymbolType > pattern ); + explicit UnrankedPattern ( SymbolType subtreeWildcard, ext::tree < SymbolType > pattern ); template < class RankType > explicit UnrankedPattern ( const RankedPattern < SymbolType, RankType > & other ); /** * @return Content of the pattern */ - const std::tree < SymbolType > & getContent ( ) const; + const ext::tree < SymbolType > & getContent ( ) const; virtual const std::set < SymbolType > & getAlphabet ( ) const { return this->template accessComponent < GeneralAlphabet > ( ).get ( ); @@ -79,7 +79,7 @@ public: * Sets the root node of the regular expression pattern * @param pattern root node to set */ - void setTree ( std::tree < SymbolType > pattern ); + void setTree ( ext::tree < SymbolType > pattern ); /** * Prints XML representation of the pattern to the output stream. @@ -120,7 +120,7 @@ public: DefaultSymbolType wildcard = alphabet::SymbolNormalize::normalizeSymbol ( std::move ( this->template accessElement < SubtreeWildcard > ( ).get ( ) ) ); std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::tree < DefaultSymbolType > content = TreeNormalize::normalizeTree ( std::move ( m_content ) ); + ext::tree < DefaultSymbolType > content = TreeNormalize::normalizeTree ( std::move ( m_content ) ); return new UnrankedPattern < > ( std::move ( wildcard ), std::move ( alphabet ), std::move ( content ) ); } @@ -133,12 +133,12 @@ public: namespace tree { template < class SymbolType > -UnrankedPattern < SymbolType >::UnrankedPattern ( SymbolType subtreeWildcard, std::set < SymbolType > alphabet, std::tree < SymbolType > pattern ) : alib::Components < UnrankedPattern, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { +UnrankedPattern < SymbolType >::UnrankedPattern ( SymbolType subtreeWildcard, std::set < SymbolType > alphabet, ext::tree < SymbolType > pattern ) : alib::Components < UnrankedPattern, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < SubtreeWildcard > > ( std::make_tuple ( std::move ( alphabet ) ), std::make_tuple ( std::move ( subtreeWildcard ) ) ), m_content ( std::move ( pattern ) ) { checkAlphabet ( m_content ); } template < class SymbolType > -UnrankedPattern < SymbolType >::UnrankedPattern ( SymbolType subtreeWildcard, std::tree < SymbolType > pattern ) : UnrankedPattern ( subtreeWildcard, std::set < SymbolType > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + std::set < SymbolType > { subtreeWildcard }, pattern ) { +UnrankedPattern < SymbolType >::UnrankedPattern ( SymbolType subtreeWildcard, ext::tree < SymbolType > pattern ) : UnrankedPattern ( subtreeWildcard, std::set < SymbolType > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ) + std::set < SymbolType > { subtreeWildcard }, pattern ) { } template < class SymbolType > @@ -157,12 +157,12 @@ UnrankedTreeBase * UnrankedPattern < SymbolType >::plunder ( ) && { } template < class SymbolType > -const std::tree < SymbolType > & UnrankedPattern < SymbolType >::getContent ( ) const { +const ext::tree < SymbolType > & UnrankedPattern < SymbolType >::getContent ( ) const { return m_content; } template < class SymbolType > -void UnrankedPattern < SymbolType >::checkAlphabet ( const std::tree < SymbolType > & data ) const { +void UnrankedPattern < SymbolType >::checkAlphabet ( const ext::tree < SymbolType > & data ) const { std::set < SymbolType > minimalAlphabet ( data.prefix_begin ( ), data.prefix_end ( ) ); std::set < SymbolType > unknownSymbols; std::set_difference ( minimalAlphabet.begin ( ), minimalAlphabet.end ( ), getAlphabet().begin ( ), getAlphabet().end ( ), std::inserter ( unknownSymbols, unknownSymbols.end ( ) ) ); @@ -172,7 +172,7 @@ void UnrankedPattern < SymbolType >::checkAlphabet ( const std::tree < SymbolTyp } template < class SymbolType > -void UnrankedPattern < SymbolType >::setTree ( std::tree < SymbolType > pattern ) { +void UnrankedPattern < SymbolType >::setTree ( ext::tree < SymbolType > pattern ) { checkAlphabet ( pattern ); this->m_content = std::move ( pattern ); @@ -210,7 +210,7 @@ UnrankedPattern < SymbolType > UnrankedPattern < SymbolType >::parse ( std::dequ sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, UnrankedPattern::getXmlTagName() ); SymbolType subtreeWildcardSymbol = TreeFromXMLParser::parseSubtreeWildcardSymbol < SymbolType > ( input ); std::set < SymbolType > rankedAlphabet = TreeFromXMLParser::parseAlphabet < SymbolType > ( input ); - std::tree < SymbolType > root = TreeFromXMLParser::parseTreeContent < SymbolType > ( input ); + ext::tree < SymbolType > root = TreeFromXMLParser::parseTreeContent < SymbolType > ( input ); UnrankedPattern < SymbolType > tree ( std::move ( subtreeWildcardSymbol ), std::move ( rankedAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, UnrankedPattern::getXmlTagName() ); @@ -239,7 +239,7 @@ template < class SymbolType > class ComponentConstraint< ::tree::UnrankedPattern < SymbolType >, SymbolType, ::tree::GeneralAlphabet > { public: static bool used ( const ::tree::UnrankedPattern < SymbolType > & pattern, const SymbolType & symbol ) { - const std::tree<SymbolType>& m_content = pattern.getContent ( ); + const ext::tree<SymbolType>& m_content = pattern.getContent ( ); return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end() || pattern.template accessElement < ::tree::SubtreeWildcard > ( ).get ( ) == symbol; } diff --git a/alib2data/src/tree/unranked/UnrankedTree.h b/alib2data/src/tree/unranked/UnrankedTree.h index 9a9d265365..e175d2db95 100644 --- a/alib2data/src/tree/unranked/UnrankedTree.h +++ b/alib2data/src/tree/unranked/UnrankedTree.h @@ -37,9 +37,9 @@ class GeneralAlphabet; */ template < class SymbolType > class UnrankedTree final : public UnrankedTreeBase, public alib::Components < UnrankedTree < SymbolType >, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > { - std::tree < SymbolType > m_content; + ext::tree < SymbolType > m_content; - void checkAlphabet ( const std::tree < SymbolType > & pattern ) const; + void checkAlphabet ( const ext::tree < SymbolType > & pattern ) const; public: /** @@ -52,8 +52,8 @@ public: */ virtual UnrankedTreeBase * plunder ( ) &&; - explicit UnrankedTree ( std::set < SymbolType > alphabet, std::tree < SymbolType > tree ); - explicit UnrankedTree ( std::tree < SymbolType > tree ); + explicit UnrankedTree ( std::set < SymbolType > alphabet, ext::tree < SymbolType > tree ); + explicit UnrankedTree ( ext::tree < SymbolType > tree ); template < class RankType > explicit UnrankedTree ( const RankedTree < SymbolType, RankType > & other ); @@ -68,13 +68,13 @@ public: /** * @return m_content of the tree */ - const std::tree < SymbolType > & getContent ( ) const; + const ext::tree < SymbolType > & getContent ( ) const; /** * Sets the root node of the regular expression tree * @param tree root node to set */ - void setTree ( std::tree < SymbolType > data ); + void setTree ( ext::tree < SymbolType > data ); /** * Prints XML representation of the tree to the output stream. @@ -114,7 +114,7 @@ public: return this; std::set < DefaultSymbolType > alphabet = alphabet::SymbolNormalize::normalizeAlphabet ( std::move ( this->template accessComponent < GeneralAlphabet > ( ).get ( ) ) ); - std::tree < DefaultSymbolType > content = TreeNormalize::normalizeTree ( std::move ( m_content ) ); + ext::tree < DefaultSymbolType > content = TreeNormalize::normalizeTree ( std::move ( m_content ) ); return new UnrankedTree < > ( std::move ( alphabet ), std::move ( content ) ); } @@ -127,12 +127,12 @@ public: namespace tree { template < class SymbolType > -UnrankedTree < SymbolType >::UnrankedTree ( std::set < SymbolType > alphabet, std::tree < SymbolType > tree ) : alib::Components < UnrankedTree, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_content ( std::move ( tree ) ) { +UnrankedTree < SymbolType >::UnrankedTree ( std::set < SymbolType > alphabet, ext::tree < SymbolType > tree ) : alib::Components < UnrankedTree, SymbolType, std::tuple < GeneralAlphabet >, std::tuple < > > ( std::make_tuple ( std::move ( alphabet ) ), std::tuple < > ( ) ), m_content ( std::move ( tree ) ) { checkAlphabet ( m_content ); } template < class SymbolType > -UnrankedTree < SymbolType >::UnrankedTree ( std::tree < SymbolType > pattern ) : UnrankedTree ( std::set < SymbolType > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ), pattern ) { +UnrankedTree < SymbolType >::UnrankedTree ( ext::tree < SymbolType > pattern ) : UnrankedTree ( std::set < SymbolType > ( pattern.prefix_begin ( ), pattern.prefix_end ( ) ), pattern ) { } template < class SymbolType > @@ -151,12 +151,12 @@ UnrankedTreeBase * UnrankedTree < SymbolType >::plunder ( ) && { } template < class SymbolType > -const std::tree < SymbolType > & UnrankedTree < SymbolType >::getContent ( ) const { +const ext::tree < SymbolType > & UnrankedTree < SymbolType >::getContent ( ) const { return m_content; } template < class SymbolType > -void UnrankedTree < SymbolType >::checkAlphabet ( const std::tree < SymbolType > & data ) const { +void UnrankedTree < SymbolType >::checkAlphabet ( const ext::tree < SymbolType > & data ) const { std::set < SymbolType > minimalAlphabet ( data.prefix_begin ( ), data.prefix_end ( ) ); std::set < SymbolType > unknownSymbols; std::set_difference ( minimalAlphabet.begin ( ), minimalAlphabet.end ( ), getAlphabet().begin ( ), getAlphabet().end ( ), std::inserter ( unknownSymbols, unknownSymbols.end ( ) ) ); @@ -166,7 +166,7 @@ void UnrankedTree < SymbolType >::checkAlphabet ( const std::tree < SymbolType > } template < class SymbolType > -void UnrankedTree < SymbolType >::setTree ( std::tree < SymbolType > data ) { +void UnrankedTree < SymbolType >::setTree ( ext::tree < SymbolType > data ) { checkAlphabet ( data ); this->m_content = std::move ( data ); @@ -203,7 +203,7 @@ template < class SymbolType > UnrankedTree < SymbolType > UnrankedTree < SymbolType >::parse ( std::deque < sax::Token >::iterator & input ) { sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::START_ELEMENT, UnrankedTree::getXmlTagName() ); std::set < SymbolType > rankedAlphabet = TreeFromXMLParser::parseAlphabet < SymbolType > ( input ); - std::tree < SymbolType > root = TreeFromXMLParser::parseTreeContent < SymbolType > ( input ); + ext::tree < SymbolType > root = TreeFromXMLParser::parseTreeContent < SymbolType > ( input ); UnrankedTree < SymbolType > tree ( std::move ( rankedAlphabet ), std::move ( root ) ); sax::FromXMLParserHelper::popToken ( input, sax::Token::TokenType::END_ELEMENT, UnrankedTree::getXmlTagName() ); @@ -231,7 +231,7 @@ template < class SymbolType > class ComponentConstraint< ::tree::UnrankedTree < SymbolType >, SymbolType, ::tree::GeneralAlphabet > { public: static bool used ( const ::tree::UnrankedTree < SymbolType > & tree, const SymbolType & symbol ) { - const std::tree<SymbolType>& m_content = tree.getContent ( ); + const ext::tree<SymbolType>& m_content = tree.getContent ( ); return std::find(m_content.prefix_begin(), m_content.prefix_end(), symbol) != m_content.prefix_end(); } diff --git a/alib2data/test-src/tree/PatternTest.cpp b/alib2data/test-src/tree/PatternTest.cpp index 5b8d7167b3..ee50b2d07f 100644 --- a/alib2data/test-src/tree/PatternTest.cpp +++ b/alib2data/test-src/tree/PatternTest.cpp @@ -34,10 +34,10 @@ void PatternTest::testRankedPatternParser() { const common::ranked_symbol < > S (DefaultSymbolType { alphabet::SubtreeWildcardSymbol {} }, 0); const std::set<common::ranked_symbol < >> alphabet {a, b, c, S}; - std::tree < common::ranked_symbol < > > node3(c, {}); - std::tree < common::ranked_symbol < > > node4(S, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(c, {}); + ext::tree < common::ranked_symbol < > > node4(S, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); tree::RankedPattern < > tree(S, alphabet, std::move(node1)); @@ -64,10 +64,10 @@ void PatternTest::testRankedPatternParser() { const DefaultSymbolType uS { alphabet::SubtreeWildcardSymbol {} }; const std::set<DefaultSymbolType> ualphabet {ua, ub, uc, uS}; - std::tree < DefaultSymbolType > unode3(uc, {}); - std::tree < DefaultSymbolType > unode4(uS, {}); - std::tree < DefaultSymbolType > unode2(ub, {std::move(unode3)}); - std::tree < DefaultSymbolType > unode1(ua, {std::move(unode2), std::move(unode4)}); + ext::tree < DefaultSymbolType > unode3(uc, {}); + ext::tree < DefaultSymbolType > unode4(uS, {}); + ext::tree < DefaultSymbolType > unode2(ub, {std::move(unode3)}); + ext::tree < DefaultSymbolType > unode1(ua, {std::move(unode2), std::move(unode4)}); tree::UnrankedPattern < > tree2(uS, ualphabet, std::move(unode1)); @@ -84,10 +84,10 @@ void PatternTest::testUnrankedPatternParser() { const DefaultSymbolType S { alphabet::SubtreeWildcardSymbol {} }; const std::set<DefaultSymbolType> alphabet {a, b, c, S}; - std::tree < DefaultSymbolType > node3(c, {}); - std::tree < DefaultSymbolType > node4(S, {}); - std::tree < DefaultSymbolType > node2(b, {std::move(node3)}); - std::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < DefaultSymbolType > node3(c, {}); + ext::tree < DefaultSymbolType > node4(S, {}); + ext::tree < DefaultSymbolType > node2(b, {std::move(node3)}); + ext::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); tree::UnrankedPattern < > tree(S, alphabet, std::move(node1)); @@ -114,10 +114,10 @@ void PatternTest::testUnrankedPatternParser() { const common::ranked_symbol < > rS { DefaultSymbolType { alphabet::SubtreeWildcardSymbol {} }, 0}; const std::set<common::ranked_symbol < >> ralphabet {ra, rb, rc, rS}; - std::tree < common::ranked_symbol < > > rnode3(rc, {}); - std::tree < common::ranked_symbol < > > rnode4(rS, {}); - std::tree < common::ranked_symbol < > > rnode2(rb, {std::move(rnode3)}); - std::tree < common::ranked_symbol < > > rnode1(ra, {std::move(rnode2), std::move(rnode4)}); + ext::tree < common::ranked_symbol < > > rnode3(rc, {}); + ext::tree < common::ranked_symbol < > > rnode4(rS, {}); + ext::tree < common::ranked_symbol < > > rnode2(rb, {std::move(rnode3)}); + ext::tree < common::ranked_symbol < > > rnode1(ra, {std::move(rnode2), std::move(rnode4)}); tree::RankedPattern < > tree2(rS, ralphabet, std::move(rnode1)); @@ -134,10 +134,10 @@ void PatternTest::testPrefixRankedPatternParser() { const common::ranked_symbol < > S (DefaultSymbolType { alphabet::SubtreeWildcardSymbol {} }, 0); const std::set<common::ranked_symbol < >> alphabet {a, b, c, S}; - std::tree < common::ranked_symbol < > > node3(c, {}); - std::tree < common::ranked_symbol < > > node4(S, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(c, {}); + ext::tree < common::ranked_symbol < > > node4(S, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); tree::RankedPattern < > pattern(S, alphabet, std::move(node1)); tree::PrefixRankedPattern < > pattern2(pattern); @@ -165,10 +165,10 @@ void PatternTest::testPrefixRankedBarPatternParser() { const common::ranked_symbol < > S (DefaultSymbolType { alphabet::SubtreeWildcardSymbol {} }, 0); const std::set<common::ranked_symbol < >> alphabet {a, b, c, S}; - std::tree < common::ranked_symbol < > > node3(c, {}); - std::tree < common::ranked_symbol < > > node4(S, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(c, {}); + ext::tree < common::ranked_symbol < > > node4(S, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); tree::RankedPattern < > pattern(S, alphabet, std::move(node1)); tree::PrefixRankedBarPattern < > pattern2(alphabet::BarSymbol::instance < DefaultSymbolType > ( ), alphabet::VariablesBarSymbol::instance < common::ranked_symbol < DefaultSymbolType, primitive::Unsigned > > ( ), pattern); diff --git a/alib2data/test-src/tree/TreeTest.cpp b/alib2data/test-src/tree/TreeTest.cpp index 00db8b1a5b..64f171faa7 100644 --- a/alib2data/test-src/tree/TreeTest.cpp +++ b/alib2data/test-src/tree/TreeTest.cpp @@ -26,15 +26,15 @@ void TreeTest::setUp() { void TreeTest::tearDown() { } -std::tree < common::ranked_symbol < > > prefixToNode(const std::string & s, int & pos) { +ext::tree < common::ranked_symbol < > > prefixToNode(const std::string & s, int & pos) { char c = s[pos]; int r = s[pos+1] - '0'; pos += 2; - std::vector<std::tree < common::ranked_symbol < > >> children; + std::vector<ext::tree < common::ranked_symbol < > >> children; for (int i = 0; i < r; i++) { children.push_back(prefixToNode(s, pos)); } - return std::tree < common::ranked_symbol < > >(common::ranked_symbol < >(c, r), std::move(children)); + return ext::tree < common::ranked_symbol < > >(common::ranked_symbol < >(c, r), std::move(children)); } void TreeTest::testRankedTreeParser() { @@ -55,10 +55,10 @@ void TreeTest::testRankedTreeParser() { const std::set<common::ranked_symbol < >> alphabet {a, b, c}; - std::tree < common::ranked_symbol < > > node3(c, {}); - std::tree < common::ranked_symbol < > > node4(c, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(c, {}); + ext::tree < common::ranked_symbol < > > node4(c, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); tree::RankedTree < > tree(alphabet, std::move(node1)); @@ -80,7 +80,7 @@ void TreeTest::testRankedTreeParser() { std::string s = "a2a2a2b1a2c0c0c0c0c0"; int itmp = 0; - std::tree < common::ranked_symbol < > > node = prefixToNode(s, itmp); + ext::tree < common::ranked_symbol < > > node = prefixToNode(s, itmp); std::set<common::ranked_symbol < >> al; for (unsigned i = 0; i < s.length(); i += 2) al.insert(common::ranked_symbol < >(s[i], (int) (s[i+1] - '0'))); tree::RankedTree < > t(al, std::move(node)); @@ -115,15 +115,15 @@ void TreeTest::testRankedTreeCompare() { const std::set<common::ranked_symbol < >> alphabet {a, b, c}; - std::tree < common::ranked_symbol < > > node3(c, {}); - std::tree < common::ranked_symbol < > > node4(c, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(c, {}); + ext::tree < common::ranked_symbol < > > node4(c, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); - std::tree < common::ranked_symbol < > > node6(c, {}); - std::tree < common::ranked_symbol < > > node8(c, {}); - std::tree < common::ranked_symbol < > > node7(b, {std::move(node8)}); - std::tree < common::ranked_symbol < > > node5(a, {std::move(node6), std::move(node7)}); + ext::tree < common::ranked_symbol < > > node6(c, {}); + ext::tree < common::ranked_symbol < > > node8(c, {}); + ext::tree < common::ranked_symbol < > > node7(b, {std::move(node8)}); + ext::tree < common::ranked_symbol < > > node5(a, {std::move(node6), std::move(node7)}); tree::RankedTree < > tree1(alphabet, std::move(node1)); tree::RankedTree < > tree2(alphabet, std::move(node5)); @@ -143,17 +143,17 @@ void TreeTest::testRankedTreeSymbolValidityCheck() { const std::set<common::ranked_symbol < >> alphabet {a, b, c, e}; - std::tree < common::ranked_symbol < > > node3(d, {}); - std::tree < common::ranked_symbol < > > node4(c, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(d, {}); + ext::tree < common::ranked_symbol < > > node4(c, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); CPPUNIT_ASSERT_THROW(tree::RankedTree < > (alphabet, std::move(node1)), exception::CommonException); - std::tree < common::ranked_symbol < > > node6(e, {}); - std::tree < common::ranked_symbol < > > node8(c, {}); - std::tree < common::ranked_symbol < > > node7(b, {std::move(node8)}); - std::tree < common::ranked_symbol < > > node5(a, {std::move(node6), std::move(node7)}); + ext::tree < common::ranked_symbol < > > node6(e, {}); + ext::tree < common::ranked_symbol < > > node8(c, {}); + ext::tree < common::ranked_symbol < > > node7(b, {std::move(node8)}); + ext::tree < common::ranked_symbol < > > node5(a, {std::move(node6), std::move(node7)}); tree::RankedTree < > * tree = NULL; CPPUNIT_ASSERT_NO_THROW(tree = new tree::RankedTree < > (alphabet, std::move(node5))); @@ -179,10 +179,10 @@ void TreeTest::testUnrankedTreeParser() { const std::set<DefaultSymbolType> alphabet {a, b, c}; - std::tree < DefaultSymbolType > node3(c, {}); - std::tree < DefaultSymbolType > node4(c, {}); - std::tree < DefaultSymbolType > node2(b, {std::move(node3)}); - std::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < DefaultSymbolType > node3(c, {}); + ext::tree < DefaultSymbolType > node4(c, {}); + ext::tree < DefaultSymbolType > node2(b, {std::move(node3)}); + ext::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); tree::UnrankedTree < > tree(alphabet, std::move(node1)); @@ -230,15 +230,15 @@ void TreeTest::testUnrankedTreeCompare() { const std::set<DefaultSymbolType> alphabet {a, b, c}; - std::tree < DefaultSymbolType > node3(c, {}); - std::tree < DefaultSymbolType > node4(c, {}); - std::tree < DefaultSymbolType > node2(b, {std::move(node3)}); - std::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < DefaultSymbolType > node3(c, {}); + ext::tree < DefaultSymbolType > node4(c, {}); + ext::tree < DefaultSymbolType > node2(b, {std::move(node3)}); + ext::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); - std::tree < DefaultSymbolType > node6(c, {}); - std::tree < DefaultSymbolType > node8(c, {}); - std::tree < DefaultSymbolType > node7(b, {std::move(node8)}); - std::tree < DefaultSymbolType > node5(a, {std::move(node6), std::move(node7)}); + ext::tree < DefaultSymbolType > node6(c, {}); + ext::tree < DefaultSymbolType > node8(c, {}); + ext::tree < DefaultSymbolType > node7(b, {std::move(node8)}); + ext::tree < DefaultSymbolType > node5(a, {std::move(node6), std::move(node7)}); tree::UnrankedTree < > tree1(alphabet, std::move(node1)); tree::UnrankedTree < > tree2(alphabet, std::move(node5)); @@ -258,17 +258,17 @@ void TreeTest::testUnrankedTreeSymbolValidityCheck() { const std::set<DefaultSymbolType> alphabet {a, b, c, e}; - std::tree < DefaultSymbolType > node3(d, {}); - std::tree < DefaultSymbolType > node4(c, {}); - std::tree < DefaultSymbolType > node2(b, {std::move(node3)}); - std::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < DefaultSymbolType > node3(d, {}); + ext::tree < DefaultSymbolType > node4(c, {}); + ext::tree < DefaultSymbolType > node2(b, {std::move(node3)}); + ext::tree < DefaultSymbolType > node1(a, {std::move(node2), std::move(node4)}); CPPUNIT_ASSERT_THROW(tree::UnrankedTree < > (alphabet, std::move(node1)), exception::CommonException); - std::tree < DefaultSymbolType > node6(e, {}); - std::tree < DefaultSymbolType > node8(c, {}); - std::tree < DefaultSymbolType > node7(b, {std::move(node8)}); - std::tree < DefaultSymbolType > node5(a, {std::move(node6), std::move(node7)}); + ext::tree < DefaultSymbolType > node6(e, {}); + ext::tree < DefaultSymbolType > node8(c, {}); + ext::tree < DefaultSymbolType > node7(b, {std::move(node8)}); + ext::tree < DefaultSymbolType > node5(a, {std::move(node6), std::move(node7)}); tree::UnrankedTree < > * tree = NULL; CPPUNIT_ASSERT_NO_THROW(tree = new tree::UnrankedTree < > (alphabet, std::move(node5))); @@ -285,10 +285,10 @@ void TreeTest::testPrefixRankedBarParser() { const std::set<common::ranked_symbol < >> alphabet {a, b, c}; - std::tree < common::ranked_symbol < > > node3(c, {}); - std::tree < common::ranked_symbol < > > node4(c, {}); - std::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); - std::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); + ext::tree < common::ranked_symbol < > > node3(c, {}); + ext::tree < common::ranked_symbol < > > node4(c, {}); + ext::tree < common::ranked_symbol < > > node2(b, {std::move(node3)}); + ext::tree < common::ranked_symbol < > > node1(a, {std::move(node2), std::move(node4)}); tree::RankedTree < > tree(alphabet, std::move(node1)); tree::PrefixRankedBarTree < > tree2(bar, tree); diff --git a/alib2raw/src/tree/TreeFromRawParser.cpp b/alib2raw/src/tree/TreeFromRawParser.cpp index 96ab094461..5c21650abf 100644 --- a/alib2raw/src/tree/TreeFromRawParser.cpp +++ b/alib2raw/src/tree/TreeFromRawParser.cpp @@ -50,16 +50,16 @@ RankedTreeWrapper TreeFromRawParser::parseRankedTree(std::deque<sax::Token>::ite throw exception::CommonException("Invalid input"); } -std::tree < alphabet::Symbol > TreeFromRawParser::parseContent(std::deque<sax::Token>::iterator& input) const { +ext::tree < alphabet::Symbol > TreeFromRawParser::parseContent(std::deque<sax::Token>::iterator& input) const { if (sax::FromXMLParserHelper::isTokenType(input, sax::Token::TokenType::START_ELEMENT)) { - std::tree < alphabet::Symbol > node ( alphabet::Symbol(sax::FromXMLParserHelper::popTokenData(input, sax::Token::TokenType::START_ELEMENT)), {}); + ext::tree < alphabet::Symbol > node ( alphabet::Symbol(sax::FromXMLParserHelper::popTokenData(input, sax::Token::TokenType::START_ELEMENT)), {}); while (sax::FromXMLParserHelper::isTokenType(input, sax::Token::TokenType::START_ELEMENT) || sax::FromXMLParserHelper::isTokenType(input, sax::Token::TokenType::CHARACTER)) { node.push_back(node.root( ), this->parseContent(input)); } sax::FromXMLParserHelper::popTokenData(input, sax::Token::TokenType::END_ELEMENT); return node; } else if(sax::FromXMLParserHelper::isTokenType(input, sax::Token::TokenType::CHARACTER)) { - return std::tree < alphabet::Symbol > (alphabet::Symbol(sax::FromXMLParserHelper::popTokenData(input, sax::Token::TokenType::CHARACTER)), {}); + return ext::tree < alphabet::Symbol > (alphabet::Symbol(sax::FromXMLParserHelper::popTokenData(input, sax::Token::TokenType::CHARACTER)), {}); } else { throw exception::CommonException("Invalid token stream"); } diff --git a/alib2raw/src/tree/TreeFromRawParser.h b/alib2raw/src/tree/TreeFromRawParser.h index ef73bff86a..6ae174c26f 100644 --- a/alib2raw/src/tree/TreeFromRawParser.h +++ b/alib2raw/src/tree/TreeFromRawParser.h @@ -28,7 +28,7 @@ public: RankedTreeWrapper parseRankedTree(std::deque<sax::Token>::iterator& input, const std::set<FEATURES>& features) const; private: - std::tree < alphabet::Symbol > parseContent(std::deque<sax::Token>::iterator& input) const; + ext::tree < alphabet::Symbol > parseContent(std::deque<sax::Token>::iterator& input) const; }; } /* namespace tree */ diff --git a/alib2raw/src/tree/TreeToRawComposer.h b/alib2raw/src/tree/TreeToRawComposer.h index 06ea58b7c7..27e63a3c82 100644 --- a/alib2raw/src/tree/TreeToRawComposer.h +++ b/alib2raw/src/tree/TreeToRawComposer.h @@ -37,22 +37,22 @@ public: private: template < class SymbolType, class RankType > - static void composeNode(std::deque<sax::Token>& out, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node); + static void composeNode(std::deque<sax::Token>& out, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node); template < class SymbolType, class RankType > static void composePrefixRankedNotation(std::deque<sax::Token>& out, unsigned& index, const std::vector<common::ranked_symbol < SymbolType, RankType > >& notation); template < class SymbolType, class RankType > static void composePrefixRankedBarNotation(std::deque<sax::Token>& out, unsigned& index, const std::vector<common::ranked_symbol < SymbolType, RankType > >& notation); template < class SymbolType > - static void composeNode(std::deque<sax::Token>& out, const std::tree < SymbolType > & node); + static void composeNode(std::deque<sax::Token>& out, const ext::tree < SymbolType > & node); }; template < class SymbolType, class RankType > -void TreeToRawComposer::composeNode(std::deque<sax::Token>& out, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node) { +void TreeToRawComposer::composeNode(std::deque<sax::Token>& out, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node) { if(node.getChildren().size() == 0) { out.emplace_back(sax::Token(ext::to_string ( node.getData ( ) ), sax::Token::TokenType::CHARACTER)); } else { out.emplace_back(sax::Token( ext::to_string ( node.getData ( ) ), sax::Token::TokenType::START_ELEMENT)); - for(const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren()) { + for(const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : node.getChildren()) { composeNode(out, child); } @@ -100,12 +100,12 @@ void TreeToRawComposer::composePrefixRankedBarNotation(std::deque<sax::Token>& o } template < class SymbolType > -void TreeToRawComposer::composeNode(std::deque<sax::Token>& out, const std::tree < SymbolType > & node) { +void TreeToRawComposer::composeNode(std::deque<sax::Token>& out, const ext::tree < SymbolType > & node) { if(node.getChildren().size() == 0) { } else { out.emplace_back(sax::Token( ext::to_string ( node.getData ( ) ), sax::Token::TokenType::START_ELEMENT)); - for(const std::tree < SymbolType > & child : node.getChildren()) { + for(const ext::tree < SymbolType > & child : node.getChildren()) { composeNode(out, child); } diff --git a/alib2std/src/extensions/tree.hpp b/alib2std/src/extensions/tree.hpp index cdd83a747c..87861774b8 100644 --- a/alib2std/src/extensions/tree.hpp +++ b/alib2std/src/extensions/tree.hpp @@ -18,7 +18,7 @@ #include "iterator.hpp" #include "tree_base.hpp" -namespace std { +namespace ext { template < class T > class tree { @@ -476,14 +476,14 @@ public: // ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- - void push_back ( const_children_iterator under, std::tree < T > && value ) { + void push_back ( const_children_iterator under, ext::tree < T > && value ) { std::vector < tree > & children = const_cast < std::vector < tree > & > ( under->getChildren ( ) ); children.push_back ( std::move ( value ) ); children.back ( ).m_parent = const_cast < tree * > ( & * under ); } - void push_back ( const_children_iterator under, const std::tree < T > & value ) { + void push_back ( const_children_iterator under, const ext::tree < T > & value ) { push_back ( under, tree ( value ) ); } @@ -642,20 +642,16 @@ std::ostream & operator <<( std::ostream & out, const tree < T > & t ) { return out; } -} /* namespace std */ - -namespace ext { - template < class T > -struct compare < std::tree < T > > { - int operator ()( const std::tree < T > & first, const std::tree < T > & second ) const { +struct compare < ext::tree < T > > { + int operator ()( const ext::tree < T > & first, const ext::tree < T > & second ) const { return first.compare ( second ); } }; template < class T > -std::string to_string ( const std::tree < T > & value ) { +std::string to_string ( const ext::tree < T > & value ) { std::stringstream ss; ss << value; return ss.str(); diff --git a/alib2std/src/extensions/tree_base.hpp b/alib2std/src/extensions/tree_base.hpp index 7d17b5c5e0..a24299a1d4 100644 --- a/alib2std/src/extensions/tree_base.hpp +++ b/alib2std/src/extensions/tree_base.hpp @@ -10,7 +10,7 @@ #include "tuple.hpp" -namespace std { +namespace ext { template < class Data > class BaseNode { @@ -72,8 +72,8 @@ public: template < class Data, int arity, class ConstData = Data, class Cast = Data > class AnyaryNode { - typedef typename TupleBuilder < Data, arity >::type ChildrenType; - typedef typename TupleBuilder < ConstData, arity >::type ConstChildrenType; + typedef typename std::TupleBuilder < Data, arity >::type ChildrenType; + typedef typename std::TupleBuilder < ConstData, arity >::type ConstChildrenType; union ChildrenUnion { ChildrenType children; @@ -95,7 +95,7 @@ class AnyaryNode { } public: - AnyaryNode ( typename TupleBuilder < Data, arity >::type c ) : children_union ( std::move ( c ) ) { + AnyaryNode ( typename std::TupleBuilder < Data, arity >::type c ) : children_union ( std::move ( c ) ) { setParent ( std::make_index_sequence < arity > ( ) ); } @@ -120,11 +120,11 @@ public: return * this; } - const typename TupleBuilder < Data, arity >::type & getElements ( ) { + const typename std::TupleBuilder < Data, arity >::type & getElements ( ) { return children_union.children; } - const typename TupleBuilder < ConstData, arity >::type & getElements ( ) const { + const typename std::TupleBuilder < ConstData, arity >::type & getElements ( ) const { return children_union.const_children; } @@ -138,7 +138,7 @@ public: return std::get < N > ( children_union.children ); } - void setElements ( typename TupleBuilder < Data, arity >::type c ) { + void setElements ( typename std::TupleBuilder < Data, arity >::type c ) { children_union.children = std::move ( c ); setParent ( std::make_index_sequence < arity > ( ) ); } @@ -473,7 +473,7 @@ public: } template < int arity > - static void setChildren ( const AnyaryNode < Data, arity, ConstData, Cast > & node, typename TupleBuilder < Data, arity >::type children ) { + static void setChildren ( const AnyaryNode < Data, arity, ConstData, Cast > & node, typename std::TupleBuilder < Data, arity >::type children ) { const_cast < AnyaryNode < Data, arity, ConstData, Cast > & > ( node ).setChildren ( std::move ( children ) ); } @@ -517,6 +517,6 @@ public: }; -} /* namespace std */ +} /* namespace ext */ #endif /* __TREE_BASE_HPP_ */ diff --git a/alib2std/src/extensions/trie.hpp b/alib2std/src/extensions/trie.hpp index 1e91cf8676..9a3ca87ce7 100644 --- a/alib2std/src/extensions/trie.hpp +++ b/alib2std/src/extensions/trie.hpp @@ -18,7 +18,7 @@ #include "pair.hpp" #include "tuple.hpp" -namespace std { +namespace ext { template < class Key, class Value > class trie { @@ -304,20 +304,16 @@ std::ostream & operator <<( std::ostream & out, const trie < Key, Value > & t ) return out; } -} /* namespace std */ - -namespace ext { - template < class Key, class Value > -struct compare < std::trie < Key, Value > > { - int operator ()( const std::trie < Key, Value > & first, const std::trie < Key, Value > & second ) const { +struct compare < ext::trie < Key, Value > > { + int operator ()( const ext::trie < Key, Value > & first, const ext::trie < Key, Value > & second ) const { return first.compare ( second ); } }; template < class Key, class Value > -std::string to_string ( const std::trie < Key, Value > & value ) { +std::string to_string ( const ext::trie < Key, Value > & value ) { std::stringstream ss; ss << value; return ss.str(); diff --git a/alib2std/test-src/extensions/TreeBaseTest.h b/alib2std/test-src/extensions/TreeBaseTest.h index d1ea7529c5..d91938db36 100644 --- a/alib2std/test-src/extensions/TreeBaseTest.h +++ b/alib2std/test-src/extensions/TreeBaseTest.h @@ -13,27 +13,27 @@ class TreeBaseTest : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE_END ( ); public: - class RegExpElement : public std::BaseNode < RegExpElement > { + class RegExpElement : public ext::BaseNode < RegExpElement > { }; class RegExpAlternation : public RegExpElement { }; - class RegExpConcatenation : public RegExpElement, public std::BinaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpConcatenation > { + class RegExpConcatenation : public RegExpElement, public ext::BinaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpConcatenation > { public: RegExpConcatenation ( std::shared_ptr < RegExpElement > left, std::shared_ptr < RegExpElement > right ) : BinaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpConcatenation > ( std::move ( left ), std::move ( right ) ) { } }; - class RegExpIteration : public RegExpElement, public std::UnaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpIteration > { + class RegExpIteration : public RegExpElement, public ext::UnaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpIteration > { public: RegExpIteration ( std::shared_ptr < RegExpElement > element ) : UnaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpIteration > ( std::move ( element ) ) { } }; - class RegExpSymbol : public RegExpElement, public std::NullaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpSymbol > { + class RegExpSymbol : public RegExpElement, public ext::NullaryNode < std::shared_ptr < RegExpElement >, std::shared_ptr < const RegExpElement >, RegExpSymbol > { char m_symbol; public: @@ -56,7 +56,7 @@ public: std::shared_ptr < RegExpElement > root; }; - class UnrankedTreeNode : public std::BaseNode < UnrankedTreeNode >, public std::VararyNode < UnrankedTreeNode > { + class UnrankedTreeNode : public ext::BaseNode < UnrankedTreeNode >, public ext::VararyNode < UnrankedTreeNode > { char m_symbol; public: @@ -73,7 +73,7 @@ public: UnrankedTreeNode root; }; - class RankedTreeNode : public std::BaseNode < RankedTreeNode >, public std::FixedaryNode < RankedTreeNode > { + class RankedTreeNode : public ext::BaseNode < RankedTreeNode >, public ext::FixedaryNode < RankedTreeNode > { char m_symbol; unsigned m_arity; diff --git a/alib2std/test-src/extensions/TreeTest.cpp b/alib2std/test-src/extensions/TreeTest.cpp index bd5e42f0c8..a31d08463b 100644 --- a/alib2std/test-src/extensions/TreeTest.cpp +++ b/alib2std/test-src/extensions/TreeTest.cpp @@ -9,26 +9,26 @@ void TreeTest::setUp ( ) { void TreeTest::tearDown ( ) { } -void TreeTest::print_tree ( const std::tree < char > & tree, std::string indent ) { +void TreeTest::print_tree ( const ext::tree < char > & tree, std::string indent ) { std::cout << indent << tree.getData ( ) << std::endl; - for ( const std::tree < char > & child : tree.getChildren ( ) ) { + for ( const ext::tree < char > & child : tree.getChildren ( ) ) { print_tree ( child, indent + " " ); } } void TreeTest::testTreeStdStructure ( ) { - std::tree < char > t ( 'a', std::tree < char > ( 'a' ), std::tree < char > ( 'b', std::tree < char > ( 'a' ), std::tree < char > ( 'b' ) ) ); + ext::tree < char > t ( 'a', ext::tree < char > ( 'a' ), ext::tree < char > ( 'b', ext::tree < char > ( 'a' ), ext::tree < char > ( 'b' ) ) ); // std::cout << "structure t " << std::boolalpha << t.checkStructure() << std::endl; - std::tree < char > t2 ( 'c' ); + ext::tree < char > t2 ( 'c' ); // std::cout << "structure t2 " << std::boolalpha << t2.checkStructure() << std::endl; - t2.insert ( t2.root ( ), t2.begin ( ), { 'c', std::tree < char > ( 'b' ) } ); + t2.insert ( t2.root ( ), t2.begin ( ), { 'c', ext::tree < char > ( 'b' ) } ); std::swap ( t2.getChildren ( ).front (), t.getChildren().front ( ) ); - CPPUNIT_ASSERT ( t2 == std::tree < char > ( 'c', std::tree < char > ( 'a' ) ) ); - CPPUNIT_ASSERT ( t == std::tree < char > ( 'a', std::tree < char > ( 'c', std::tree < char > ( 'b' ) ), std::tree < char > ( 'b', std::tree < char > ( 'a' ), std::tree < char > ( 'b' ) ) ) ); + CPPUNIT_ASSERT ( t2 == ext::tree < char > ( 'c', ext::tree < char > ( 'a' ) ) ); + CPPUNIT_ASSERT ( t == ext::tree < char > ( 'a', ext::tree < char > ( 'c', ext::tree < char > ( 'b' ) ), ext::tree < char > ( 'b', ext::tree < char > ( 'a' ), ext::tree < char > ( 'b' ) ) ) ); CPPUNIT_ASSERT ( t2.checkStructure ( ) ); CPPUNIT_ASSERT ( t.checkStructure ( ) ); std::swap ( t2.getChildren ( ).front (), t.getChildren().front ( ) ); @@ -60,7 +60,7 @@ void TreeTest::testTreeStdStructure ( ) { CPPUNIT_ASSERT_EQUAL ( ( char ) t2 ( 1, 1 ), 'c' ); CPPUNIT_ASSERT ( t2.checkStructure ( ) ); - std::tree < char >::const_prefix_iterator beg = t2.prefix_begin ( ); + ext::tree < char >::const_prefix_iterator beg = t2.prefix_begin ( ); beg++; beg++; beg++; @@ -85,7 +85,7 @@ void TreeTest::testTreeStdStructure ( ) { std::vector < std::pair < unsigned, char > > expectedPrefix = { { 0, 'c' }, { 1, 'c' }, { 2, 'b' }, { 1, 'a' }, { 2, 'a' }, { 2, 'c' }, { 3, 'a' }, { 3, 'b' }, { 1, 'd' }, { 1, 'f' } }; std::vector < std::pair < unsigned, char > >::const_iterator ref = expectedPrefix.begin ( ); - for ( std::tree < char >::const_prefix_iterator iter = t2.prefix_begin ( ); iter != t2.prefix_end ( ); ++iter ) { + for ( ext::tree < char >::const_prefix_iterator iter = t2.prefix_begin ( ); iter != t2.prefix_end ( ); ++iter ) { CPPUNIT_ASSERT ( iter.getLevel ( ) == ref->first ); CPPUNIT_ASSERT ( * iter == ref->second ); ++iter; @@ -96,7 +96,7 @@ void TreeTest::testTreeStdStructure ( ) { std::vector < std::tuple < unsigned, char, bool > > expectedStructure = { std::make_tuple ( 0u, 'c', false ), std::make_tuple ( 1u, 'c', false ), std::make_tuple ( 2u, 'b', false ), std::make_tuple ( 2u, 'b', true ), std::make_tuple ( 1u, 'c', true ), std::make_tuple ( 1u, 'a', false ), std::make_tuple ( 2u, 'a', false ), std::make_tuple ( 2u, 'a', true ), std::make_tuple ( 2u, 'c', false ), std::make_tuple ( 3u, 'a', false ), std::make_tuple ( 3u, 'a', true ), std::make_tuple ( 3u, 'b', false ), std::make_tuple ( 3u, 'b', true ), std::make_tuple ( 2u, 'c', true ), std::make_tuple ( 1u, 'a', true ), std::make_tuple ( 1u, 'd', false ), std::make_tuple ( 1u, 'd', true ), std::make_tuple ( 1u, 'f', false ), std::make_tuple ( 1u, 'f', true ), std::make_tuple ( 0u, 'c', true ) }; std::vector < std::tuple < unsigned, char, bool > >::const_iterator ref2 = expectedStructure.begin ( ); - for ( std::tree < char >::const_structure_iterator iter = t2.structure_begin ( ); iter != t2.structure_end ( ); ++iter ) { + for ( ext::tree < char >::const_structure_iterator iter = t2.structure_begin ( ); iter != t2.structure_end ( ); ++iter ) { CPPUNIT_ASSERT ( iter.getLevel ( ) == std::get < 0 > ( * ref2 ) ); CPPUNIT_ASSERT ( * iter == std::get < 1 > ( * ref2 ) ); CPPUNIT_ASSERT ( iter.getVirtual ( ) == std::get < 2 > ( * ref2 ) ); @@ -108,7 +108,7 @@ void TreeTest::testTreeStdStructure ( ) { std::vector < std::pair < unsigned, char > > expectedPostfix = { { 2, 'b' }, { 1, 'c' }, { 2, 'a' }, { 3, 'a' }, { 3, 'b' }, { 2, 'c' }, { 1, 'a' }, { 1, 'd' }, { 1, 'f' }, { 0, 'c' } }; std::vector < std::pair < unsigned, char > >::const_iterator ref3 = expectedPostfix.begin ( ); - for ( std::tree < char >::const_postfix_iterator iter = t2.postfix_begin ( ); iter != t2.postfix_end ( ); ++iter ) { + for ( ext::tree < char >::const_postfix_iterator iter = t2.postfix_begin ( ); iter != t2.postfix_end ( ); ++iter ) { CPPUNIT_ASSERT ( iter.getLevel ( ) == ref3->first ); CPPUNIT_ASSERT ( * iter == ref3->second ); ++iter; @@ -116,9 +116,9 @@ void TreeTest::testTreeStdStructure ( ) { ++ref3; } - std::tree < char > cmp1 ( 'a' ); - std::tree < char > cmp2 ( 'b' ); - std::tree < char > cmp3 ( 'c' ); + ext::tree < char > cmp1 ( 'a' ); + ext::tree < char > cmp2 ( 'b' ); + ext::tree < char > cmp3 ( 'c' ); CPPUNIT_ASSERT ( cmp1 < cmp2 ); CPPUNIT_ASSERT ( cmp2 < cmp3 ); diff --git a/alib2std/test-src/extensions/TreeTest.h b/alib2std/test-src/extensions/TreeTest.h index 039f0fd8a0..d02c07ebdd 100644 --- a/alib2std/test-src/extensions/TreeTest.h +++ b/alib2std/test-src/extensions/TreeTest.h @@ -27,7 +27,7 @@ public: }; - void print_tree ( const std::tree < char > & tree, std::string indent ); + void print_tree ( const ext::tree < char > & tree, std::string indent ); void setUp ( ); void tearDown ( ); diff --git a/alib2std/test-src/extensions/TrieTest.cpp b/alib2std/test-src/extensions/TrieTest.cpp index 87ffdabcc1..e1ce530c3b 100644 --- a/alib2std/test-src/extensions/TrieTest.cpp +++ b/alib2std/test-src/extensions/TrieTest.cpp @@ -9,31 +9,31 @@ void TrieTest::setUp ( ) { void TrieTest::tearDown ( ) { } -void TrieTest::print_tree ( const std::trie < char, int > & tree, std::string indent ) { +void TrieTest::print_tree ( const ext::trie < char, int > & tree, std::string indent ) { std::cout << indent << tree.getData ( ) << std::endl; - for ( const std::pair < const char, std::trie < char, int > > & child : tree.getChildren ( ) ) { + for ( const std::pair < const char, ext::trie < char, int > > & child : tree.getChildren ( ) ) { std::cout << indent << child.first << ":" << std::endl; print_tree ( child.second, indent + " " ); } } void TrieTest::testTrieStdStructure ( ) { - std::trie < char, int > t ( 0, std::map < char, std::trie < char, int > > { std::make_pair ( 'a', std::trie < char, int > ( 1 ) ), std::make_pair ( 'b', std::trie < char, int > ( 2 ) ) } ); + ext::trie < char, int > t ( 0, std::map < char, ext::trie < char, int > > { std::make_pair ( 'a', ext::trie < char, int > ( 1 ) ), std::make_pair ( 'b', ext::trie < char, int > ( 2 ) ) } ); // std::cout << "structure t " << std::boolalpha << t.checkStructure() << std::endl; - std::trie < char, int > t2 ( 3 ); - CPPUNIT_ASSERT ( t2 == ( std::trie < char, int > ( 3 ) ) ); + ext::trie < char, int > t2 ( 3 ); + CPPUNIT_ASSERT ( t2 == ( ext::trie < char, int > ( 3 ) ) ); // std::cout << "structure t2 " << std::boolalpha << t2.checkStructure() << std::endl; - t2.insert ( t2.root ( ), 'c', std::trie < char, int > ( 4 ) ); + t2.insert ( t2.root ( ), 'c', ext::trie < char, int > ( 4 ) ); std::cout << t2 << std::endl; - CPPUNIT_ASSERT ( t2 == ( std::trie < char, int > ( 3, std::map < char, std::trie < char, int > > { std::make_pair ( 'c', std::trie < char, int > ( 4 ) ) } ) ) ); + CPPUNIT_ASSERT ( t2 == ( ext::trie < char, int > ( 3, std::map < char, ext::trie < char, int > > { std::make_pair ( 'c', ext::trie < char, int > ( 4 ) ) } ) ) ); std::swap ( t2.getChildren ( ).begin()->second, t.getChildren().begin()->second ); - CPPUNIT_ASSERT ( t2 == ( std::trie < char, int > ( 3, std::map < char, std::trie < char, int > > { std::make_pair ( 'c', std::trie < char, int > ( 1 ) ) } ) ) ); - CPPUNIT_ASSERT ( t == ( std::trie < char, int > ( 0, std::map < char, std::trie < char, int > > { std::make_pair ( 'a', std::trie < char, int > ( 4 ) ), std::make_pair ( 'b', std::trie < char, int > ( 2 ) ) } ) ) ); + CPPUNIT_ASSERT ( t2 == ( ext::trie < char, int > ( 3, std::map < char, ext::trie < char, int > > { std::make_pair ( 'c', ext::trie < char, int > ( 1 ) ) } ) ) ); + CPPUNIT_ASSERT ( t == ( ext::trie < char, int > ( 0, std::map < char, ext::trie < char, int > > { std::make_pair ( 'a', ext::trie < char, int > ( 4 ) ), std::make_pair ( 'b', ext::trie < char, int > ( 2 ) ) } ) ) ); CPPUNIT_ASSERT ( t2.checkStructure ( ) ); CPPUNIT_ASSERT ( t.checkStructure ( ) ); std::swap ( t2.getChildren ( ).begin()->second, t.getChildren().begin()->second ); @@ -50,7 +50,7 @@ void TrieTest::testTrieStdStructure ( ) { print_tree ( t2, "" ); - t2.insert ( & t2.getChildren().begin()->second, 'a', std::trie < char, int > ( 5 ) ); + t2.insert ( & t2.getChildren().begin()->second, 'a', ext::trie < char, int > ( 5 ) ); CPPUNIT_ASSERT_EQUAL ( ( int ) t2 ( ), 3 ); CPPUNIT_ASSERT_EQUAL ( ( int ) t2 ( 'a' ), 1 ); @@ -61,9 +61,9 @@ void TrieTest::testTrieStdStructure ( ) { CPPUNIT_ASSERT ( t2.checkStructure ( ) ); - std::trie < char, int > cmp1 ( 1 ); - std::trie < char, int > cmp2 ( 2 ); - std::trie < char, int > cmp3 ( 3 ); + ext::trie < char, int > cmp1 ( 1 ); + ext::trie < char, int > cmp2 ( 2 ); + ext::trie < char, int > cmp3 ( 3 ); CPPUNIT_ASSERT ( cmp1 < cmp2 ); CPPUNIT_ASSERT ( cmp2 < cmp3 ); diff --git a/alib2std/test-src/extensions/TrieTest.h b/alib2std/test-src/extensions/TrieTest.h index 5b10018ec5..e7b62a22f3 100644 --- a/alib2std/test-src/extensions/TrieTest.h +++ b/alib2std/test-src/extensions/TrieTest.h @@ -27,7 +27,7 @@ public: }; - void print_tree ( const std::trie < char, int > & trie, std::string indent ); + void print_tree ( const ext::trie < char, int > & trie, std::string indent ); void setUp ( ); void tearDown ( ); diff --git a/alib2str/src/tree/TreeFromStringParser.cpp b/alib2str/src/tree/TreeFromStringParser.cpp index 02907219ef..9e18ab7954 100644 --- a/alib2str/src/tree/TreeFromStringParser.cpp +++ b/alib2str/src/tree/TreeFromStringParser.cpp @@ -27,9 +27,9 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE token = TreeFromStringLexer::next ( input ); if ( token.type == TreeFromStringLexer::TokenType::BAR ) { - return Tree ( UnrankedPattern < > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), std::tree < DefaultSymbolType > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), { } ) ) ); + return Tree ( UnrankedPattern < > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), ext::tree < DefaultSymbolType > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), { } ) ) ); } else { - return Tree ( RankedPattern < > ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType, primitive::Unsigned > > ( ), std::tree < common::ranked_symbol < DefaultSymbolType > > ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), { } ) ) ); + return Tree ( RankedPattern < > ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType, primitive::Unsigned > > ( ), ext::tree < common::ranked_symbol < DefaultSymbolType > > ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), { } ) ) ); } } else if ( token.type == TreeFromStringLexer::TokenType::NONLINEAR_VARIABLE ) { token = TreeFromStringLexer::next ( input ); @@ -37,11 +37,11 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE if ( token.type == TreeFromStringLexer::TokenType::BAR ) { DefaultSymbolType subtreeWildcard = alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ); DefaultSymbolType nonlinearVariable ( alphabet::NonlinearVariableSymbol < DefaultSymbolType > ( DefaultSymbolType ( token.value ) ) ); - return Tree ( UnrankedNonlinearPattern < > ( subtreeWildcard, { nonlinearVariable }, std::tree < DefaultSymbolType > ( subtreeWildcard, { } ) ) ); + return Tree ( UnrankedNonlinearPattern < > ( subtreeWildcard, { nonlinearVariable }, ext::tree < DefaultSymbolType > ( subtreeWildcard, { } ) ) ); } else { common::ranked_symbol < DefaultSymbolType > subtreeWildcard = alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ); common::ranked_symbol < DefaultSymbolType > nonlinearVariable ( DefaultSymbolType ( alphabet::NonlinearVariableSymbol < DefaultSymbolType > ( DefaultSymbolType ( token.value ) ) ), 0 ); - return Tree ( RankedNonlinearPattern < > ( subtreeWildcard, { nonlinearVariable }, std::tree < common::ranked_symbol < DefaultSymbolType > > ( nonlinearVariable, { } ) ) ); + return Tree ( RankedNonlinearPattern < > ( subtreeWildcard, { nonlinearVariable }, ext::tree < common::ranked_symbol < DefaultSymbolType > > ( nonlinearVariable, { } ) ) ); } } else { TreeFromStringLexer::putback ( input, token ); @@ -56,29 +56,29 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE rank = ext::from_string < unsigned > ( token.value ); - std::vector < std::tree < common::ranked_symbol < DefaultSymbolType > > > childs; + std::vector < ext::tree < common::ranked_symbol < DefaultSymbolType > > > childs; bool isPattern = false; for ( unsigned i = 0; i < rank; i++ ) childs.emplace_back ( parseRankedContent ( input, isPattern, nonlinearVariables ) ); if ( isPattern && nonlinearVariables.size ( ) ) { - RankedNonlinearPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), std::move ( nonlinearVariables ), std::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ) ); + RankedNonlinearPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), std::move ( nonlinearVariables ), ext::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ) ); if ( features.count ( FEATURES::RANKED_NONLINEAR_PATTERN ) ) return Tree ( std::move ( tree ) ); } else if ( isPattern ) { - RankedPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), std::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ) ); + RankedPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), ext::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ) ); if ( features.count ( FEATURES::RANKED_PATTERN ) ) return Tree ( std::move ( tree ) ); } else { - RankedTree < > tree ( std::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ) ); + RankedTree < > tree ( ext::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ) ); if ( features.count ( FEATURES::RANKED_TREE ) ) return Tree ( std::move ( tree ) ); } } else { std::set < DefaultSymbolType > nonlinearVariables; - std::vector < std::tree < DefaultSymbolType > > childs; + std::vector < ext::tree < DefaultSymbolType > > childs; bool isPattern = false; while ( token.type != TreeFromStringLexer::TokenType::BAR ) { @@ -91,15 +91,15 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE throw exception::CommonException ( "Missing bar" ); if ( isPattern && nonlinearVariables.size ( ) ) { - UnrankedNonlinearPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), std::move ( nonlinearVariables ), std::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ) ); + UnrankedNonlinearPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), std::move ( nonlinearVariables ), ext::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ) ); if ( features.count ( FEATURES::UNRANKED_NONLINEAR_PATTERN ) ) return Tree ( std::move ( tree ) ); } else if ( isPattern ) { - UnrankedPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), std::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ) ); + UnrankedPattern < > tree ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), ext::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ) ); if ( features.count ( FEATURES::UNRANKED_PATTERN ) ) return Tree ( std::move ( tree ) ); } else { - UnrankedTree < > tree ( std::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ) ); + UnrankedTree < > tree ( ext::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ) ); if ( features.count ( FEATURES::UNRANKED_TREE ) ) return Tree ( std::move ( tree ) ); } @@ -109,23 +109,23 @@ Tree TreeFromStringParser::parseTree ( std::istream & input, const std::set < FE } } -std::tree < common::ranked_symbol < DefaultSymbolType > > TreeFromStringParser::parseRankedContent ( std::istream & input, bool & isPattern, std::set < common::ranked_symbol < DefaultSymbolType > > & nonlinearVariables ) { +ext::tree < common::ranked_symbol < DefaultSymbolType > > TreeFromStringParser::parseRankedContent ( std::istream & input, bool & isPattern, std::set < common::ranked_symbol < DefaultSymbolType > > & nonlinearVariables ) { TreeFromStringLexer::Token token = TreeFromStringLexer::next ( input ); if ( token.type == TreeFromStringLexer::TokenType::SUBTREE_WILDCARD ) { isPattern = true; - return std::tree < common::ranked_symbol < DefaultSymbolType > > ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), { } ); + return ext::tree < common::ranked_symbol < DefaultSymbolType > > ( alphabet::SubtreeWildcardSymbol::instance < common::ranked_symbol < DefaultSymbolType > > ( ), { } ); } else if ( token.type == TreeFromStringLexer::TokenType::NONLINEAR_VARIABLE ) { isPattern = true; common::ranked_symbol < DefaultSymbolType > nonlinearVariable ( DefaultSymbolType ( alphabet::NonlinearVariableSymbol < DefaultSymbolType > ( DefaultSymbolType ( token.value ) ) ), 0 ); nonlinearVariables.insert ( nonlinearVariable ); - return std::tree < common::ranked_symbol < DefaultSymbolType > > ( std::move ( nonlinearVariable ), { } ); + return ext::tree < common::ranked_symbol < DefaultSymbolType > > ( std::move ( nonlinearVariable ), { } ); } else { TreeFromStringLexer::putback ( input, token ); DefaultSymbolType symbol = alib::stringApi < DefaultSymbolType >::parse ( input ); unsigned rank = 0; - std::vector < std::tree < common::ranked_symbol < DefaultSymbolType > > > childs; + std::vector < ext::tree < common::ranked_symbol < DefaultSymbolType > > > childs; token = TreeFromStringLexer::next ( input ); @@ -135,13 +135,13 @@ std::tree < common::ranked_symbol < DefaultSymbolType > > TreeFromStringParser:: throw exception::CommonException ( "Missing rank" ); for ( unsigned i = 0; i < rank; i++ ) - childs.emplace_back ( std::tree < common::ranked_symbol < DefaultSymbolType > > ( parseRankedContent ( input, isPattern, nonlinearVariables ) ) ); + childs.emplace_back ( ext::tree < common::ranked_symbol < DefaultSymbolType > > ( parseRankedContent ( input, isPattern, nonlinearVariables ) ) ); - return std::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ); + return ext::tree < common::ranked_symbol < DefaultSymbolType > > ( common::ranked_symbol < DefaultSymbolType > ( std::move ( symbol ), rank ), std::move ( childs ) ); } } -std::tree < DefaultSymbolType > TreeFromStringParser::parseUnrankedContent ( std::istream & input, bool & isPattern, std::set < DefaultSymbolType > & nonlinearVariables ) { +ext::tree < DefaultSymbolType > TreeFromStringParser::parseUnrankedContent ( std::istream & input, bool & isPattern, std::set < DefaultSymbolType > & nonlinearVariables ) { TreeFromStringLexer::Token token = TreeFromStringLexer::next ( input ); if ( token.type == TreeFromStringLexer::TokenType::SUBTREE_WILDCARD ) { @@ -151,7 +151,7 @@ std::tree < DefaultSymbolType > TreeFromStringParser::parseUnrankedContent ( std throw exception::CommonException ( "Missing bar" ); isPattern = true; - return std::tree < DefaultSymbolType > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), { } ); + return ext::tree < DefaultSymbolType > ( alphabet::SubtreeWildcardSymbol::instance < DefaultSymbolType > ( ), { } ); } else if ( token.type == TreeFromStringLexer::TokenType::NONLINEAR_VARIABLE ) { token = TreeFromStringLexer::next ( input ); @@ -161,12 +161,12 @@ std::tree < DefaultSymbolType > TreeFromStringParser::parseUnrankedContent ( std isPattern = true; DefaultSymbolType nonlinearVariable ( alphabet::NonlinearVariableSymbol < DefaultSymbolType > ( DefaultSymbolType ( token.value ) ) ); nonlinearVariables.insert ( nonlinearVariable ); - return std::tree < DefaultSymbolType > ( std::move ( nonlinearVariable ), { } ); + return ext::tree < DefaultSymbolType > ( std::move ( nonlinearVariable ), { } ); } else { TreeFromStringLexer::putback ( input, token ); DefaultSymbolType symbol = alib::stringApi < DefaultSymbolType >::parse ( input ); - std::vector < std::tree < DefaultSymbolType > > childs; + std::vector < ext::tree < DefaultSymbolType > > childs; token = TreeFromStringLexer::next ( input ); @@ -179,7 +179,7 @@ std::tree < DefaultSymbolType > TreeFromStringParser::parseUnrankedContent ( std if ( token.type != TreeFromStringLexer::TokenType::BAR ) throw exception::CommonException ( "Missing bar" ); - return std::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ); + return ext::tree < DefaultSymbolType > ( std::move ( symbol ), std::move ( childs ) ); } } diff --git a/alib2str/src/tree/TreeFromStringParser.h b/alib2str/src/tree/TreeFromStringParser.h index 399c08451e..a36f92c7a2 100644 --- a/alib2str/src/tree/TreeFromStringParser.h +++ b/alib2str/src/tree/TreeFromStringParser.h @@ -19,8 +19,8 @@ namespace tree { class TreeFromStringParser { - static std::tree < common::ranked_symbol < DefaultSymbolType > > parseRankedContent ( std::istream &, bool &, std::set < common::ranked_symbol < DefaultSymbolType > > & ); - static std::tree < DefaultSymbolType > parseUnrankedContent ( std::istream &, bool &, std::set < DefaultSymbolType > & ); + static ext::tree < common::ranked_symbol < DefaultSymbolType > > parseRankedContent ( std::istream &, bool &, std::set < common::ranked_symbol < DefaultSymbolType > > & ); + static ext::tree < DefaultSymbolType > parseUnrankedContent ( std::istream &, bool &, std::set < DefaultSymbolType > & ); public: static tree::Tree parseTree ( std::istream & ); diff --git a/alib2str/src/tree/TreeToStringComposer.h b/alib2str/src/tree/TreeToStringComposer.h index b27fd186b1..4cf0536279 100644 --- a/alib2str/src/tree/TreeToStringComposer.h +++ b/alib2str/src/tree/TreeToStringComposer.h @@ -25,13 +25,13 @@ namespace tree { */ class TreeToStringComposer : public alib::SingleDispatchFirstStaticParam < TreeToStringComposer, void, std::ostream &, const TreeBase &> { template < class SymbolType, class RankType > - static void compose ( std::ostream &, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node ); + static void compose ( std::ostream &, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node ); template < class SymbolType, class RankType > - static void compose ( std::ostream &, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node ); + static void compose ( std::ostream &, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node ); template < class SymbolType > - static void compose ( std::ostream &, const std::tree < SymbolType > & node ); + static void compose ( std::ostream &, const ext::tree < SymbolType > & node ); template < class SymbolType > - static void compose ( std::ostream &, const SymbolType & subtreeWildcard, const std::tree < SymbolType > & node ); + static void compose ( std::ostream &, const SymbolType & subtreeWildcard, const ext::tree < SymbolType > & node ); public: template < class SymbolType, class RankType > @@ -53,19 +53,19 @@ public: }; template < class SymbolType, class RankType > -void TreeToStringComposer::compose ( std::ostream & out, const std::tree < common::ranked_symbol < SymbolType, RankType> > & node ) { +void TreeToStringComposer::compose ( std::ostream & out, const ext::tree < common::ranked_symbol < SymbolType, RankType> > & node ) { alib::ObjectToStringComposer::compose ( out, node.getData ( ).getSymbol ( ) ); out << ext::to_string ( node.getData ( ).getRank ( ) ); - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : node ) { + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : node ) { out << " "; compose ( out, child ); } } template < class SymbolType, class RankType > -void TreeToStringComposer::compose ( std::ostream & out, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const std::tree < common::ranked_symbol < SymbolType, RankType > > & node ) { +void TreeToStringComposer::compose ( std::ostream & out, const common::ranked_symbol < SymbolType, RankType > & subtreeWildcard, const ext::tree < common::ranked_symbol < SymbolType, RankType > > & node ) { if ( node.getData ( ) == subtreeWildcard ) { out << "#S"; } else { @@ -73,7 +73,7 @@ void TreeToStringComposer::compose ( std::ostream & out, const common::ranked_sy out << ext::to_string ( node.getData ( ).getRank ( ) ); - for ( const std::tree < common::ranked_symbol < SymbolType, RankType > > & child : node ) { + for ( const ext::tree < common::ranked_symbol < SymbolType, RankType > > & child : node ) { out << " "; compose ( out, subtreeWildcard, child ); } @@ -81,10 +81,10 @@ void TreeToStringComposer::compose ( std::ostream & out, const common::ranked_sy } template < class SymbolType > -void TreeToStringComposer::compose ( std::ostream & out, const std::tree < SymbolType > & node ) { +void TreeToStringComposer::compose ( std::ostream & out, const ext::tree < SymbolType > & node ) { alib::ObjectToStringComposer::compose ( out, node.getData ( ) ); - for ( const std::tree < SymbolType > & child : node ) { + for ( const ext::tree < SymbolType > & child : node ) { out << " "; compose ( out, child ); } @@ -93,13 +93,13 @@ void TreeToStringComposer::compose ( std::ostream & out, const std::tree < Symbo } template < class SymbolType > -void TreeToStringComposer::compose ( std::ostream & out, const SymbolType & subtreeWildcard, const std::tree < SymbolType > & node ) { +void TreeToStringComposer::compose ( std::ostream & out, const SymbolType & subtreeWildcard, const ext::tree < SymbolType > & node ) { if ( node.getData ( ) == subtreeWildcard ) { out << "#S |"; } else { alib::ObjectToStringComposer::compose ( out, node.getData ( ) ); - for ( const std::tree < SymbolType > & child : node ) { + for ( const ext::tree < SymbolType > & child : node ) { out << " "; compose ( out, subtreeWildcard, child ); } -- GitLab