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

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

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

  ~Query() {
    Dispose();
  }

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

  public void setBoost(float b) {
    libCLcsharpPINVOKE.Query_setBoost(swigCPtr, b);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public float getBoost() {
    double ret = libCLcsharpPINVOKE.Query_getBoost(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual Query rewrite(IndexReader reader) {
    IntPtr cPtr = libCLcsharpPINVOKE.Query_rewrite(swigCPtr, IndexReader.getCPtr(reader));
    Query ret = (cPtr == IntPtr.Zero) ? null : new Query(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public Similarity getSimilarity(Searcher searcher) {
    IntPtr cPtr = libCLcsharpPINVOKE.Query_getSimilarity(swigCPtr, Searcher.getCPtr(searcher));
    Similarity ret = (cPtr == IntPtr.Zero) ? null : new Similarity(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public string ToString(string field) {
    string ret = libCLcsharpPINVOKE.Query_ToString__SWIG_0(swigCPtr, field);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public virtual bool equals(Query other) {
    bool ret = libCLcsharpPINVOKE.Query_equals(swigCPtr, Query.getCPtr(other));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public override string ToString() {
    string ret = libCLcsharpPINVOKE.Query_ToString__SWIG_1(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
