File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -455,18 +455,23 @@ void MiddleWaveletIterator::skip(unsigned int pos) {
455455 // goTo(predicateOcurrence+pos);
456456
457457 int numJumps = 0 ;
458+ unsigned int posLeft = pos;
458459 while ((numJumps<pos)&&(posZ<maxZ)){
459- if ((posZ+pos )>nextZ) {
460+ if ((posZ+posLeft )>nextZ) {
460461 numJumps += (nextZ-posZ)+1 ; // count current jump
461462 predicateOcurrence++; // jump to the next occurrence
463+ posLeft = pos-numJumps; // set remaining offset
462464 if (predicateOcurrence<=numOcurrences){
463465 posY = predicateIndex->getAppearance (patY, predicateOcurrence);
464466 posZ = prevZ = adjZ.find (posY);
465467 nextZ = adjZ.last (posY);
466468 }
469+ else {
470+ throw std::runtime_error (" Cannot goTo on this pattern." );
471+ }
467472
468473 } else {
469- posZ=(posZ+pos );
474+ posZ=(posZ+posLeft );
470475 numJumps=pos;
471476 }
472477 }
You can’t perform that action at this time.
0 commit comments