diff --git a/alib2algo/src/arbology/exact/ExactPatternMatch.h b/alib2algo/src/arbology/exact/ExactPatternMatch.h index f69338bb8acfb4776883faa27f958642433b2e3a..9471de005d1a6af73f24b74a393b845c2e5b81e8 100644 --- a/alib2algo/src/arbology/exact/ExactPatternMatch.h +++ b/alib2algo/src/arbology/exact/ExactPatternMatch.h @@ -36,8 +36,8 @@ namespace exact { class ExactPatternMatch { public: /** - * Performs conversion. - * @return left regular grammar equivalent to source automaton. + * Locates all occurences of a given pattern tree in a given subject tree. + * @return indexes (positions) of occurrences either to the linear representation or corresponding to prefix traversal of the subject. */ template < class SymbolType > static ext::set < unsigned > match ( const tree::UnorderedUnrankedTree < SymbolType > & subject, const tree::UnorderedUnrankedPattern < SymbolType > & pattern ); @@ -69,62 +69,54 @@ public: private: template < class SymbolType > - static bool matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ); + static bool matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeGap, const SymbolType & subtreeVariable ); template < class SymbolType > - static bool matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap, const SymbolType & nodeWildcard ); + static bool matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeGap, const SymbolType & subtreeVariable, const SymbolType & nodeWildcard ); template < class SymbolType > static bool matchHelper ( const ext::tree < common::ranked_symbol < SymbolType > > & subject, const ext::tree < common::ranked_symbol < SymbolType > > & pattern, const common::ranked_symbol < SymbolType > & subtreeVariable, const ext::set < common::ranked_symbol < SymbolType > > & nodeWildcards ); template < class SymbolType > static bool matchHelper ( const ext::tree < common::ranked_symbol < SymbolType > > & subject, const ext::tree < common::ranked_symbol < SymbolType > > & pattern, const common::ranked_symbol < SymbolType > & subtreeVariable, const ext::set < common::ranked_symbol < SymbolType > > & nonlinearVariables, const ext::tree < common::ranked_symbol < unsigned > > & repeats, ext::map < common::ranked_symbol < SymbolType >, unsigned > & variablesSetting ); - template < class SymbolType > - static bool matchHelper ( typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ); - template < class SymbolType > - static bool matchHelper ( typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeVariable, const SymbolType & subtreeGap, const SymbolType & nodeWildcard ); + template < class SymbolType, class ... ExtraArgs > + static bool matchHelper ( typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeGap, const ExtraArgs & ... extraArgs ); - template < class SymbolType > - static void matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const ext::set < SymbolType > & nodeWildcards ); - template < class SymbolType > - static void matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ); - template < class SymbolType > - static void matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap, const SymbolType & nodeWildcard ); + template < class SymbolType, class ... ExtraArgs > + static void matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const ExtraArgs & ... extraArgs ); template < class SymbolType, class RepeatsType > - static void matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const ext::set < SymbolType > & nonlinearVariables, const ext::tree < RepeatsType > & repeats ); + static void matchNonlinearInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const ext::set < SymbolType > & nonlinearVariables, const ext::tree < RepeatsType > & repeats ); template < class SymbolType > - static bool matchUnorderedHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ); + static bool matchUnorderedHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeGap, const SymbolType & subtreeVariable ); template < class SymbolType > static bool matchUnorderedHelper ( const ext::tree < common::ranked_symbol < SymbolType > > & subject, const ext::tree < common::ranked_symbol < SymbolType > > & pattern, const common::ranked_symbol < SymbolType > & subtreeVariable ); - template < class SymbolType > - static bool matchUnorderedHelper ( typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectIter, typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ); + template < class SymbolType, class ... ExtraArgs > + static bool matchUnorderedHelper ( typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectIter, typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeGap, const ExtraArgs & ... extraArgs ); - template < class SymbolType > - static void matchUnorderedInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ); - template < class SymbolType > - static void matchUnorderedInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ); + template < class SymbolType, class ... ExtraArgs > + static void matchUnorderedInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const ExtraArgs & ... extraArgs ); }; -template < class SymbolType > -bool ExactPatternMatch::matchHelper ( typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ) { +template < class SymbolType, class ... ExtraArgs > +bool ExactPatternMatch::matchHelper ( typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeGap, const ExtraArgs & ... extraArgs ) { if ( patternIter == patternEnd ) return subjectIter == subjectEnd; if ( patternIter->getData ( ) == subtreeGap ) { - if ( matchHelper ( subjectIter, subjectEnd, std::next ( patternIter ), patternEnd, subtreeVariable, subtreeGap ) ) + if ( matchHelper ( subjectIter, subjectEnd, std::next ( patternIter ), patternEnd, subtreeGap, extraArgs ... ) ) return true; while ( subjectIter != subjectEnd ) { ++ subjectIter; - if ( matchHelper ( subjectIter, subjectEnd, patternIter, patternEnd, subtreeVariable, subtreeGap ) ) + if ( matchHelper ( subjectIter, subjectEnd, patternIter, patternEnd, subtreeGap, extraArgs ... ) ) return true; } return false; } else if ( subjectIter != subjectEnd ) { - if ( matchHelper ( * subjectIter, * patternIter, subtreeVariable, subtreeGap ) ) - return matchHelper ( std::next ( subjectIter ), subjectEnd, std::next ( patternIter ), patternEnd, subtreeVariable, subtreeGap ); + if ( matchHelper ( * subjectIter, * patternIter, subtreeGap, extraArgs ... ) ) + return matchHelper ( std::next ( subjectIter ), subjectEnd, std::next ( patternIter ), patternEnd, subtreeGap, extraArgs ... ); return false; } else { @@ -133,47 +125,21 @@ bool ExactPatternMatch::matchHelper ( typename ext::vector < ext::tree < SymbolT } template < class SymbolType > -bool ExactPatternMatch::matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ) { +bool ExactPatternMatch::matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeGap, const SymbolType & subtreeVariable ) { if ( pattern.getData ( ) == subtreeVariable ) return true; if ( subject.getData ( ) != pattern.getData ( ) ) return false; - return matchHelper ( subject.getChildren ( ).begin ( ), subject.getChildren ( ).end ( ), pattern.getChildren ( ).begin ( ), pattern.getChildren ( ).end ( ), subtreeVariable, subtreeGap ); -} - -template < class SymbolType > -bool ExactPatternMatch::matchHelper ( typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeVariable, const SymbolType & subtreeGap, const SymbolType & nodeWildcard ) { - if ( patternIter == patternEnd ) - return subjectIter == subjectEnd; - - if ( patternIter->getData ( ) == subtreeGap ) { - if ( matchHelper ( subjectIter, subjectEnd, std::next ( patternIter ), patternEnd, subtreeVariable, subtreeGap, nodeWildcard ) ) - return true; - - while ( subjectIter != subjectEnd ) { - ++ subjectIter; - if ( matchHelper ( subjectIter, subjectEnd, patternIter, patternEnd, subtreeVariable, subtreeGap, nodeWildcard ) ) - return true; - } - - return false; - } else if ( subjectIter != subjectEnd ) { - if ( matchHelper ( * subjectIter, * patternIter, subtreeVariable, subtreeGap, nodeWildcard ) ) - return matchHelper ( std::next ( subjectIter ), subjectEnd, std::next ( patternIter ), patternEnd, subtreeVariable, subtreeGap, nodeWildcard ); - - return false; - } else { - return false; - } + return matchHelper ( subject.getChildren ( ).begin ( ), subject.getChildren ( ).end ( ), pattern.getChildren ( ).begin ( ), pattern.getChildren ( ).end ( ), subtreeGap, subtreeVariable ); } template < class SymbolType > -bool ExactPatternMatch::matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap, const SymbolType & nodeWildcard ) { +bool ExactPatternMatch::matchHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeGap, const SymbolType & subtreeVariable, const SymbolType & nodeWildcard ) { if ( pattern.getData ( ) == subtreeVariable ) return true; if ( subject.getData ( ) != pattern.getData ( ) && nodeWildcard != pattern.getData ( ) ) return false; - return matchHelper ( subject.getChildren ( ).begin ( ), subject.getChildren ( ).end ( ), pattern.getChildren ( ).begin ( ), pattern.getChildren ( ).end ( ), subtreeVariable, subtreeGap, nodeWildcard ); + return matchHelper ( subject.getChildren ( ).begin ( ), subject.getChildren ( ).end ( ), pattern.getChildren ( ).begin ( ), pattern.getChildren ( ).end ( ), subtreeGap, subtreeVariable, nodeWildcard ); } template < class SymbolType > @@ -213,38 +179,18 @@ bool ExactPatternMatch::matchHelper ( const ext::tree < common::ranked_symbol < return true; } -template < class SymbolType > -void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const ext::set < SymbolType > & nodeWildcards ) { - if ( matchHelper ( subject, pattern, subtreeVariable, nodeWildcards ) ) occ.insert ( index ); - - index++; - - for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) - matchInternal ( index, occ, child, pattern, subtreeVariable, nodeWildcards ); -} - -template < class SymbolType > -void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ) { - if ( matchHelper ( subject, pattern, subtreeVariable, subtreeGap ) ) occ.insert ( index ); +template < class SymbolType, class ... ExtraArgs > +void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const ExtraArgs & ... extraArgs ) { + if ( matchHelper ( subject, pattern, extraArgs ... ) ) occ.insert ( index ); index++; for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) - matchInternal ( index, occ, child, pattern, subtreeVariable, subtreeGap ); -} - -template < class SymbolType > -void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap, const SymbolType & nodeWildcard ) { - if ( matchHelper ( subject, pattern, subtreeVariable, subtreeGap, nodeWildcard ) ) occ.insert ( index ); - - index++; - - for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) - matchInternal ( index, occ, child, pattern, subtreeVariable, subtreeGap, nodeWildcard ); + matchInternal ( index, occ, child, pattern, extraArgs ... ); } template < class SymbolType, class RepeatsType > -void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const ext::set < SymbolType > & nonlinearVariables, const ext::tree < RepeatsType > & repeats ) { +void ExactPatternMatch::matchNonlinearInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const ext::set < SymbolType > & nonlinearVariables, const ext::tree < RepeatsType > & repeats ) { ext::map < SymbolType, unsigned > variablesSetting; if ( matchHelper ( subject, pattern, subtreeVariable, nonlinearVariables, repeats, variablesSetting ) ) occ.insert ( index ); @@ -252,28 +198,28 @@ void ExactPatternMatch::matchInternal ( unsigned & index, ext::set < unsigned > index++; for ( const ext::tuple < const ext::tree < SymbolType > &, const ext::tree < RepeatsType > & > & childs : ext::make_tuple_foreach ( subject.getChildren ( ), repeats.getChildren ( ) ) ) - matchInternal ( index, occ, std::get < 0 > ( childs ), pattern, subtreeVariable, nonlinearVariables, std::get < 1 > ( childs ) ); + matchNonlinearInternal ( index, occ, std::get < 0 > ( childs ), pattern, subtreeVariable, nonlinearVariables, std::get < 1 > ( childs ) ); } -template < class SymbolType > -bool ExactPatternMatch::matchUnorderedHelper ( typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectIter, typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ) { +template < class SymbolType, class ... ExtraArgs > +bool ExactPatternMatch::matchUnorderedHelper ( typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectIter, typename ext::vector < ext::reference_wrapper < const ext::tree < SymbolType > > >::const_iterator subjectEnd, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternIter, typename ext::vector < ext::tree < SymbolType > >::const_iterator patternEnd, const SymbolType & subtreeGap, const ExtraArgs & ... extraArgs ) { if ( patternIter == patternEnd ) return subjectIter == subjectEnd; if ( patternIter->getData ( ) == subtreeGap ) { - if ( matchUnorderedHelper ( subjectIter, subjectEnd, std::next ( patternIter ), patternEnd, subtreeVariable, subtreeGap ) ) + if ( matchUnorderedHelper ( subjectIter, subjectEnd, std::next ( patternIter ), patternEnd, subtreeGap, extraArgs ... ) ) return true; while ( subjectIter != subjectEnd ) { ++ subjectIter; - if ( matchUnorderedHelper ( subjectIter, subjectEnd, patternIter, patternEnd, subtreeVariable, subtreeGap ) ) + if ( matchUnorderedHelper ( subjectIter, subjectEnd, patternIter, patternEnd, subtreeGap, extraArgs ... ) ) return true; } return false; } else if ( subjectIter != subjectEnd ) { - if ( matchUnorderedHelper ( subjectIter->get ( ), * patternIter, subtreeVariable, subtreeGap ) ) - return matchUnorderedHelper ( std::next ( subjectIter ), subjectEnd, std::next ( patternIter ), patternEnd, subtreeVariable, subtreeGap ); + if ( matchUnorderedHelper ( subjectIter->get ( ), * patternIter, subtreeGap, extraArgs ... ) ) + return matchUnorderedHelper ( std::next ( subjectIter ), subjectEnd, std::next ( patternIter ), patternEnd, subtreeGap, extraArgs ... ); return false; } else { @@ -282,7 +228,7 @@ bool ExactPatternMatch::matchUnorderedHelper ( typename ext::vector < ext::refer } template < class SymbolType > -bool ExactPatternMatch::matchUnorderedHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ) { +bool ExactPatternMatch::matchUnorderedHelper ( const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeGap, const SymbolType & subtreeVariable ) { if ( pattern.getData ( ) == subtreeVariable ) return true; if ( subject.getData ( ) != pattern.getData ( ) ) return false; @@ -293,7 +239,7 @@ bool ExactPatternMatch::matchUnorderedHelper ( const ext::tree < SymbolType > & } do { - if ( matchUnorderedHelper ( subjectChildrenRefs.begin ( ), subjectChildrenRefs.end ( ), pattern.getChildren ( ).begin ( ), pattern.getChildren ( ).end ( ), subtreeVariable, subtreeGap ) ) + if ( matchUnorderedHelper ( subjectChildrenRefs.begin ( ), subjectChildrenRefs.end ( ), pattern.getChildren ( ).begin ( ), pattern.getChildren ( ).end ( ), subtreeGap, subtreeVariable ) ) return true; } while ( next_permutation ( subjectChildrenRefs.begin ( ), subjectChildrenRefs.end ( ) ) ); @@ -328,24 +274,14 @@ bool ExactPatternMatch::matchUnorderedHelper ( const ext::tree < common::ranked_ return false; } -template < class SymbolType > -void ExactPatternMatch::matchUnorderedInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable ) { - if ( matchUnorderedHelper ( subject, pattern, subtreeVariable ) ) occ.insert ( index ); - - index++; - - for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) - matchUnorderedInternal ( index, occ, child, pattern, subtreeVariable ); -} - -template < class SymbolType > -void ExactPatternMatch::matchUnorderedInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const SymbolType & subtreeVariable, const SymbolType & subtreeGap ) { - if ( matchUnorderedHelper ( subject, pattern, subtreeVariable, subtreeGap ) ) occ.insert ( index ); +template < class SymbolType, class ... ExtraArgs > +void ExactPatternMatch::matchUnorderedInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern, const ExtraArgs & ... extraArgs ) { + if ( matchUnorderedHelper ( subject, pattern, extraArgs ... ) ) occ.insert ( index ); index++; for ( const ext::tree < SymbolType > & child : subject.getChildren ( ) ) - matchUnorderedInternal ( index, occ, child, pattern, subtreeVariable, subtreeGap ); + matchUnorderedInternal ( index, occ, child, pattern, extraArgs ... ); } template < class SymbolType > @@ -353,7 +289,7 @@ ext::set < unsigned > ExactPatternMatch::match ( const tree::UnorderedUnrankedTr unsigned i = 0; ext::set < unsigned > occ; - matchUnorderedInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), pattern.getSubtreeGap ( ) ); + matchUnorderedInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeGap ( ), pattern.getSubtreeWildcard ( ) ); return occ; } @@ -362,7 +298,7 @@ ext::set < unsigned > ExactPatternMatch::match ( const tree::UnrankedTree < Symb unsigned i = 0; ext::set < unsigned > occ; - matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), pattern.getSubtreeGap ( ) ); + matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeGap ( ), pattern.getSubtreeWildcard ( ) ); return occ; } @@ -371,7 +307,7 @@ ext::set < unsigned > ExactPatternMatch::match ( const tree::UnrankedTree < Symb unsigned i = 0; ext::set < unsigned > occ; - matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), pattern.getSubtreeGap ( ), pattern.getNodeWildcard ( ) ); + matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeGap ( ), pattern.getSubtreeWildcard ( ), pattern.getNodeWildcard ( ) ); return occ; } @@ -389,7 +325,7 @@ ext::set < unsigned > ExactPatternMatch::match ( const tree::RankedTree < Symbol unsigned i = 0; ext::set < unsigned > occ; - matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), { } ); + matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), ext::set < common::ranked_symbol < SymbolType > > { } ); return occ; } @@ -400,7 +336,7 @@ ext::set < unsigned > ExactPatternMatch::match ( const tree::RankedTree < Symbol tree::RankedTree < unsigned > repeats = tree::properties::ExactSubtreeRepeatsNaive::repeats ( subject ); - matchInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), pattern.getNonlinearVariables ( ), repeats.getContent ( ) ); + matchNonlinearInternal ( i, occ, subject.getContent ( ), pattern.getContent ( ), pattern.getSubtreeWildcard ( ), pattern.getNonlinearVariables ( ), repeats.getContent ( ) ); return occ; }