- uint *tmp = new uint[numberOfTexts]; // FIXME Silly...
- for (unsigned i = 0; i < numberOfTexts; ++i)
- {
- tmp[i] = ((*endmarkerDocId)[i] + 1) % numberOfTexts;
-// cout << tmp[i] << ",";
+ if (sampled->access(p)) {
+ ulong j = sampled->rank1(p)-1;
+
+ (*suffixDocId)[j] = DocIdAtTextPos(textStartPos, x);
+
+ // calculate offset from text start:
+ (*suffixes)[j] = x - (*textStartPos)[(*suffixDocId)[j]];
+ }
+
+ uchar c = alphabetrank->access(p, alphabetrank_i_tmp);
+ tsbuilder[i] = c;
+
+ if (c == '\0')
+ {
+ --textId;
+ // LF-mapping from '\0' does not work with this (pseudo) BWT (see details from Wolfgang's thesis).
+ p = textId; // Correct LF-mapping to the last char of the previous text.
+ }
+ else // Now c != '\0', do LF-mapping:
+ p = C[c]+alphabetrank_i_tmp-1;