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

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

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

  ~Sort() {
    Dispose();
  }

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

  public static Sort RELEVANCE {
    get {
      IntPtr cPtr = libCLcsharpPINVOKE.get_Sort_RELEVANCE();
      Sort ret = (cPtr == IntPtr.Zero) ? null : new Sort(cPtr, false);
      if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
      return ret;
    } 
  }

  public static Sort INDEXORDER {
    get {
      IntPtr cPtr = libCLcsharpPINVOKE.get_Sort_INDEXORDER();
      Sort ret = (cPtr == IntPtr.Zero) ? null : new Sort(cPtr, false);
      if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
      return ret;
    } 
  }

  public Sort() : this(libCLcsharpPINVOKE.new_Sort__SWIG_0(), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Sort(string field, bool reverse) : this(libCLcsharpPINVOKE.new_Sort__SWIG_1(field, reverse), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Sort(string field) : this(libCLcsharpPINVOKE.new_Sort__SWIG_2(field), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Sort(string[] fields) : this(libCLcsharpPINVOKE.new_Sort__SWIG_3(_CL_p_p_charArray.getCPtr(new _CL_p_p_charArray(fields))), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Sort(SortField field) : this(libCLcsharpPINVOKE.new_Sort__SWIG_4(SortField.getCPtr(field)), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Sort(SortField[] fields) : this(libCLcsharpPINVOKE.new_Sort__SWIG_5(_CL_p_p_lucene__search__SortFieldArray.getCPtr(new _CL_p_p_lucene__search__SortFieldArray(fields))), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void setSort(string field, bool reverse) {
    libCLcsharpPINVOKE.Sort_setSort__SWIG_0(swigCPtr, field, reverse);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void setSort(string field) {
    libCLcsharpPINVOKE.Sort_setSort__SWIG_1(swigCPtr, field);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void setSort(string[] fieldnames) {
    libCLcsharpPINVOKE.Sort_setSort__SWIG_2(swigCPtr, _CL_p_p_charArray.getCPtr(new _CL_p_p_charArray(fieldnames)));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void setSort(SortField field) {
    libCLcsharpPINVOKE.Sort_setSort__SWIG_3(swigCPtr, SortField.getCPtr(field));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void setSort(SortField[] fields) {
    libCLcsharpPINVOKE.Sort_setSort__SWIG_4(swigCPtr, _CL_p_p_lucene__search__SortFieldArray.getCPtr(new _CL_p_p_lucene__search__SortFieldArray(fields)));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

}

}
