/* ----------------------------------------------------------------------------
 * 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 MSet {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

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

  protected static long swigRelease(MSet 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_MSet(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public MSet() {
    this(XapianJNI.new_MSet(), true);
  }

  public int convertToPercent(double weight) {
    return XapianJNI.MSet_convertToPercent__SWIG_0(swigCPtr, this, weight);
  }

  public int convertToPercent(MSetIterator it) {
    return XapianJNI.MSet_convertToPercent__SWIG_1(swigCPtr, this, MSetIterator.getCPtr(it), it);
  }

  public long getTermFreq(String term) {
    return XapianJNI.MSet_getTermFreq(swigCPtr, this, term);
  }

  public double getTermWeight(String term) {
    return XapianJNI.MSet_getTermWeight(swigCPtr, this, term);
  }

  public long getFirstItem() {
    return XapianJNI.MSet_getFirstItem(swigCPtr, this);
  }

  public long getMatchesLowerBound() {
    return XapianJNI.MSet_getMatchesLowerBound(swigCPtr, this);
  }

  public long getMatchesEstimated() {
    return XapianJNI.MSet_getMatchesEstimated(swigCPtr, this);
  }

  public long getMatchesUpperBound() {
    return XapianJNI.MSet_getMatchesUpperBound(swigCPtr, this);
  }

  public long getUncollapsedMatchesLowerBound() {
    return XapianJNI.MSet_getUncollapsedMatchesLowerBound(swigCPtr, this);
  }

  public long getUncollapsedMatchesEstimated() {
    return XapianJNI.MSet_getUncollapsedMatchesEstimated(swigCPtr, this);
  }

  public long getUncollapsedMatchesUpperBound() {
    return XapianJNI.MSet_getUncollapsedMatchesUpperBound(swigCPtr, this);
  }

  public double getMaxAttained() {
    return XapianJNI.MSet_getMaxAttained(swigCPtr, this);
  }

  public double getMaxPossible() {
    return XapianJNI.MSet_getMaxPossible(swigCPtr, this);
  }

  public String snippet(String text, long length, Stem stemmer, long flags, String hi_start, String hi_end, String omit) {
    return XapianJNI.MSet_snippet__SWIG_0(swigCPtr, this, text, length, Stem.getCPtr(stemmer), stemmer, flags, hi_start, hi_end, omit);
  }

  public String snippet(String text, long length, Stem stemmer, long flags, String hi_start, String hi_end) {
    return XapianJNI.MSet_snippet__SWIG_1(swigCPtr, this, text, length, Stem.getCPtr(stemmer), stemmer, flags, hi_start, hi_end);
  }

  public String snippet(String text, long length, Stem stemmer, long flags, String hi_start) {
    return XapianJNI.MSet_snippet__SWIG_2(swigCPtr, this, text, length, Stem.getCPtr(stemmer), stemmer, flags, hi_start);
  }

  public String snippet(String text, long length, Stem stemmer, long flags) {
    return XapianJNI.MSet_snippet__SWIG_3(swigCPtr, this, text, length, Stem.getCPtr(stemmer), stemmer, flags);
  }

  public String snippet(String text, long length, Stem stemmer) {
    return XapianJNI.MSet_snippet__SWIG_4(swigCPtr, this, text, length, Stem.getCPtr(stemmer), stemmer);
  }

  public String snippet(String text, long length) {
    return XapianJNI.MSet_snippet__SWIG_5(swigCPtr, this, text, length);
  }

  public String snippet(String text) {
    return XapianJNI.MSet_snippet__SWIG_6(swigCPtr, this, text);
  }

  public void fetch(MSetIterator begin, MSetIterator end) {
    XapianJNI.MSet_fetch__SWIG_0(swigCPtr, this, MSetIterator.getCPtr(begin), begin, MSetIterator.getCPtr(end), end);
  }

  public void fetch(MSetIterator item) {
    XapianJNI.MSet_fetch__SWIG_1(swigCPtr, this, MSetIterator.getCPtr(item), item);
  }

  public void fetch() {
    XapianJNI.MSet_fetch__SWIG_2(swigCPtr, this);
  }

  public long size() {
    return XapianJNI.MSet_size(swigCPtr, this);
  }

  public boolean empty() {
    return XapianJNI.MSet_empty(swigCPtr, this);
  }

  public MSetIterator begin() {
    return new MSetIterator(XapianJNI.MSet_begin(swigCPtr, this), true);
  }

  public MSetIterator end() {
    return new MSetIterator(XapianJNI.MSet_end(swigCPtr, this), true);
  }

  public MSetIterator getElement(long i) {
    return new MSetIterator(XapianJNI.MSet_getElement(swigCPtr, this, i), true);
  }

  public MSetIterator back() {
    return new MSetIterator(XapianJNI.MSet_back(swigCPtr, this), true);
  }

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

  public long getDocId(long i) {
    return XapianJNI.MSet_getDocId(swigCPtr, this, i);
  }

  public Document getDocument(long i) {
    return new Document(XapianJNI.MSet_getDocument(swigCPtr, this, i), true);
  }

  public MSetIterator getHit(long i) {
    return new MSetIterator(XapianJNI.MSet_getHit(swigCPtr, this, i), true);
  }

  public int getDocumentPercentage(long i) {
    return XapianJNI.MSet_getDocumentPercentage(swigCPtr, this, i);
  }

  public final static int SNIPPET_BACKGROUND_MODEL = XapianJNI.MSet_SNIPPET_BACKGROUND_MODEL_get();
  public final static int SNIPPET_EXHAUSTIVE = XapianJNI.MSet_SNIPPET_EXHAUSTIVE_get();
  public final static int SNIPPET_EMPTY_WITHOUT_MATCH = XapianJNI.MSet_SNIPPET_EMPTY_WITHOUT_MATCH_get();
  public final static int SNIPPET_NGRAMS = XapianJNI.MSet_SNIPPET_NGRAMS_get();
  public final static int SNIPPET_CJK_NGRAM = XapianJNI.MSet_SNIPPET_CJK_NGRAM_get();

}
