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

move nontemplated code to cpp

parent 3977497a
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,50 @@
#include "ExactSubtreeRepeats.h"
#include <registration/AlgoRegistration.hpp>
 
namespace tree::properties {
void ExactSubtreeRepeats::assignLevel ( ext::deque < unsigned > S, unsigned l, ExactSubtreeRepeats::ExactSubtreeRepeatsAux & aux ) {
std::queue < unsigned > Q4;
ext::vector < ext::deque < unsigned > > An ( aux.treeSize );
ext::vector < bool > Bn ( aux.treeSize );
while ( !S.empty ( ) ) {
unsigned i = S.front ( );
S.pop_front ( );
unsigned root = i + l - 1;
if ( root < aux.treeSize - 1 )
if ( aux.FC [ root ] ) {
unsigned k = aux.H[aux.P[root]];
An[k].push_back ( i );
if ( ! Bn [ k ] ) {
Bn[k] = true;
Q4.push ( k );
}
}
}
while ( !Q4.empty ( ) ) {
unsigned k = Q4.front ( );
Q4.pop ( );
aux.LA[k].push ( ext::make_pair ( An[k], l ) );
/* This is line 15 (in paper) in the Assign-Level algorithm
* It has no effect here, as I made "An" local and the function ends right after the while loop.
* I leave it here to be consistent with the algorithm.
*/
/* Bn[k] = false;
* while ( !An[k].empty ( ) )
* An[k].pop_front ( );
*/
}
}
}
namespace {
 
auto ExactRepeatsPostfixRankedTree = registration::AbstractRegister < tree::properties::ExactSubtreeRepeats, tree::PostfixRankedTree < unsigned, DefaultRankType >, const tree::PostfixRankedTree < > & > ( tree::properties::ExactSubtreeRepeats::repeats );
......
......@@ -272,46 +272,6 @@ void ExactSubtreeRepeats::ExactSubtreeRepeatsAux::buildFC ( const ext::vector <
}
}
 
void ExactSubtreeRepeats::assignLevel ( ext::deque < unsigned > S, unsigned l, ExactSubtreeRepeats::ExactSubtreeRepeatsAux & aux ) {
std::queue < unsigned > Q4;
ext::vector < ext::deque < unsigned > > An ( aux.treeSize );
ext::vector < bool > Bn ( aux.treeSize );
while ( !S.empty ( ) ) {
unsigned i = S.front ( );
S.pop_front ( );
unsigned root = i + l - 1;
if ( root < aux.treeSize - 1 )
if ( aux.FC [ root ] ) {
unsigned k = aux.H[aux.P[root]];
An[k].push_back ( i );
if ( ! Bn [ k ] ) {
Bn[k] = true;
Q4.push ( k );
}
}
}
while ( !Q4.empty ( ) ) {
unsigned k = Q4.front ( );
Q4.pop ( );
aux.LA[k].push ( ext::make_pair ( An[k], l ) );
/* This is line 15 (in paper) in the Assign-Level algorithm
* It has no effect here, as I made "An" local and the function ends right after the while loop.
* I leave it here to be consistent with the algorithm.
*/
/* Bn[k] = false;
* while ( !An[k].empty ( ) )
* An[k].pop_front ( );
*/
}
}
template < class SymbolType, class RankType >
void ExactSubtreeRepeats::partition ( ext::deque < unsigned > S, unsigned l, int ac, const ext::vector < common::ranked_symbol < SymbolType, RankType > > & symbols, ExactSubtreeRepeats::ExactSubtreeRepeatsAux & aux ) {
 
......
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