Skip to content
Snippets Groups Projects
Commit 777e526a authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fixes and simplifications in exact subtree match

parent c70317d5
No related branches found
No related tags found
1 merge request!145Merge jt
......@@ -45,8 +45,6 @@ private:
 
template < class SymbolType >
static void matchInternal(unsigned& index, ext::set<unsigned>& occ, const ext::tree < SymbolType > & subject, const ext::tree < SymbolType > & pattern);
template < class SymbolType >
static void matchInternal(unsigned& index, ext::set<unsigned>& occ, const ext::tree < common::ranked_symbol < SymbolType > > & subject, const ext::tree < common::ranked_symbol < SymbolType > > & pattern);
 
};
 
......@@ -57,7 +55,7 @@ bool ExactSubtreeMatch::matchHelper ( const ext::tree < SymbolType > & subject,
auto patternIter = pattern.getChildren ( ).begin ( );
auto subjectIter = subject.getChildren ( ).begin ( );
 
while ( patternIter != pattern.getChildren ( ).end ( ) || subjectIter != subject.getChildren ( ).end ( ) ) {
while ( patternIter != pattern.getChildren ( ).end ( ) && subjectIter != subject.getChildren ( ).end ( ) ) {
if ( matchHelper ( * subjectIter, * patternIter ) )
++ patternIter;
 
......@@ -88,16 +86,6 @@ void ExactSubtreeMatch::matchInternal ( unsigned & index, ext::set < unsigned >
matchInternal ( index, occ, child, pattern );
}
 
template < class SymbolType >
void ExactSubtreeMatch::matchInternal ( unsigned & index, ext::set < unsigned > & occ, const ext::tree < common::ranked_symbol < SymbolType > > & subject, const ext::tree < common::ranked_symbol < SymbolType > > & pattern ) {
if ( matchHelper ( subject, pattern ) ) occ.insert ( index );
index++;
for ( const ext::tree < common::ranked_symbol < SymbolType > > & child : subject.getChildren ( ) )
matchInternal ( index, occ, child, pattern );
}
template < class SymbolType >
ext::set < unsigned > ExactSubtreeMatch::match ( const tree::UnrankedTree < SymbolType > & subject, const tree::UnrankedTree < SymbolType > & pattern ) {
unsigned i = 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment