Commit 777e526a authored by Ing. Jan Trávníček's avatar Ing. Jan Trávníček

fixes and simplifications in exact subtree match

parent c70317d5
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment