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

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

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

  protected void finalize() {
    delete();
  }

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

  public Enquire(Database database) {
    this(XapianJNI.new_Enquire(Database.getCPtr(database), database), true);
  }

  public void setQuery(Query query, long qlen) {
    XapianJNI.Enquire_setQuery__SWIG_0(swigCPtr, this, Query.getCPtr(query), query, qlen);
  }

  public void setQuery(Query query) {
    XapianJNI.Enquire_setQuery__SWIG_1(swigCPtr, this, Query.getCPtr(query), query);
  }

  public Query getQuery() {
    return new Query(XapianJNI.Enquire_getQuery(swigCPtr, this), false);
  }

  public void addMatchspy(MatchSpy spy) {
    XapianJNI.Enquire_addMatchspy(swigCPtr, this, MatchSpy.getCPtr(spy), spy);
  }

  public void clearMatchspies() {
    XapianJNI.Enquire_clearMatchspies(swigCPtr, this);
  }

  public void setWeightingScheme(Weight weight_) {
    XapianJNI.Enquire_setWeightingScheme(swigCPtr, this, Weight.getCPtr(weight_), weight_);
  }

  public void setExpansionScheme(String eweightname_, double expand_k_) {
    XapianJNI.Enquire_setExpansionScheme__SWIG_0(swigCPtr, this, eweightname_, expand_k_);
  }

  public void setExpansionScheme(String eweightname_) {
    XapianJNI.Enquire_setExpansionScheme__SWIG_1(swigCPtr, this, eweightname_);
  }

  public void setCollapseKey(int collapse_key, long collapse_max) {
    XapianJNI.Enquire_setCollapseKey__SWIG_0(swigCPtr, this, collapse_key, collapse_max);
  }

  public void setCollapseKey(int collapse_key) {
    XapianJNI.Enquire_setCollapseKey__SWIG_1(swigCPtr, this, collapse_key);
  }

  public void setDocidOrder(Enquire.docid_order order) {
    XapianJNI.Enquire_setDocidOrder(swigCPtr, this, order.swigValue());
  }

  public void setCutoff(int percent_cutoff, double weight_cutoff) {
    XapianJNI.Enquire_setCutoff__SWIG_0(swigCPtr, this, percent_cutoff, weight_cutoff);
  }

  public void setCutoff(int percent_cutoff) {
    XapianJNI.Enquire_setCutoff__SWIG_1(swigCPtr, this, percent_cutoff);
  }

  public void setSortByRelevance() {
    XapianJNI.Enquire_setSortByRelevance(swigCPtr, this);
  }

  public void setSortByValue(int sort_key, boolean reverse) {
    XapianJNI.Enquire_setSortByValue(swigCPtr, this, sort_key, reverse);
  }

  public void setSortByKey(KeyMaker sorter, boolean reverse) {
    XapianJNI.Enquire_setSortByKey(swigCPtr, this, KeyMaker.getCPtr(sorter), sorter, reverse);
  }

  public void setSortByValueThenRelevance(int sort_key, boolean reverse) {
    XapianJNI.Enquire_setSortByValueThenRelevance(swigCPtr, this, sort_key, reverse);
  }

  public void setSortByKeyThenRelevance(KeyMaker sorter, boolean reverse) {
    XapianJNI.Enquire_setSortByKeyThenRelevance(swigCPtr, this, KeyMaker.getCPtr(sorter), sorter, reverse);
  }

  public void setSortByRelevanceThenValue(int sort_key, boolean reverse) {
    XapianJNI.Enquire_setSortByRelevanceThenValue(swigCPtr, this, sort_key, reverse);
  }

  public void setSortByRelevanceThenKey(KeyMaker sorter, boolean reverse) {
    XapianJNI.Enquire_setSortByRelevanceThenKey(swigCPtr, this, KeyMaker.getCPtr(sorter), sorter, reverse);
  }

  public void setTimeLimit(double time_limit) {
    XapianJNI.Enquire_setTimeLimit(swigCPtr, this, time_limit);
  }

  public MSet getMSet(long first, long maxitems, long checkatleast, RSet omrset, MatchDecider mdecider) {
    return new MSet(XapianJNI.Enquire_getMSet__SWIG_0(swigCPtr, this, first, maxitems, checkatleast, RSet.getCPtr(omrset), omrset, MatchDecider.getCPtr(mdecider), mdecider), true);
  }

  public MSet getMSet(long first, long maxitems, long checkatleast, RSet omrset) {
    return new MSet(XapianJNI.Enquire_getMSet__SWIG_1(swigCPtr, this, first, maxitems, checkatleast, RSet.getCPtr(omrset), omrset), true);
  }

  public MSet getMSet(long first, long maxitems, long checkatleast) {
    return new MSet(XapianJNI.Enquire_getMSet__SWIG_2(swigCPtr, this, first, maxitems, checkatleast), true);
  }

  public MSet getMSet(long first, long maxitems) {
    return new MSet(XapianJNI.Enquire_getMSet__SWIG_3(swigCPtr, this, first, maxitems), true);
  }

  public MSet getMSet(long first, long maxitems, RSet omrset, MatchDecider mdecider) {
    return new MSet(XapianJNI.Enquire_getMSet__SWIG_4(swigCPtr, this, first, maxitems, RSet.getCPtr(omrset), omrset, MatchDecider.getCPtr(mdecider), mdecider), true);
  }

  public MSet getMSet(long first, long maxitems, RSet omrset) {
    return new MSet(XapianJNI.Enquire_getMSet__SWIG_5(swigCPtr, this, first, maxitems, RSet.getCPtr(omrset), omrset), true);
  }

  public ESet getESet(long maxitems, RSet omrset, int flags, ExpandDecider edecider, double min_wt) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_0(swigCPtr, this, maxitems, RSet.getCPtr(omrset), omrset, flags, ExpandDecider.getCPtr(edecider), edecider, min_wt), true);
  }

  public ESet getESet(long maxitems, RSet omrset, int flags, ExpandDecider edecider) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_1(swigCPtr, this, maxitems, RSet.getCPtr(omrset), omrset, flags, ExpandDecider.getCPtr(edecider), edecider), true);
  }

  public ESet getESet(long maxitems, RSet omrset, int flags) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_2(swigCPtr, this, maxitems, RSet.getCPtr(omrset), omrset, flags), true);
  }

  public ESet getESet(long maxitems, RSet omrset) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_3(swigCPtr, this, maxitems, RSet.getCPtr(omrset), omrset), true);
  }

  public ESet getESet(long maxitems, RSet omrset, ExpandDecider edecider) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_4(swigCPtr, this, maxitems, RSet.getCPtr(omrset), omrset, ExpandDecider.getCPtr(edecider), edecider), true);
  }

  public ESet getESet(long maxitems, RSet rset, int flags, double k, ExpandDecider edecider, double min_wt) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_5(swigCPtr, this, maxitems, RSet.getCPtr(rset), rset, flags, k, ExpandDecider.getCPtr(edecider), edecider, min_wt), true);
  }

  public ESet getESet(long maxitems, RSet rset, int flags, double k, ExpandDecider edecider) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_6(swigCPtr, this, maxitems, RSet.getCPtr(rset), rset, flags, k, ExpandDecider.getCPtr(edecider), edecider), true);
  }

  public ESet getESet(long maxitems, RSet rset, int flags, double k) {
    return new ESet(XapianJNI.Enquire_getESet__SWIG_7(swigCPtr, this, maxitems, RSet.getCPtr(rset), rset, flags, k), true);
  }

  public TermIterator getMatchingTermsBegin(long did) {
    return new TermIterator(XapianJNI.Enquire_getMatchingTermsBegin__SWIG_0(swigCPtr, this, did), true);
  }

  public TermIterator getMatchingTermsEnd(long arg0) {
    return new TermIterator(XapianJNI.Enquire_getMatchingTermsEnd__SWIG_0(swigCPtr, this, arg0), true);
  }

  public TermIterator getMatchingTermsBegin(MSetIterator it) {
    return new TermIterator(XapianJNI.Enquire_getMatchingTermsBegin__SWIG_1(swigCPtr, this, MSetIterator.getCPtr(it), it), true);
  }

  public TermIterator getMatchingTermsEnd(MSetIterator arg0) {
    return new TermIterator(XapianJNI.Enquire_getMatchingTermsEnd__SWIG_1(swigCPtr, this, MSetIterator.getCPtr(arg0), arg0), true);
  }

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

  public String[] getMatchingTerms(MSetIterator item) { return XapianJNI.Enquire_getMatchingTerms(swigCPtr, this, MSetIterator.getCPtr(item), item); }

  public final static class docid_order {
    public final static Enquire.docid_order ASCENDING = new Enquire.docid_order("ASCENDING", XapianJNI.Enquire_ASCENDING_get());
    public final static Enquire.docid_order DESCENDING = new Enquire.docid_order("DESCENDING", XapianJNI.Enquire_DESCENDING_get());
    public final static Enquire.docid_order DONT_CARE = new Enquire.docid_order("DONT_CARE", XapianJNI.Enquire_DONT_CARE_get());

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

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

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

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

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

    private static docid_order[] swigValues = { ASCENDING, DESCENDING, DONT_CARE };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

  public final static int INCLUDE_QUERY_TERMS = XapianJNI.Enquire_INCLUDE_QUERY_TERMS_get();
  public final static int USE_EXACT_TERMFREQ = XapianJNI.Enquire_USE_EXACT_TERMFREQ_get();
}
