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

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

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

  ~SegmentInfos() {
    Dispose();
  }

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

  public SegmentInfos(bool deleteMembers) : this(libCLcsharpPINVOKE.new_SegmentInfos__SWIG_0(deleteMembers), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public void clearto(int to) {
    libCLcsharpPINVOKE.SegmentInfos_clearto(swigCPtr, to);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

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

  public void add(SegmentInfo info) {
    libCLcsharpPINVOKE.SegmentInfos_add(swigCPtr, SegmentInfo.getCPtr(info));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public SegmentInfo info(int i) {
    IntPtr cPtr = libCLcsharpPINVOKE.SegmentInfos_info(swigCPtr, i);
    SegmentInfo ret = (cPtr == IntPtr.Zero) ? null : new SegmentInfo(cPtr, false);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public long getVersion() {
    long ret = libCLcsharpPINVOKE.SegmentInfos_getVersion(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static long readCurrentVersion(Directory directory) {
    long ret = libCLcsharpPINVOKE.SegmentInfos_readCurrentVersion(Directory.getCPtr(directory));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void read(Directory directory) {
    libCLcsharpPINVOKE.SegmentInfos_read(swigCPtr, Directory.getCPtr(directory));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void write(Directory directory) {
    libCLcsharpPINVOKE.SegmentInfos_write(swigCPtr, Directory.getCPtr(directory));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

}

}
