/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (https://www.swig.org).
 * Version 4.3.0
 *
 * Do not make changes to this file unless you know what you are doing - modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.xapian;

public class TermGenerator {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

  protected TermGenerator(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  protected static long getCPtr(TermGenerator obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected static long swigRelease(TermGenerator obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

  @SuppressWarnings({"deprecation", "removal"})
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        XapianJNI.delete_TermGenerator(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public TermGenerator() {
    this(XapianJNI.new_TermGenerator(), true);
  }

  public void setStemmer(Stem stemmer) {
    XapianJNI.TermGenerator_setStemmer(swigCPtr, this, Stem.getCPtr(stemmer), stemmer);
  }

  public void setStopper(Stopper stop) {
    XapianJNI.TermGenerator_setStopper__SWIG_0(swigCPtr, this, Stopper.getCPtr(stop), stop);
  }

  public void setStopper() {
    XapianJNI.TermGenerator_setStopper__SWIG_1(swigCPtr, this);
  }

  public void setDocument(Document doc) {
    XapianJNI.TermGenerator_setDocument(swigCPtr, this, Document.getCPtr(doc), doc);
  }

  public Document getDocument() {
    return new Document(XapianJNI.TermGenerator_getDocument(swigCPtr, this), false);
  }

  public void setDatabase(WritableDatabase db) {
    XapianJNI.TermGenerator_setDatabase(swigCPtr, this, WritableDatabase.getCPtr(db), db);
  }

  public int setFlags(int toggle, int mask) {
    return XapianJNI.TermGenerator_setFlags__SWIG_0(swigCPtr, this, toggle, mask);
  }

  public int setFlags(int toggle) {
    return XapianJNI.TermGenerator_setFlags__SWIG_1(swigCPtr, this, toggle);
  }

  public void setStemmingStrategy(TermGenerator.stem_strategy strategy) {
    XapianJNI.TermGenerator_setStemmingStrategy(swigCPtr, this, strategy.swigValue());
  }

  public void setStopperStrategy(TermGenerator.stop_strategy strategy) {
    XapianJNI.TermGenerator_setStopperStrategy(swigCPtr, this, strategy.swigValue());
  }

  public void setMaxWordLength(long max_word_length) {
    XapianJNI.TermGenerator_setMaxWordLength(swigCPtr, this, max_word_length);
  }

  public void indexText(String text, long wdf_inc, String prefix) {
    XapianJNI.TermGenerator_indexText__SWIG_0(swigCPtr, this, text, wdf_inc, prefix);
  }

  public void indexText(String text, long wdf_inc) {
    XapianJNI.TermGenerator_indexText__SWIG_1(swigCPtr, this, text, wdf_inc);
  }

  public void indexText(String text) {
    XapianJNI.TermGenerator_indexText__SWIG_2(swigCPtr, this, text);
  }

  public void indexTextWithoutPositions(String text, long wdf_inc, String prefix) {
    XapianJNI.TermGenerator_indexTextWithoutPositions__SWIG_0(swigCPtr, this, text, wdf_inc, prefix);
  }

  public void indexTextWithoutPositions(String text, long wdf_inc) {
    XapianJNI.TermGenerator_indexTextWithoutPositions__SWIG_1(swigCPtr, this, text, wdf_inc);
  }

  public void indexTextWithoutPositions(String text) {
    XapianJNI.TermGenerator_indexTextWithoutPositions__SWIG_2(swigCPtr, this, text);
  }

  public void increaseTermpos(long delta) {
    XapianJNI.TermGenerator_increaseTermpos__SWIG_0(swigCPtr, this, delta);
  }

  public void increaseTermpos() {
    XapianJNI.TermGenerator_increaseTermpos__SWIG_1(swigCPtr, this);
  }

  public long getTermPos() {
    return XapianJNI.TermGenerator_getTermPos(swigCPtr, this);
  }

  public void setTermpos(long termpos) {
    XapianJNI.TermGenerator_setTermpos(swigCPtr, this, termpos);
  }

  public String toString() {
    return XapianJNI.TermGenerator_toString(swigCPtr, this);
  }

  public final static int FLAG_SPELLING = XapianJNI.TermGenerator_FLAG_SPELLING_get();
  public final static int FLAG_NGRAMS = XapianJNI.TermGenerator_FLAG_NGRAMS_get();
  public final static int FLAG_CJK_NGRAM = XapianJNI.TermGenerator_FLAG_CJK_NGRAM_get();

  public final static class stem_strategy {
    public final static TermGenerator.stem_strategy STEM_NONE = new TermGenerator.stem_strategy("STEM_NONE");
    public final static TermGenerator.stem_strategy STEM_SOME = new TermGenerator.stem_strategy("STEM_SOME");
    public final static TermGenerator.stem_strategy STEM_ALL = new TermGenerator.stem_strategy("STEM_ALL");
    public final static TermGenerator.stem_strategy STEM_ALL_Z = new TermGenerator.stem_strategy("STEM_ALL_Z");
    public final static TermGenerator.stem_strategy STEM_SOME_FULL_POS = new TermGenerator.stem_strategy("STEM_SOME_FULL_POS");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static stem_strategy swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + stem_strategy.class + " with value " + swigValue);
    }

    private stem_strategy(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private stem_strategy(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private stem_strategy(String swigName, stem_strategy swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static stem_strategy[] swigValues = { STEM_NONE, STEM_SOME, STEM_ALL, STEM_ALL_Z, STEM_SOME_FULL_POS };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class stop_strategy {
    public final static TermGenerator.stop_strategy STOP_NONE = new TermGenerator.stop_strategy("STOP_NONE");
    public final static TermGenerator.stop_strategy STOP_ALL = new TermGenerator.stop_strategy("STOP_ALL");
    public final static TermGenerator.stop_strategy STOP_STEMMED = new TermGenerator.stop_strategy("STOP_STEMMED");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static stop_strategy swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + stop_strategy.class + " with value " + swigValue);
    }

    private stop_strategy(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private stop_strategy(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private stop_strategy(String swigName, stop_strategy swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static stop_strategy[] swigValues = { STOP_NONE, STOP_ALL, STOP_STEMMED };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
