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

package com.sleepycat.dbxml;


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

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

  protected XmlResults() {
    this(0, false);
  }

  protected void finalize() {
    delete();
  }

  public void delete() /* no exception */ {
    if(swigCPtr != 0 && swigCMemOwn) {
      dbxml_javaJNI.delete_XmlResults(swigCPtr);
      swigCMemOwn = false;
    }
    swigCPtr = 0;
  }

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

  public XmlResults(XmlQueryContext context, com.sleepycat.db.DbTxn txn) throws XmlException {
    this(dbxml_javaJNI.new_XmlResults(XmlQueryContext.getCPtr(context), txn), true);
  }

  public XmlValue next() throws XmlException {
    long cPtr = dbxml_javaJNI.XmlResults_next__SWIG_0(swigCPtr);
    return (cPtr == 0) ? null : new XmlValue(cPtr, true);
  }

  public boolean next(XmlDocument document) throws XmlException {
    return dbxml_javaJNI.XmlResults_next__SWIG_1(swigCPtr, XmlDocument.getCPtr(document));
  }

  public boolean next(XmlDocument document, XmlValue value) throws XmlException {
    return dbxml_javaJNI.XmlResults_next__SWIG_2(swigCPtr, XmlDocument.getCPtr(document), XmlValue.getCPtr(value));
  }

  public XmlValue next(com.sleepycat.db.DbTxn txn) throws XmlException {
    long cPtr = dbxml_javaJNI.XmlResults_next__SWIG_3(swigCPtr, txn);
    return (cPtr == 0) ? null : new XmlValue(cPtr, true);
  }

  public boolean nextDocument(com.sleepycat.db.DbTxn txn, XmlDocument document) throws XmlException {
    return dbxml_javaJNI.XmlResults_nextDocument(swigCPtr, txn, XmlDocument.getCPtr(document));
  }

  public boolean nextDocumentAndValue(com.sleepycat.db.DbTxn txn, XmlDocument document, XmlValue value) throws XmlException {
    return dbxml_javaJNI.XmlResults_nextDocumentAndValue(swigCPtr, txn, XmlDocument.getCPtr(document), XmlValue.getCPtr(value));
  }

  public void reset() throws XmlException {
    dbxml_javaJNI.XmlResults_reset(swigCPtr);
  }

  public int size() { return dbxml_javaJNI.XmlResults_size(swigCPtr); }

  public void add(XmlValue value) throws XmlException {
    dbxml_javaJNI.XmlResults_add(swigCPtr, XmlValue.getCPtr(value));
  }

}
