package clucene;
public class _CL_p_p_lucene__search__SearchableArray {
  private long swigCPtr;
  protected boolean swigCMemOwn;

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

  public static long getCPtr(_CL_p_p_lucene__search__SearchableArray 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__search__SearchableArray(swigCPtr);
    }
    swigCPtr = 0;
  }

  public _CL_p_p_lucene__search__SearchableArray(Searchable[] val) {
    this(CLjavaJNI.new__CL_p_p_lucene__search__SearchableArray(), true);
    
		int size=val.length;
		this.init(size);
		for ( int i=0;i<size;i++ )
			this.set(val[i],i);
  }
  
  public Searchable[] toArray()
	{
		int len = this.length();
		Searchable[] ret = new Searchable[len];
		for ( int i=0;i<len;i++ )
			ret[i]=get(i);
		return ret;
	}

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

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

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

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

}
