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

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

  protected void finalize() {
    delete();
  }

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

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

  public XmlValue() throws XmlException {
    this(dbxml_javaJNI.new_XmlValue__SWIG_0(), true);
  }

  public XmlValue(XmlDocument v) throws XmlException {
    this(dbxml_javaJNI.new_XmlValue__SWIG_1(XmlDocument.getCPtr(v)), true);
  }

  public XmlValue(double v) throws XmlException {
    this(dbxml_javaJNI.new_XmlValue__SWIG_2(v), true);
  }

  public XmlValue(String v) throws XmlException {
    this(dbxml_javaJNI.new_XmlValue__SWIG_3(v), true);
  }

  public XmlValue(boolean v) throws XmlException {
    this(dbxml_javaJNI.new_XmlValue__SWIG_4(v), true);
  }

  public XmlValue(int type, String v) throws XmlException {
    this(dbxml_javaJNI.new_XmlValue__SWIG_5(type, v), true);
  }

  public int getType(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_getType(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isNumber(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_isNumber(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isString(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_isString(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isBoolean(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_isBoolean(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isNode(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_isNode(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isDocument(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_isDocument(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isVariable(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_isVariable(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean isNull() throws XmlException {
    return dbxml_javaJNI.XmlValue_isNull(swigCPtr);
  }

  public double asNumber(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_asNumber(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public String asString(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_asString(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public boolean asBoolean(XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_asBoolean(swigCPtr, XmlQueryContext.getCPtr(context));
  }

  public XmlDocument asDocument(XmlQueryContext context) throws XmlException {
    return new XmlDocument(dbxml_javaJNI.XmlValue_asDocument(swigCPtr, XmlQueryContext.getCPtr(context)), true);
  }

  public boolean equals(XmlValue value, XmlQueryContext context) throws XmlException {
    return dbxml_javaJNI.XmlValue_equals(swigCPtr, XmlValue.getCPtr(value), XmlQueryContext.getCPtr(context));
  }

  // enums and constants
  public final static int NONE = dbxml_javaJNI.get_XmlValue_NONE();
  public final static int STRING = dbxml_javaJNI.get_XmlValue_STRING();
  public final static int NUMBER = dbxml_javaJNI.get_XmlValue_NUMBER();
  public final static int BOOLEAN = dbxml_javaJNI.get_XmlValue_BOOLEAN();
  public final static int DOCUMENT = dbxml_javaJNI.get_XmlValue_DOCUMENT();
  public final static int NODE = dbxml_javaJNI.get_XmlValue_NODE();
  public final static int VARIABLE = dbxml_javaJNI.get_XmlValue_VARIABLE();
  public final static int BINARY = dbxml_javaJNI.get_XmlValue_BINARY();
}
