/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.5
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

namespace Xapian {

using System;
using System.Runtime.InteropServices;

public class ValueCountMatchSpy : MatchSpy {
  private HandleRef swigCPtr;

  internal ValueCountMatchSpy(IntPtr cPtr, bool cMemoryOwn) : base(XapianPINVOKE.ValueCountMatchSpy_SWIGUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(ValueCountMatchSpy obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~ValueCountMatchSpy() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          XapianPINVOKE.delete_ValueCountMatchSpy(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

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

  public ValueCountMatchSpy(uint slot_) : this(XapianPINVOKE.new_ValueCountMatchSpy__SWIG_1(slot_), true) {
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public TermIterator ValuesBegin() {
    TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_ValuesBegin(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator ValuesEnd() {
    TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_ValuesEnd(swigCPtr), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator TopValuesBegin(uint maxvalues) {
    TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_TopValuesBegin(swigCPtr, maxvalues), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public TermIterator TopValuesEnd(uint arg0) {
    TermIterator ret = new TermIterator(XapianPINVOKE.ValueCountMatchSpy_TopValuesEnd(swigCPtr, arg0), true);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public override void Apply(Document doc, double wt) {
    XapianPINVOKE.ValueCountMatchSpy_Apply(swigCPtr, Document.getCPtr(doc), wt);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

  public override string Name() {
    string ret = XapianPINVOKE.ValueCountMatchSpy_Name(swigCPtr);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public override void MergeResults(string s) {
    XapianPINVOKE.ValueCountMatchSpy_MergeResults(swigCPtr, s);
    if (XapianPINVOKE.SWIGPendingException.Pending) throw XapianPINVOKE.SWIGPendingException.Retrieve();
  }

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

}

}
