/* ----------------------------------------------------------------------------
 * 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 SegmentReader : IndexReader {
  private HandleRef swigCPtr;

  internal SegmentReader(IntPtr cPtr, bool cMemoryOwn) : base(libCLcsharpPINVOKE.SegmentReaderUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

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

  ~SegmentReader() {
    Dispose();
  }

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

  public SegmentReader(SegmentInfo si) : this(libCLcsharpPINVOKE.new_SegmentReader__SWIG_0(SegmentInfo.getCPtr(si)), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public SegmentReader(SegmentInfos sis, SegmentInfo si, bool closeDir) : this(libCLcsharpPINVOKE.new_SegmentReader__SWIG_1(SegmentInfos.getCPtr(sis), SegmentInfo.getCPtr(si), closeDir), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public static bool hasDeletions(SegmentInfo si) {
    bool ret = libCLcsharpPINVOKE.SegmentReader_hasDeletions__SWIG_0(SegmentInfo.getCPtr(si));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static bool usesCompoundFile(SegmentInfo si) {
    bool ret = libCLcsharpPINVOKE.SegmentReader_usesCompoundFile(SegmentInfo.getCPtr(si));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public static bool hasSeparateNorms(SegmentInfo si) {
    bool ret = libCLcsharpPINVOKE.SegmentReader_hasSeparateNorms(SegmentInfo.getCPtr(si));
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
