#include <static_sequence_wvtree.h>
static_sequence_wvtree::static_sequence_wvtree(uint * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) {
+ this->n = n;
for(uint i=0;i<n;i++)
symbols[i] = am->map(symbols[i]);
this->am = am;
}
static_sequence_wvtree::static_sequence_wvtree(uchar * symbols, uint n, wt_coder * c, static_bitsequence_builder * bmb, alphabet_mapper * am) {
+ this->n = n;
for(uint i=0;i<n;i++)
symbols[i] = (uchar)am->map((uint)symbols[i]);
this->am = am;
uint static_sequence_wvtree::rankLessThan(uint &symbol, uint pos) {
uint s = am->map(symbol);
// std::cout << "lessthan..." << std::endl;
- uint r = root->rankLessThan(s, pos, 0, c);
+ uint r = root->rankLessThan(s, pos);
symbol = am->unmap(s);
return r;
}
vector<int> static_sequence_wvtree::accessAll(uint i, uint j)
{
vector<int> resultSet;
- if (j > i)
+ if (j < i)
return resultSet;
- resultSet.reserve(j-i+1);
+ // resultSet.reserve(j-i+1); // avoid reallocation
root->access(resultSet, i, j);
for (vector<int>::iterator it = resultSet.begin(); it != resultSet.end(); ++it)
*it = am->unmap(*it);