/* ----------------------------------------------------------------------------
 * 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 Hits : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

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

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

  ~Hits() {
    Dispose();
  }

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

  public Hits(Searcher s, Query q, Filter f, Sort sort) : this(libCLcsharpPINVOKE.new_Hits__SWIG_0(Searcher.getCPtr(s), Query.getCPtr(q), Filter.getCPtr(f), Sort.getCPtr(sort)), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Hits(Searcher s, Query q, Filter f) : this(libCLcsharpPINVOKE.new_Hits__SWIG_1(Searcher.getCPtr(s), Query.getCPtr(q), Filter.getCPtr(f)), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public int length() {
    int ret = libCLcsharpPINVOKE.Hits_length(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Document doc(int n) {
    Document ret = new Document(libCLcsharpPINVOKE.Hits_doc(swigCPtr, n), false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public int id(int n) {
    int ret = libCLcsharpPINVOKE.Hits_id(swigCPtr, n);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public float score(int n) {
    double ret = libCLcsharpPINVOKE.Hits_score(swigCPtr, n);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
