//------------------------------------------------------------------------------
// <auto-generated />
//
// 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.
//------------------------------------------------------------------------------

namespace Xapian {

public class MSet : global::System.IDisposable {
  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal MSet(global::System.IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
  }

  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(MSet obj) {
    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
  }

  internal static global::System.Runtime.InteropServices.HandleRef swigRelease(MSet obj) {
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new global::System.ApplicationException("Cannot release ownership as memory is not owned");
      global::System.Runtime.InteropServices.HandleRef ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.Dispose();
      return ptr;
    } else {
      return new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
    }
  }

  ~MSet() {
    Dispose(false);
  }

  public void Dispose() {
    Dispose(true);
    global::System.GC.SuppressFinalize(this);
  }

  protected virtual void Dispose(bool disposing) {
    lock(this) {
      if (swigCPtr.Handle != global::System.IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          XapianPINVOKE.delete_MSet(swigCPtr);
        }
        swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
      }
    }
  }

  public MSet() : this(XapianPINVOKE.new_MSet(), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public int ConvertToPercent(double weight) {
    int ret = XapianPINVOKE.MSet_ConvertToPercent__SWIG_0(swigCPtr, weight);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int ConvertToPercent(MSetIterator it) {
    int ret = XapianPINVOKE.MSet_ConvertToPercent__SWIG_1(swigCPtr, MSetIterator.getCPtr(it));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetTermFreq(string term) {
    uint ret = XapianPINVOKE.MSet_GetTermFreq(swigCPtr, term);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double GetTermWeight(string term) {
    double ret = XapianPINVOKE.MSet_GetTermWeight(swigCPtr, term);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetFirstItem() {
    uint ret = XapianPINVOKE.MSet_GetFirstItem(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetMatchesLowerBound() {
    uint ret = XapianPINVOKE.MSet_GetMatchesLowerBound(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetMatchesEstimated() {
    uint ret = XapianPINVOKE.MSet_GetMatchesEstimated(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetMatchesUpperBound() {
    uint ret = XapianPINVOKE.MSet_GetMatchesUpperBound(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetUncollapsedMatchesLowerBound() {
    uint ret = XapianPINVOKE.MSet_GetUncollapsedMatchesLowerBound(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetUncollapsedMatchesEstimated() {
    uint ret = XapianPINVOKE.MSet_GetUncollapsedMatchesEstimated(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetUncollapsedMatchesUpperBound() {
    uint ret = XapianPINVOKE.MSet_GetUncollapsedMatchesUpperBound(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double GetMaxAttained() {
    double ret = XapianPINVOKE.MSet_GetMaxAttained(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public double GetMaxPossible() {
    double ret = XapianPINVOKE.MSet_GetMaxPossible(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text, uint length, Stem stemmer, uint flags, string hi_start, string hi_end, string omit) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_0(swigCPtr, text, length, Stem.getCPtr(stemmer), flags, hi_start, hi_end, omit);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text, uint length, Stem stemmer, uint flags, string hi_start, string hi_end) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_1(swigCPtr, text, length, Stem.getCPtr(stemmer), flags, hi_start, hi_end);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text, uint length, Stem stemmer, uint flags, string hi_start) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_2(swigCPtr, text, length, Stem.getCPtr(stemmer), flags, hi_start);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text, uint length, Stem stemmer, uint flags) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_3(swigCPtr, text, length, Stem.getCPtr(stemmer), flags);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text, uint length, Stem stemmer) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_4(swigCPtr, text, length, Stem.getCPtr(stemmer));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text, uint length) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_5(swigCPtr, text, length);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string Snippet(string text) {
    string ret = XapianPINVOKE.MSet_Snippet__SWIG_6(swigCPtr, text);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Fetch(MSetIterator begin, MSetIterator end) {
    XapianPINVOKE.MSet_Fetch__SWIG_0(swigCPtr, MSetIterator.getCPtr(begin), MSetIterator.getCPtr(end));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Fetch(MSetIterator item) {
    XapianPINVOKE.MSet_Fetch__SWIG_1(swigCPtr, MSetIterator.getCPtr(item));
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Fetch() {
    XapianPINVOKE.MSet_Fetch__SWIG_2(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public uint Size() {
    uint ret = XapianPINVOKE.MSet_Size(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public bool Empty() {
    bool ret = XapianPINVOKE.MSet_Empty(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public MSetIterator Begin() {
    MSetIterator ret = new MSetIterator(XapianPINVOKE.MSet_Begin(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public MSetIterator End() {
    MSetIterator ret = new MSetIterator(XapianPINVOKE.MSet_End(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public MSetIterator Back() {
    MSetIterator ret = new MSetIterator(XapianPINVOKE.MSet_Back(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string GetDescription() {
    string ret = XapianPINVOKE.MSet_GetDescription(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public uint GetDocId(uint i) {
    uint ret = XapianPINVOKE.MSet_GetDocId(swigCPtr, i);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Document GetDocument(uint i) {
    Document ret = new Document(XapianPINVOKE.MSet_GetDocument(swigCPtr, i), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public MSetIterator GetHit(uint i) {
    MSetIterator ret = new MSetIterator(XapianPINVOKE.MSet_GetHit(swigCPtr, i), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int GetDocumentPercentage(uint i) {
    int ret = XapianPINVOKE.MSet_GetDocumentPercentage(swigCPtr, i);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

}

}
