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

namespace clucene.net {

using System;
using System.Runtime.InteropServices;

public class TermEnum : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal TermEnum(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

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

  ~TermEnum() {
    Dispose();
  }

  public virtual void Dispose() {
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
      swigCMemOwn = false;
      libCLcsharpPINVOKE.delete_TermEnum(swigCPtr);
    }
    swigCPtr = new HandleRef(null, IntPtr.Zero);
    GC.SuppressFinalize(this);
  }

  public virtual bool next() {
    bool ret = libCLcsharpPINVOKE.TermEnum_next(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual Term term() {
    IntPtr cPtr = libCLcsharpPINVOKE.TermEnum_term(swigCPtr);
    Term ret = (cPtr == IntPtr.Zero) ? null : new Term(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual int docFreq() {
    int ret = libCLcsharpPINVOKE.TermEnum_docFreq(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual void close() {
    libCLcsharpPINVOKE.TermEnum_close(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public virtual bool skipTo(Term target) {
    bool ret = libCLcsharpPINVOKE.TermEnum_skipTo(swigCPtr, Term.getCPtr(target));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
