// Path: src/main/java/com/googlecode/javaewah/IntIterator.java
// public interface IntIterator {
// 
//     /**
//      * Is there more?
//      *
//      * @return true, if there is more, false otherwise
//      */
//     boolean hasNext();
// 
//     /**
//      * Return the next integer
//      *
//      * @return the integer
//      */
//     int next();
// }
// 
// Path: src/main/java/com/googlecode/javaewah32/EWAHCompressedBitmap32.java
// public static final int WORD_IN_BITS = 32;


import static com.googlecode.javaewah32.EWAHCompressedBitmap32.WORD_IN_BITS;
import com.googlecode.javaewah.IntIterator;
    }

    @Override
    public int next() {
        final int answer;
        if (literalHasNext()) {
            final int t = this.word & -this.word;
            answer = this.literalPosition - Integer.bitCount(t - 1);
            this.word ^= t;
        } else {
            answer = this.position--;
        }
        this.hasNext = this.moveToPreviousRLW();
        return answer;
    }

    private boolean moveToPreviousRLW() {
        while (!literalHasNext() && !runningHasNext()) {
            if (!this.ewahIter.hasPrevious()) {
                return false;
            }
            setRLW(this.ewahIter.previous());
        }
        return true;
    }

    private void setRLW(RunningLengthWord32 rlw) {
        this.wordLength = rlw.getNumberOfLiteralWords();
        this.wordPosition = this.ewahIter.position();
        this.position = this.runningLength;
// Path: src/main/java/com/googlecode/javaewah/IntIterator.java
// public interface IntIterator {
// 
//     /**
//      * Is there more?
//      *
//      * @return true, if there is more, false otherwise
//      */
//     boolean hasNext();
// 
//     /**
//      * Return the next integer
//      *
//      * @return the integer
//      */
//     int next();
// }
// 
// Path: src/main/java/com/googlecode/javaewah32/EWAHCompressedBitmap32.java
// public static final int WORD_IN_BITS = 32;


// Path: src/main/java/com/googlecode/javaewah32/ReverseIntIterator32.java
import static com.googlecode.javaewah32.EWAHCompressedBitmap32.WORD_IN_BITS;
import com.googlecode.javaewah.IntIterator;

    }

    @Override
    public int next() {
        final int answer;
        if (literalHasNext()) {
            final int t = this.word & -this.word;
            answer = this.literalPosition - Integer.bitCount(t - 1);
            this.word ^= t;
        } else {
            answer = this.position--;
        }
        this.hasNext = this.moveToPreviousRLW();
        return answer;
    }

    private boolean moveToPreviousRLW() {
        while (!literalHasNext() && !runningHasNext()) {
            if (!this.ewahIter.hasPrevious()) {
                return false;
            }
            setRLW(this.ewahIter.previous());
        }
        return true;
    }

    private void setRLW(RunningLengthWord32 rlw) {
        this.wordLength = rlw.getNumberOfLiteralWords();
        this.wordPosition = this.ewahIter.position();
        this.position = this.runningLength;
        this.runningLength -= WORD_IN_BITS * (rlw.getRunningLength() + this.wordLength);