// Path: src/main/java/com/github/liblevenshtein/collection/AbstractIterator.java
// public abstract class AbstractIterator<Type> implements Iterator<Type> {
// 
//   /**
//    * Next value to return. The next element to return is determined via
//    * {@link #advance()}
//    */
//   protected Type next = null;
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public boolean hasNext() {
//     advance();
//     return next != null;
//   }
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public Type next() {
//     advance();
//     final Type nextLocal = this.next;
//     this.next = null;
//     return nextLocal;
//   }
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public void remove() {
//     throw new UnsupportedOperationException(
//         "java.util.Iterator.remove() is not supported");
//   }
// 
//   /**
//    * Advances {@link #next} to the next, non-null value to return.
//    */
//   protected abstract void advance();
// }


import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import it.unimi.dsi.fastutil.chars.CharIterator;
import lombok.NonNull;
import com.github.liblevenshtein.collection.AbstractIterator;
    this.a = maxDistance < (Integer.MAX_VALUE - 1) >> 1
      ? (maxDistance << 1) + 1
      : Integer.MAX_VALUE;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public Iterator<CandidateType> iterator() {
    return this;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected void advance() {
    while (null == next
        && (null != labels && labels.hasNext() || !pendingQueue.isEmpty())) {

      if (null != labels && labels.hasNext()) {
        final DictionaryNode dictionaryNode = intersection.dictionaryNode();
        final State levenshteinState = intersection.levenshteinState();
        final char label = labels.nextChar();
        final DictionaryNode nextDictionaryNode =
          attributes.dictionaryTransition().of(dictionaryNode, label);
        final boolean[] characteristicVector =
          characteristicVector(label, term, k, i);
        final State nextLevenshteinState =
// Path: src/main/java/com/github/liblevenshtein/collection/AbstractIterator.java
// public abstract class AbstractIterator<Type> implements Iterator<Type> {
// 
//   /**
//    * Next value to return. The next element to return is determined via
//    * {@link #advance()}
//    */
//   protected Type next = null;
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public boolean hasNext() {
//     advance();
//     return next != null;
//   }
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public Type next() {
//     advance();
//     final Type nextLocal = this.next;
//     this.next = null;
//     return nextLocal;
//   }
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public void remove() {
//     throw new UnsupportedOperationException(
//         "java.util.Iterator.remove() is not supported");
//   }
// 
//   /**
//    * Advances {@link #next} to the next, non-null value to return.
//    */
//   protected abstract void advance();
// }


// Path: src/main/java/com/github/liblevenshtein/transducer/LazyTransducerCollection.java
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import it.unimi.dsi.fastutil.chars.CharIterator;
import lombok.NonNull;
import com.github.liblevenshtein.collection.AbstractIterator;

    this.a = maxDistance < (Integer.MAX_VALUE - 1) >> 1
      ? (maxDistance << 1) + 1
      : Integer.MAX_VALUE;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public Iterator<CandidateType> iterator() {
    return this;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected void advance() {
    while (null == next
        && (null != labels && labels.hasNext() || !pendingQueue.isEmpty())) {

      if (null != labels && labels.hasNext()) {
        final DictionaryNode dictionaryNode = intersection.dictionaryNode();
        final State levenshteinState = intersection.levenshteinState();
        final char label = labels.nextChar();
        final DictionaryNode nextDictionaryNode =
          attributes.dictionaryTransition().of(dictionaryNode, label);
        final boolean[] characteristicVector =
          characteristicVector(label, term, k, i);
        final State nextLevenshteinState =
          stateTransition.of(levenshteinState, characteristicVector);