X-Git-Url: http://git.nguyen.vg/gitweb/?a=blobdiff_plain;f=FMIndex.cpp;h=1127c6ce2e4a899b008d843e9455d25c70ba60a3;hb=HEAD;hp=297604b41472a43e849ae48b08353635227dd1be;hpb=89dc22aee980ba16f757cd9a7f77478c2da50051;p=SXSI%2FTextCollection.git diff --git a/FMIndex.cpp b/FMIndex.cpp index 297604b..1127c6c 100644 --- a/FMIndex.cpp +++ b/FMIndex.cpp @@ -57,9 +57,11 @@ FMIndex::FMIndex(uchar * bwt, ulong length, unsigned samplerate_, { makewavelet(bwt); // Deletes bwt! bwt = 0; + + CSA::DeltaVector::Iterator notIndexedIt(notIndexed); // Make sampling tables - maketables(numberOfSamples_, tsType, notIndexed, niText); + maketables(numberOfSamples_, tsType, notIndexedIt, niText); } bool FMIndex::EmptyText(DocId k) const @@ -1055,7 +1057,7 @@ void FMIndex::makewavelet(uchar *bwt) #endif } -void FMIndex::maketables(ulong sampleLength, char tsType, CSA::DeltaVector & notIndexed, const string & niText) +void FMIndex::maketables(ulong sampleLength, char tsType, CSA::DeltaVector::Iterator & notIndexedIt, const string & niText) { // Calculate BWT end-marker position (of last inserted text) { @@ -1131,7 +1133,7 @@ void FMIndex::maketables(ulong sampleLength, char tsType, CSA::DeltaVector & not if (prevTextId == numberOfTexts) { prevTextId = 0; - while (notIndexed.isSet(prevTextId)) + while (notIndexedIt.isSet(prevTextId)) ++ prevTextId; // Now prevTextId points to the first indexed Doc ID. } @@ -1139,7 +1141,7 @@ void FMIndex::maketables(ulong sampleLength, char tsType, CSA::DeltaVector & not /** * Insert non-indexed texts */ - while (notIndexed.isSet(textId)) + while (notIndexedIt.isSet(textId)) { do { tsbuilder[tsb_i] = *nit_i; @@ -1169,12 +1171,12 @@ void FMIndex::maketables(ulong sampleLength, char tsType, CSA::DeltaVector & not // LF-mapping from '\0' does not work with this (pseudo) BWT. // Correct LF-mapping to the last char of the previous text: - p = textId - notIndexed.rank(textId); + p = textId - notIndexedIt.rank(textId); } else // Now c != '\0', do LF-mapping: p = C[c]+alphabetrank_i_tmp-1; } - while (textId > 0 && notIndexed.isSet(textId-1)) + while (textId > 0 && notIndexedIt.isSet(textId-1)) { do { -- tsb_i; @@ -1219,7 +1221,7 @@ void FMIndex::maketables(ulong sampleLength, char tsType, CSA::DeltaVector & not for(ulong i = 0; i < sampleLength; i ++) { // Find next sampled text position while ((posOfSuccEndmarker - x) % samplerate != 0 - || notIndexed.isSet(textId)) // Loop over non-indexed + || notIndexedIt.isSet(textId)) // Loop over non-indexed { --x; assert(x != ~0lu);