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

simplification of position heap query algorithm

parent c6344c4a
No related branches found
No related tags found
No related merge requests found
...@@ -70,29 +70,23 @@ std::set < unsigned > PositionHeapFactors::query ( const indexes::PositionHeap < ...@@ -70,29 +70,23 @@ std::set < unsigned > PositionHeapFactors::query ( const indexes::PositionHeap <
unsigned depth = 0; unsigned depth = 0;
unsigned indexedStringSize = positionHeap.getString ( ).size ( ); unsigned indexedStringSize = positionHeap.getString ( ).size ( );
   
if(common::GlobalData::verbose) for ( const SymbolType & symbol : string.getContent ( ) ) {
std::clog << "on path possible occ (raw, string index): (" << node->getData ( ) << ", " << indexedStringSize - node->getData ( ) << ")";
   
if ( checkOcc ( string, depth, positionHeap.getString ( ), indexedStringSize - node->getData ( ) ) ) if(common::GlobalData::verbose)
res.insert ( indexedStringSize - node->getData ( ) ); std::clog << "on path possible occ (raw, string index): (" << node->getData ( ) << ", " << indexedStringSize - node->getData ( ) << ")";
if ( checkOcc ( string, depth, positionHeap.getString ( ), indexedStringSize - node->getData ( ) ) )
res.insert ( indexedStringSize - node->getData ( ) );
   
for ( const SymbolType & symbol : string.getContent ( ) ) {
auto iter = node->getChildren ( ).find ( symbol ); auto iter = node->getChildren ( ).find ( symbol );
if ( iter == node->getChildren ( ).end ( ) ) if ( iter == node->getChildren ( ).end ( ) )
return res; return res;
   
depth++; depth++;
node = & iter->second; node = & iter->second;
if(common::GlobalData::verbose)
std::clog << "on path possible occ (raw, string index): (" << node->getData ( ) << ", " << indexedStringSize - node->getData ( ) << ")";
if ( checkOcc ( string, depth, positionHeap.getString ( ), indexedStringSize - node->getData ( ) ) )
res.insert ( indexedStringSize - node->getData ( ) );
} }
   
for ( const std::pair < SymbolType, std::trie < SymbolType, unsigned > > & child : node->getChildren ( ) ) accumulateResult ( * node, res, indexedStringSize );
accumulateResult ( child.second, res, indexedStringSize );
return res; return res;
} }
   
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment