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

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

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

  ~MultiReader() {
    Dispose();
  }

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

  public MultiReader(Directory directory, SegmentInfos sis, bool closeDirectory, IndexReader[] subReaders) : this(libCLcsharpPINVOKE.new_MultiReader__SWIG_0(Directory.getCPtr(directory), SegmentInfos.getCPtr(sis), closeDirectory, _CL_p_p_lucene__index__IndexReaderArray.getCPtr(new _CL_p_p_lucene__index__IndexReaderArray(subReaders))), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public MultiReader(IndexReader[] subReaders) : this(libCLcsharpPINVOKE.new_MultiReader__SWIG_1(_CL_p_p_lucene__index__IndexReaderArray.getCPtr(new _CL_p_p_lucene__index__IndexReaderArray(subReaders))), true) {
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

}

}
