package clucene;
public class _CL_p_p_lucene__index__TermFreqVectorArray {

  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected _CL_p_p_lucene__index__TermFreqVectorArray(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(_CL_p_p_lucene__index__TermFreqVectorArray obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      CLjavaJNI.delete__CL_p_p_lucene__index__TermFreqVectorArray(swigCPtr);
    }
    swigCPtr = 0;
  }

  public _CL_p_p_lucene__index__TermFreqVectorArray(TermFreqVector[] val) {
    this(CLjavaJNI.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;
	}

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

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

  public TermFreqVector get(int idx) {
    long cPtr = CLjavaJNI._CL_p_p_lucene__index__TermFreqVectorArray_get(swigCPtr, idx);
    return (cPtr == 0) ? null : new TermFreqVector(cPtr, false);
  }

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

}
