// Path: src/main/java/com/github/liblevenshtein/transducer/Position.java
// @Data
// @RequiredArgsConstructor
// public class Position implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Reference to the next node in this linked-list.  The next node may be null
//    */
//   private Position next = null;
// 
//   /**
//    * Index of the dictionary term represented by this coordinate.
//    */
//   private final int termIndex;
// 
//   /**
//    * Number of accumulated errors at this coordinate.
//    */
//   private final int numErrors;
// 
//   /**
//    * Whether this position should be treated specially, such as whether it
//    * represents a tranposition, merge, or split.
//    * @return Whether this position should be treated specially.
//    */
//   public boolean isSpecial() {
//     return false;
//   }
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/SpecialPosition.java
// @ToString(callSuper = true)
// @EqualsAndHashCode(callSuper = true)
// public class SpecialPosition extends Position implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds a new {@link Position}, extended with some special operation (e.g.
//    * transposition or merge-and-split).
//    * @param termIndex Index of the dictionary term represented by this coordinate.
//    * @param numErrors Number of accumulated errors at this coordinate.
//    */
//   public SpecialPosition(final int termIndex, final int numErrors) {
//     super(termIndex, numErrors);
//   }
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public boolean isSpecial() {
//     return true;
//   }
// }


import java.io.Serializable;
import lombok.NoArgsConstructor;
import com.github.liblevenshtein.transducer.Position;
import com.github.liblevenshtein.transducer.SpecialPosition;
package com.github.liblevenshtein.transducer.factory;




/**
 * Builds position vectors for the given algorithm.
 * @author Dylon Edwards
 * @since 2.1.0
 */
@NoArgsConstructor
public class PositionFactory implements Serializable {

  private static final long serialVersionUID = 1L;

  /**
   * Builds a dummy position.
   * @return Dummy position.
   */
  public Position build() {
    return new Position(-1, -1);
  }

  /**
   * Builds a position vector for the standard, Levenshtein algorihtm.
   * @param termIndex Current index of the spelling candidate.
   * @param numErrors Number of accumulated errors at index {@code termIndex}.
   * @return New position vector having index {@code termIndex} and error
   *   {@code numErrors}.
   */
  public Position build(final int termIndex, final int numErrors) {
    return new Position(termIndex, numErrors);
  }

  /**
   * Builds a position vector for the transposition and merge-and-split,
   * Levenshtein algorihtms.
   * @param termIndex Current index of the spelling candidate.
   * @param numErrors Number of accumulated errors at index {@code termIndex}.
   * @param isSpecial Either {@code 1} or {@code 0}, depending on whether the
   *   position is a special case (numErrors.g. a transposition position).
   * @return New position vector having index {@code termIndex}, error
   *   {@code numErrors}, and special marker {@code isSpecial}.
   */
  public Position build(final int termIndex, final int numErrors, final boolean isSpecial) {
    if (isSpecial) {
// Path: src/main/java/com/github/liblevenshtein/transducer/Position.java
// @Data
// @RequiredArgsConstructor
// public class Position implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Reference to the next node in this linked-list.  The next node may be null
//    */
//   private Position next = null;
// 
//   /**
//    * Index of the dictionary term represented by this coordinate.
//    */
//   private final int termIndex;
// 
//   /**
//    * Number of accumulated errors at this coordinate.
//    */
//   private final int numErrors;
// 
//   /**
//    * Whether this position should be treated specially, such as whether it
//    * represents a tranposition, merge, or split.
//    * @return Whether this position should be treated specially.
//    */
//   public boolean isSpecial() {
//     return false;
//   }
// }
// 
// Path: src/main/java/com/github/liblevenshtein/transducer/SpecialPosition.java
// @ToString(callSuper = true)
// @EqualsAndHashCode(callSuper = true)
// public class SpecialPosition extends Position implements Serializable {
// 
//   private static final long serialVersionUID = 1L;
// 
//   /**
//    * Builds a new {@link Position}, extended with some special operation (e.g.
//    * transposition or merge-and-split).
//    * @param termIndex Index of the dictionary term represented by this coordinate.
//    * @param numErrors Number of accumulated errors at this coordinate.
//    */
//   public SpecialPosition(final int termIndex, final int numErrors) {
//     super(termIndex, numErrors);
//   }
// 
//   /**
//    * {@inheritDoc}
//    */
//   @Override
//   public boolean isSpecial() {
//     return true;
//   }
// }


// Path: src/main/java/com/github/liblevenshtein/transducer/factory/PositionFactory.java
import java.io.Serializable;
import lombok.NoArgsConstructor;
import com.github.liblevenshtein.transducer.Position;
import com.github.liblevenshtein.transducer.SpecialPosition;

package com.github.liblevenshtein.transducer.factory;




/**
 * Builds position vectors for the given algorithm.
 * @author Dylon Edwards
 * @since 2.1.0
 */
@NoArgsConstructor
public class PositionFactory implements Serializable {

  private static final long serialVersionUID = 1L;

  /**
   * Builds a dummy position.
   * @return Dummy position.
   */
  public Position build() {
    return new Position(-1, -1);
  }

  /**
   * Builds a position vector for the standard, Levenshtein algorihtm.
   * @param termIndex Current index of the spelling candidate.
   * @param numErrors Number of accumulated errors at index {@code termIndex}.
   * @return New position vector having index {@code termIndex} and error
   *   {@code numErrors}.
   */
  public Position build(final int termIndex, final int numErrors) {
    return new Position(termIndex, numErrors);
  }

  /**
   * Builds a position vector for the transposition and merge-and-split,
   * Levenshtein algorihtms.
   * @param termIndex Current index of the spelling candidate.
   * @param numErrors Number of accumulated errors at index {@code termIndex}.
   * @param isSpecial Either {@code 1} or {@code 0}, depending on whether the
   *   position is a special case (numErrors.g. a transposition position).
   * @return New position vector having index {@code termIndex}, error
   *   {@code numErrors}, and special marker {@code isSpecial}.
   */
  public Position build(final int termIndex, final int numErrors, final boolean isSpecial) {
    if (isSpecial) {
      return new SpecialPosition(termIndex, numErrors);