/* ----------------------------------------------------------------------------
 * 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 TfIdfWeight extends Weight {
  private transient long swigCPtr;

  protected TfIdfWeight(long cPtr, boolean cMemoryOwn) {
    super(XapianJNI.TfIdfWeight_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

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

  protected static long swigRelease(TfIdfWeight 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_TfIdfWeight(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public TfIdfWeight(String normalizations) {
    this(XapianJNI.new_TfIdfWeight__SWIG_0(normalizations), true);
  }

  public TfIdfWeight(String normalizations, double slope, double delta) {
    this(XapianJNI.new_TfIdfWeight__SWIG_1(normalizations, slope, delta), true);
  }

  public TfIdfWeight(TfIdfWeight.wdf_norm wdf_normalization, TfIdfWeight.idf_norm idf_normalization, TfIdfWeight.wt_norm wt_normalization) {
    this(XapianJNI.new_TfIdfWeight__SWIG_2(wdf_normalization.swigValue(), idf_normalization.swigValue(), wt_normalization.swigValue()), true);
  }

  public TfIdfWeight(TfIdfWeight.wdf_norm wdf_norm_, TfIdfWeight.idf_norm idf_norm_, TfIdfWeight.wt_norm wt_norm_, double slope, double delta) {
    this(XapianJNI.new_TfIdfWeight__SWIG_3(wdf_norm_.swigValue(), idf_norm_.swigValue(), wt_norm_.swigValue(), slope, delta), true);
  }

  public TfIdfWeight() {
    this(XapianJNI.new_TfIdfWeight__SWIG_4(), true);
  }

  public String name() {
    return XapianJNI.TfIdfWeight_name(swigCPtr, this);
  }

  public double getSumPart(long wdf, long doclen, long uniqterm, long wdfdocmax) {
    return XapianJNI.TfIdfWeight_getSumPart(swigCPtr, this, wdf, doclen, uniqterm, wdfdocmax);
  }

  public double getMaxPart() {
    return XapianJNI.TfIdfWeight_getMaxPart(swigCPtr, this);
  }

  public Weight createFromParameters(String params) {
    long cPtr = XapianJNI.TfIdfWeight_createFromParameters(swigCPtr, this, params);
    return (cPtr == 0) ? null : new TfIdfWeight(cPtr, false);
  }

  public final static class wdf_norm {
    public final static TfIdfWeight.wdf_norm NONE = new TfIdfWeight.wdf_norm("NONE", XapianJNI.TfIdfWeight_wdf_norm_NONE_get());
    public final static TfIdfWeight.wdf_norm BOOLEAN = new TfIdfWeight.wdf_norm("BOOLEAN", XapianJNI.TfIdfWeight_wdf_norm_BOOLEAN_get());
    public final static TfIdfWeight.wdf_norm SQUARE = new TfIdfWeight.wdf_norm("SQUARE", XapianJNI.TfIdfWeight_wdf_norm_SQUARE_get());
    public final static TfIdfWeight.wdf_norm LOG = new TfIdfWeight.wdf_norm("LOG", XapianJNI.TfIdfWeight_wdf_norm_LOG_get());
    public final static TfIdfWeight.wdf_norm PIVOTED = new TfIdfWeight.wdf_norm("PIVOTED", XapianJNI.TfIdfWeight_wdf_norm_PIVOTED_get());
    public final static TfIdfWeight.wdf_norm LOG_AVERAGE = new TfIdfWeight.wdf_norm("LOG_AVERAGE", XapianJNI.TfIdfWeight_wdf_norm_LOG_AVERAGE_get());
    public final static TfIdfWeight.wdf_norm AUG_LOG = new TfIdfWeight.wdf_norm("AUG_LOG", XapianJNI.TfIdfWeight_wdf_norm_AUG_LOG_get());
    public final static TfIdfWeight.wdf_norm SQRT = new TfIdfWeight.wdf_norm("SQRT", XapianJNI.TfIdfWeight_wdf_norm_SQRT_get());
    public final static TfIdfWeight.wdf_norm AUG_AVERAGE = new TfIdfWeight.wdf_norm("AUG_AVERAGE", XapianJNI.TfIdfWeight_wdf_norm_AUG_AVERAGE_get());
    public final static TfIdfWeight.wdf_norm MAX = new TfIdfWeight.wdf_norm("MAX", XapianJNI.TfIdfWeight_wdf_norm_MAX_get());
    public final static TfIdfWeight.wdf_norm AUG = new TfIdfWeight.wdf_norm("AUG", XapianJNI.TfIdfWeight_wdf_norm_AUG_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static wdf_norm 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 " + wdf_norm.class + " with value " + swigValue);
    }

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

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

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

    private static wdf_norm[] swigValues = { NONE, BOOLEAN, SQUARE, LOG, PIVOTED, LOG_AVERAGE, AUG_LOG, SQRT, AUG_AVERAGE, MAX, AUG };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class idf_norm {
    public final static TfIdfWeight.idf_norm NONE = new TfIdfWeight.idf_norm("NONE", XapianJNI.TfIdfWeight_idf_norm_NONE_get());
    public final static TfIdfWeight.idf_norm TFIDF = new TfIdfWeight.idf_norm("TFIDF", XapianJNI.TfIdfWeight_idf_norm_TFIDF_get());
    public final static TfIdfWeight.idf_norm SQUARE = new TfIdfWeight.idf_norm("SQUARE", XapianJNI.TfIdfWeight_idf_norm_SQUARE_get());
    public final static TfIdfWeight.idf_norm FREQ = new TfIdfWeight.idf_norm("FREQ", XapianJNI.TfIdfWeight_idf_norm_FREQ_get());
    public final static TfIdfWeight.idf_norm PROB = new TfIdfWeight.idf_norm("PROB", XapianJNI.TfIdfWeight_idf_norm_PROB_get());
    public final static TfIdfWeight.idf_norm PIVOTED = new TfIdfWeight.idf_norm("PIVOTED", XapianJNI.TfIdfWeight_idf_norm_PIVOTED_get());
    public final static TfIdfWeight.idf_norm GLOBAL_FREQ = new TfIdfWeight.idf_norm("GLOBAL_FREQ", XapianJNI.TfIdfWeight_idf_norm_GLOBAL_FREQ_get());
    public final static TfIdfWeight.idf_norm LOG_GLOBAL_FREQ = new TfIdfWeight.idf_norm("LOG_GLOBAL_FREQ", XapianJNI.TfIdfWeight_idf_norm_LOG_GLOBAL_FREQ_get());
    public final static TfIdfWeight.idf_norm INCREMENTED_GLOBAL_FREQ = new TfIdfWeight.idf_norm("INCREMENTED_GLOBAL_FREQ", XapianJNI.TfIdfWeight_idf_norm_INCREMENTED_GLOBAL_FREQ_get());
    public final static TfIdfWeight.idf_norm SQRT_GLOBAL_FREQ = new TfIdfWeight.idf_norm("SQRT_GLOBAL_FREQ", XapianJNI.TfIdfWeight_idf_norm_SQRT_GLOBAL_FREQ_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static idf_norm 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 " + idf_norm.class + " with value " + swigValue);
    }

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

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

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

    private static idf_norm[] swigValues = { NONE, TFIDF, SQUARE, FREQ, PROB, PIVOTED, GLOBAL_FREQ, LOG_GLOBAL_FREQ, INCREMENTED_GLOBAL_FREQ, SQRT_GLOBAL_FREQ };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static class wt_norm {
    public final static TfIdfWeight.wt_norm NONE = new TfIdfWeight.wt_norm("NONE", XapianJNI.TfIdfWeight_wt_norm_NONE_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static wt_norm 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 " + wt_norm.class + " with value " + swigValue);
    }

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

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

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

    private static wt_norm[] swigValues = { NONE };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
