
namespace clucene.net {

using System;

	internal class _CL_p_p_charArray : IDisposable 
	{
		private IntPtr swigCPtr;
		protected bool swigCMemOwn;

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

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

		~_CL_p_p_charArray() 
		{
			Dispose();
		}

		public virtual void Dispose() 
		{
			if(swigCPtr != IntPtr.Zero && swigCMemOwn) 
			{
				swigCMemOwn = false;
				libCLcsharpPINVOKE.delete__CL_p_p_charArray(swigCPtr);
			}
			swigCPtr = IntPtr.Zero;
			GC.SuppressFinalize(this);
		}
		
		public int length() 
		{
			return libCLcsharpPINVOKE._CL_p_p_charArray_length(swigCPtr);
		}

		public void init(int len) 
		{
			libCLcsharpPINVOKE._CL_p_p_charArray_init(swigCPtr, len);
		}
		
		public string get(int idx) 
		{
			return libCLcsharpPINVOKE._CL_p_p_charArray_get(swigCPtr, idx);
		}

		public void set(string a, int i) 
		{
			libCLcsharpPINVOKE._CL_p_p_charArray_set(swigCPtr, a, i);
		}

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

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

	}

}
