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

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

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

  ~IndexWriter() {
    Dispose();
  }

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

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

  public void setMaxFieldLength(int val) {
    libCLcsharpPINVOKE.IndexWriter_setMaxFieldLength(swigCPtr, val);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public void setMergeFactor(int val) {
    libCLcsharpPINVOKE.IndexWriter_setMergeFactor(swigCPtr, val);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public void setMinMergeDocs(int val) {
    libCLcsharpPINVOKE.IndexWriter_setMinMergeDocs(swigCPtr, val);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public void setMaxMergeDocs(int val) {
    libCLcsharpPINVOKE.IndexWriter_setMaxMergeDocs(swigCPtr, val);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public IndexWriter(string path, Analyzer a, bool create, bool closeDir) : this(libCLcsharpPINVOKE.new_IndexWriter__SWIG_0(path, Analyzer.getCPtr(a), create, closeDir), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public IndexWriter(string path, Analyzer a, bool create) : this(libCLcsharpPINVOKE.new_IndexWriter__SWIG_1(path, Analyzer.getCPtr(a), create), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public IndexWriter(Directory d, Analyzer a, bool create, bool closeDir) : this(libCLcsharpPINVOKE.new_IndexWriter__SWIG_2(Directory.getCPtr(d), Analyzer.getCPtr(a), create, closeDir), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public IndexWriter(Directory d, Analyzer a, bool create) : this(libCLcsharpPINVOKE.new_IndexWriter__SWIG_3(Directory.getCPtr(d), Analyzer.getCPtr(a), create), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

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

  public void addDocument(Document doc) {
    libCLcsharpPINVOKE.IndexWriter_addDocument(swigCPtr, Document.getCPtr(doc));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void optimize() {
    libCLcsharpPINVOKE.IndexWriter_optimize(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Directory getDirectory() {
    IntPtr cPtr = libCLcsharpPINVOKE.IndexWriter_getDirectory(swigCPtr);
    Directory ret = (cPtr == IntPtr.Zero) ? null : new Directory(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public bool getUseCompoundFile() {
    bool ret = libCLcsharpPINVOKE.IndexWriter_getUseCompoundFile(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void setUseCompoundFile(bool value) {
    libCLcsharpPINVOKE.IndexWriter_setUseCompoundFile(swigCPtr, value);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void setSimilarity(Similarity similarity) {
    libCLcsharpPINVOKE.IndexWriter_setSimilarity(swigCPtr, Similarity.getCPtr(similarity));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public Analyzer getAnalyzer() {
    IntPtr cPtr = libCLcsharpPINVOKE.IndexWriter_getAnalyzer(swigCPtr);
    Analyzer ret = (cPtr == IntPtr.Zero) ? null : new Analyzer(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
