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

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

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

  ~Document() {
    Dispose();
  }

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

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

  public void add(Field field) {
    libCLcsharpPINVOKE.Document_add(swigCPtr, Field.getCPtr(field));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public Field getField(string name) {
    IntPtr cPtr = libCLcsharpPINVOKE.Document_getField(swigCPtr, name);
    Field ret = (cPtr == IntPtr.Zero) ? null : new Field(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

  public DocumentFieldEnumeration fields() {
    IntPtr cPtr = libCLcsharpPINVOKE.Document_fields(swigCPtr);
    DocumentFieldEnumeration ret = (cPtr == IntPtr.Zero) ? null : new DocumentFieldEnumeration(cPtr, true);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

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

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

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

  public void removeField(string name) {
    libCLcsharpPINVOKE.Document_removeField(swigCPtr, name);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void removeFields(string name) {
    libCLcsharpPINVOKE.Document_removeFields(swigCPtr, name);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public string[] getValues(string name) { return new _CL_p_p_charArray(libCLcsharpPINVOKE.Document_getValues(swigCPtr, name),true).toArray(); }

}

}
