
namespace clucene.net {

using System;

	public class _CL_p_p_lucene__index__TermFreqVectorArray : IDisposable 
	{
		private IntPtr swigCPtr;
		protected bool swigCMemOwn;

		internal _CL_p_p_lucene__index__TermFreqVectorArray(IntPtr cPtr, bool cMemoryOwn) 
		{
			swigCMemOwn = cMemoryOwn;
			swigCPtr = cPtr;
		}

		internal static IntPtr getCPtr(_CL_p_p_lucene__index__TermFreqVectorArray obj) 
		{
			return (obj == null) ? IntPtr.Zero : obj.swigCPtr;
		}

		~_CL_p_p_lucene__index__TermFreqVectorArray() 
		{
			Dispose();
		}

		public virtual void Dispose() 
		{
			if(swigCPtr != IntPtr.Zero && swigCMemOwn) 
			{
				swigCMemOwn = false;
				libCLcsharpPINVOKE.delete__CL_p_p_lucene__index__TermFreqVectorArray(swigCPtr);
			}
			swigCPtr = IntPtr.Zero;
			GC.SuppressFinalize(this);
		}

		public int length() 
		{
			return libCLcsharpPINVOKE._CL_p_p_lucene__index__TermFreqVectorArray_length(swigCPtr);
		}

		public void init(int len) 
		{
			libCLcsharpPINVOKE._CL_p_p_lucene__index__TermFreqVectorArray_init(swigCPtr, len);
		}

		public TermFreqVector get(int idx) 
		{
			IntPtr cPtr = libCLcsharpPINVOKE._CL_p_p_lucene__index__TermFreqVectorArray_get(swigCPtr, idx);
			return (cPtr == IntPtr.Zero) ? null : new TermFreqVector(cPtr, false);
		}

		public void set(TermFreqVector a, int i) 
		{
			libCLcsharpPINVOKE._CL_p_p_lucene__index__TermFreqVectorArray_set(swigCPtr, TermFreqVector.getCPtr(a), i);
		}

		public _CL_p_p_lucene__index__TermFreqVectorArray(TermFreqVector[] val) : this(libCLcsharpPINVOKE.new__CL_p_p_lucene__index__TermFreqVectorArray(), true) 
		{
			int size=val.Length;
			this.init(size);
			for ( int i=0;i<size;i++ )
				this.set(val[i],i);
		}

		public TermFreqVector[] toArray()
		{
			int len = this.length();
			TermFreqVector[] ret = new TermFreqVector[len];
			for ( int i=0;i<len;i++ )
				ret[i]=get(i);
			return ret;
		}
	}
}
