package clucene;
/* ----------------------------------------------------------------------------
 * 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.
 * ----------------------------------------------------------------------------- */


public class IndexReader {
  private long swigCPtr;
  protected boolean swigCMemOwn;

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

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

  protected void finalize() {
    delete();
  }

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

  public void commit() {
    CLjavaJNI.IndexReader_commit(swigCPtr);
  }

  public void undeleteAll() {
    CLjavaJNI.IndexReader_undeleteAll(swigCPtr);
  }

  public String[] getIndexedFieldNames(boolean storedTermVector) {
    return CLjavaJNI.IndexReader_getIndexedFieldNames(swigCPtr, storedTermVector);
  }

  public longxx norms(String field) { return new _CL_p_uint8_tArray(CLjavaJNI.IndexReader_norms(swigCPtr, field),true).toArray(); }

  public void setNorm(int doc, String field, float value) {
    CLjavaJNI.IndexReader_setNorm__SWIG_0(swigCPtr, doc, field, value);
  }

  public void setNorm(int doc, String field, byte value) {
    CLjavaJNI.IndexReader_setNorm__SWIG_1(swigCPtr, doc, field, value);
  }

  public static IndexReader open(String path) {
    long cPtr = CLjavaJNI.IndexReader_open__SWIG_0(path);
    return (cPtr == 0) ? null : new IndexReader(cPtr, true);
  }

  public static IndexReader open(Directory directory, boolean closeDirectory) {
    long cPtr = CLjavaJNI.IndexReader_open__SWIG_1(Directory.getCPtr(directory), closeDirectory);
    return (cPtr == 0) ? null : new IndexReader(cPtr, true);
  }

  public static IndexReader open(Directory directory) {
    long cPtr = CLjavaJNI.IndexReader_open__SWIG_2(Directory.getCPtr(directory));
    return (cPtr == 0) ? null : new IndexReader(cPtr, true);
  }

  public static long lastModified(String directory) {
    return CLjavaJNI.IndexReader_lastModified__SWIG_0(directory);
  }

  public static long lastModified(Directory directory) {
    return CLjavaJNI.IndexReader_lastModified__SWIG_1(Directory.getCPtr(directory));
  }

  public static long getCurrentVersion(Directory directory) {
    return CLjavaJNI.IndexReader_getCurrentVersion__SWIG_0(Directory.getCPtr(directory));
  }

  public static long getCurrentVersion(String directory) {
    return CLjavaJNI.IndexReader_getCurrentVersion__SWIG_1(directory);
  }

  public longxx getTermFreqVectors(int docNumber) { return new _CL_p_p_lucene__index__TermFreqVectorArray(CLjavaJNI.IndexReader_getTermFreqVectors(swigCPtr, docNumber),true).toArray(); }

  public TermFreqVector getTermFreqVector(int docNumber, String field) {
    long cPtr = CLjavaJNI.IndexReader_getTermFreqVector(swigCPtr, docNumber, field);
    return (cPtr == 0) ? null : new TermFreqVector(cPtr, true);
  }

  public static boolean indexExists(String directory) {
    return CLjavaJNI.IndexReader_indexExists__SWIG_0(directory);
  }

  public static boolean indexExists(Directory directory) {
    return CLjavaJNI.IndexReader_indexExists__SWIG_1(Directory.getCPtr(directory));
  }

  public int numDocs() {
    return CLjavaJNI.IndexReader_numDocs(swigCPtr);
  }

  public int maxDoc() {
    return CLjavaJNI.IndexReader_maxDoc(swigCPtr);
  }

  public Document document(int n) {
    long cPtr = CLjavaJNI.IndexReader_document(swigCPtr, n);
    return (cPtr == 0) ? null : new Document(cPtr, false);
  }

  public boolean isDeleted(int n) {
    return CLjavaJNI.IndexReader_isDeleted(swigCPtr, n);
  }

  public boolean hasDeletions() {
    return CLjavaJNI.IndexReader_hasDeletions(swigCPtr);
  }

  public TermEnum terms() {
    long cPtr = CLjavaJNI.IndexReader_terms__SWIG_0(swigCPtr);
    return (cPtr == 0) ? null : new TermEnum(cPtr, true);
  }

  public TermEnum terms(Term t) {
    long cPtr = CLjavaJNI.IndexReader_terms__SWIG_1(swigCPtr, Term.getCPtr(t));
    return (cPtr == 0) ? null : new TermEnum(cPtr, true);
  }

  public int docFreq(Term t) {
    return CLjavaJNI.IndexReader_docFreq(swigCPtr, Term.getCPtr(t));
  }

  public TermPositions termPositions() {
    long cPtr = CLjavaJNI.IndexReader_termPositions__SWIG_0(swigCPtr);
    return (cPtr == 0) ? null : new TermPositions(cPtr, true);
  }

  public TermPositions termPositions(Term term) {
    long cPtr = CLjavaJNI.IndexReader_termPositions__SWIG_1(swigCPtr, Term.getCPtr(term));
    return (cPtr == 0) ? null : new TermPositions(cPtr, true);
  }

  public TermDocs termDocs() {
    long cPtr = CLjavaJNI.IndexReader_termDocs__SWIG_0(swigCPtr);
    return (cPtr == 0) ? null : new TermDocs(cPtr, true);
  }

  public TermDocs termDocs(Term term) {
    long cPtr = CLjavaJNI.IndexReader_termDocs__SWIG_1(swigCPtr, Term.getCPtr(term));
    return (cPtr == 0) ? null : new TermDocs(cPtr, true);
  }

  public void Delete(int docNum) {
    CLjavaJNI.IndexReader_Delete__SWIG_0(swigCPtr, docNum);
  }

  public int Delete(Term term) {
    return CLjavaJNI.IndexReader_Delete__SWIG_1(swigCPtr, Term.getCPtr(term));
  }

  public void close() {
    CLjavaJNI.IndexReader_close(swigCPtr);
  }

  public static boolean isLocked(Directory directory) {
    return CLjavaJNI.IndexReader_isLocked__SWIG_0(Directory.getCPtr(directory));
  }

  public static boolean isLocked(String directory) {
    return CLjavaJNI.IndexReader_isLocked__SWIG_1(directory);
  }

  public static void unlock(Directory directory) {
    CLjavaJNI.IndexReader_unlock__SWIG_0(Directory.getCPtr(directory));
  }

  public static void unlock(String path) {
    CLjavaJNI.IndexReader_unlock__SWIG_1(path);
  }

  public Directory getDirectory() {
    long cPtr = CLjavaJNI.IndexReader_getDirectory(swigCPtr);
    return (cPtr == 0) ? null : new Directory(cPtr, false);
  }

}
