/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 3.0.9
 *
 * 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 Weight {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

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

  protected void finalize() {
    delete();
  }

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

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

  public double getSumPart(long wdf, long doclen, long uniqterms) {
    return XapianJNI.Weight_getSumPart(swigCPtr, this, wdf, doclen, uniqterms);
  }

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

  public double getSumExtra(long doclen, long uniqterms) {
    return XapianJNI.Weight_getSumExtra(swigCPtr, this, doclen, uniqterms);
  }

  public double getMaxExtra() {
    return XapianJNI.Weight_getMaxExtra(swigCPtr, this);
  }

  public final static class type_smoothing {
    public final static Weight.type_smoothing TWO_STAGE_SMOOTHING = new Weight.type_smoothing("TWO_STAGE_SMOOTHING", XapianJNI.Weight_TWO_STAGE_SMOOTHING_get());
    public final static Weight.type_smoothing DIRICHLET_SMOOTHING = new Weight.type_smoothing("DIRICHLET_SMOOTHING", XapianJNI.Weight_DIRICHLET_SMOOTHING_get());
    public final static Weight.type_smoothing ABSOLUTE_DISCOUNT_SMOOTHING = new Weight.type_smoothing("ABSOLUTE_DISCOUNT_SMOOTHING", XapianJNI.Weight_ABSOLUTE_DISCOUNT_SMOOTHING_get());
    public final static Weight.type_smoothing JELINEK_MERCER_SMOOTHING = new Weight.type_smoothing("JELINEK_MERCER_SMOOTHING", XapianJNI.Weight_JELINEK_MERCER_SMOOTHING_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

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

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

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

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

    private static type_smoothing[] swigValues = { TWO_STAGE_SMOOTHING, DIRICHLET_SMOOTHING, ABSOLUTE_DISCOUNT_SMOOTHING, JELINEK_MERCER_SMOOTHING };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
