package org.spoofax.jsglr2.recovery;

public class RecoveryJob {

    public int backtrackChoicePointIndex;
    public int offset;
    public int iteration;
    final int iterationsQuota;
    public int quota;

    public RecoveryJob(int backtrackChoicePointIndex, int offset, int iterationsQuota) {
        this.backtrackChoicePointIndex = backtrackChoicePointIndex;
        this.offset = offset;
        this.iteration = 0;
        this.iterationsQuota = iterationsQuota;
    }

    boolean hasNextIteration() {
        return iteration < iterationsQuota;
    }

    int nextIteration() {
        if(this.backtrackChoicePointIndex > 0)
            this.backtrackChoicePointIndex--;

        quota = ++iteration;

        return iteration;
    }

}

@@ -416,17 +416,18 @@
 ation = 
-0
+-1
 ;%0A      
@@ -695,16 +695,17 @@
 quota = 
+(
 ++iterat
@@ -707,16 +707,21 @@
 teration
+ + 1)
 ;%0A%0A     

Fix recovery iteration indexing (start at 0)