/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 2.0.5
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.xapian;

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

  public Database(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

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

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        XapianJNI.delete_Database(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void addDatabase(Database database) {
    XapianJNI.Database_addDatabase(swigCPtr, this, Database.getCPtr(database), database);
  }

  public Database() {
    this(XapianJNI.new_Database__SWIG_0(), true);
  }

  public Database(String path) {
    this(XapianJNI.new_Database__SWIG_1(path), true);
  }

  public Database(Database other) {
    this(XapianJNI.new_Database__SWIG_2(Database.getCPtr(other), other), true);
  }

  public void reopen() {
    XapianJNI.Database_reopen(swigCPtr, this);
  }

  public void close() {
    XapianJNI.Database_close(swigCPtr, this);
  }

  public String toString() {
    return XapianJNI.Database_toString(swigCPtr, this);
  }

  public PostingIterator postListBegin(String tname) {
    return new PostingIterator(XapianJNI.Database_postListBegin(swigCPtr, this, tname), true);
  }

  public PostingIterator postListEnd(String tname) {
    return new PostingIterator(XapianJNI.Database_postListEnd(swigCPtr, this, tname), true);
  }

  public TermIterator termListBegin(long did) {
    return new TermIterator(XapianJNI.Database_termListBegin(swigCPtr, this, did), true);
  }

  public TermIterator termListEnd(long did) {
    return new TermIterator(XapianJNI.Database_termListEnd(swigCPtr, this, did), true);
  }

  public PositionIterator positionListBegin(long did, String tname) {
    return new PositionIterator(XapianJNI.Database_positionListBegin(swigCPtr, this, did, tname), true);
  }

  public PositionIterator positionListEnd(long did, String tname) {
    return new PositionIterator(XapianJNI.Database_positionListEnd(swigCPtr, this, did, tname), true);
  }

  public TermIterator allTermsBegin() {
    return new TermIterator(XapianJNI.Database_allTermsBegin__SWIG_0(swigCPtr, this), true);
  }

  public TermIterator allTermsEnd() {
    return new TermIterator(XapianJNI.Database_allTermsEnd__SWIG_0(swigCPtr, this), true);
  }

  public TermIterator allTermsBegin(String prefix) {
    return new TermIterator(XapianJNI.Database_allTermsBegin__SWIG_1(swigCPtr, this, prefix), true);
  }

  public TermIterator allTermsEnd(String prefix) {
    return new TermIterator(XapianJNI.Database_allTermsEnd__SWIG_1(swigCPtr, this, prefix), true);
  }

  public long getDocCount() {
    return XapianJNI.Database_getDocCount(swigCPtr, this);
  }

  public long getLastDocId() {
    return XapianJNI.Database_getLastDocId(swigCPtr, this);
  }

  public double getAvLength() {
    return XapianJNI.Database_getAvLength(swigCPtr, this);
  }

  public long getTermFreq(String tname) {
    return XapianJNI.Database_getTermFreq(swigCPtr, this, tname);
  }

  public boolean termExists(String tname) {
    return XapianJNI.Database_termExists(swigCPtr, this, tname);
  }

  public long getCollectionFreq(String tname) {
    return XapianJNI.Database_getCollectionFreq(swigCPtr, this, tname);
  }

  public long getValueFreq(int valno) {
    return XapianJNI.Database_getValueFreq(swigCPtr, this, valno);
  }

  public String getValueLowerBound(int valno) {
    return XapianJNI.Database_getValueLowerBound(swigCPtr, this, valno);
  }

  public String getValueUpperBound(int valno) {
    return XapianJNI.Database_getValueUpperBound(swigCPtr, this, valno);
  }

  public long getDoclengthLowerBound() {
    return XapianJNI.Database_getDoclengthLowerBound(swigCPtr, this);
  }

  public long getDoclengthUpperBound() {
    return XapianJNI.Database_getDoclengthUpperBound(swigCPtr, this);
  }

  public long getWdfUpperBound(String term) {
    return XapianJNI.Database_getWdfUpperBound(swigCPtr, this, term);
  }

  public ValueIterator valuestreamBegin(int slot) {
    return new ValueIterator(XapianJNI.Database_valuestreamBegin(swigCPtr, this, slot), true);
  }

  public ValueIterator valuestreamEnd(int arg0) {
    return new ValueIterator(XapianJNI.Database_valuestreamEnd(swigCPtr, this, arg0), true);
  }

  public long getDocLength(long docid) {
    return XapianJNI.Database_getDocLength(swigCPtr, this, docid);
  }

  public void keepAlive() {
    XapianJNI.Database_keepAlive(swigCPtr, this);
  }

  public Document getDocument(long did) {
    return new Document(XapianJNI.Database_getDocument(swigCPtr, this, did), true);
  }

  public String getSpellingSuggestion(String word, long max_edit_distance) {
    return XapianJNI.Database_getSpellingSuggestion__SWIG_0(swigCPtr, this, word, max_edit_distance);
  }

  public String getSpellingSuggestion(String word) {
    return XapianJNI.Database_getSpellingSuggestion__SWIG_1(swigCPtr, this, word);
  }

  public TermIterator spellingsBegin() {
    return new TermIterator(XapianJNI.Database_spellingsBegin(swigCPtr, this), true);
  }

  public TermIterator spellingsEnd() {
    return new TermIterator(XapianJNI.Database_spellingsEnd(swigCPtr, this), true);
  }

  public TermIterator synonymsBegin(String term) {
    return new TermIterator(XapianJNI.Database_synonymsBegin(swigCPtr, this, term), true);
  }

  public TermIterator synonymsEnd(String arg0) {
    return new TermIterator(XapianJNI.Database_synonymsEnd(swigCPtr, this, arg0), true);
  }

  public TermIterator synonymKeysBegin(String prefix) {
    return new TermIterator(XapianJNI.Database_synonymKeysBegin__SWIG_0(swigCPtr, this, prefix), true);
  }

  public TermIterator synonymKeysBegin() {
    return new TermIterator(XapianJNI.Database_synonymKeysBegin__SWIG_1(swigCPtr, this), true);
  }

  public TermIterator synonymKeysEnd(String prefix) {
    return new TermIterator(XapianJNI.Database_synonymKeysEnd__SWIG_0(swigCPtr, this, prefix), true);
  }

  public TermIterator synonymKeysEnd() {
    return new TermIterator(XapianJNI.Database_synonymKeysEnd__SWIG_1(swigCPtr, this), true);
  }

  public String getMetadata(String key) {
    return XapianJNI.Database_getMetadata(swigCPtr, this, key);
  }

  public TermIterator metadataKeysBegin(String prefix) {
    return new TermIterator(XapianJNI.Database_metadataKeysBegin__SWIG_0(swigCPtr, this, prefix), true);
  }

  public TermIterator metadataKeysBegin() {
    return new TermIterator(XapianJNI.Database_metadataKeysBegin__SWIG_1(swigCPtr, this), true);
  }

  public TermIterator metadataKeysEnd(String prefix) {
    return new TermIterator(XapianJNI.Database_metadataKeysEnd__SWIG_0(swigCPtr, this, prefix), true);
  }

  public TermIterator metadataKeysEnd() {
    return new TermIterator(XapianJNI.Database_metadataKeysEnd__SWIG_1(swigCPtr, this), true);
  }

  public String getUuid() {
    return XapianJNI.Database_getUuid(swigCPtr, this);
  }

  public boolean hasPositions() {
    return XapianJNI.Database_hasPositions(swigCPtr, this);
  }

}
