/* ----------------------------------------------------------------------------
 * 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 PostingIterator {
  private long swigCPtr;
  protected boolean swigCMemOwn;

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

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

  protected void finalize() {
    delete();
  }

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

  public PostingIterator() {
    this(XapianJNI.new_PostingIterator__SWIG_0(), true);
  }

  public PostingIterator(PostingIterator other) {
    this(XapianJNI.new_PostingIterator__SWIG_1(PostingIterator.getCPtr(other), other), true);
  }

  public void skipTo(long did) {
    XapianJNI.PostingIterator_skipTo(swigCPtr, this, did);
  }

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

  public long getWdf() {
    return XapianJNI.PostingIterator_getWdf(swigCPtr, this);
  }

  public PositionIterator positionListBegin() {
    return new PositionIterator(XapianJNI.PostingIterator_positionListBegin(swigCPtr, this), true);
  }

  public PositionIterator positionListEnd() {
    return new PositionIterator(XapianJNI.PostingIterator_positionListEnd(swigCPtr, this), true);
  }

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

  public boolean hasNext() {
    return XapianJNI.PostingIterator_hasNext(swigCPtr, this);
  }

  public long getDocId() {
    return XapianJNI.PostingIterator_getDocId(swigCPtr, this);
  }

  public long next() {
    return XapianJNI.PostingIterator_next(swigCPtr, this);
  }

  public boolean equals(PostingIterator other) {
    return XapianJNI.PostingIterator_equals(swigCPtr, this, PostingIterator.getCPtr(other), other);
  }

}
