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

package org.sbml.libsbml;

/** 
 * Class implementing methods for turning XML into tokens.
 * <p>
 * @deprecated libSBML internal 
 */

public class XMLTokenizer extends XMLHandler {
   private long swigCPtr;

   protected XMLTokenizer(long cPtr, boolean cMemoryOwn)
   {
     super(libsbmlJNI.SWIGXMLTokenizerUpcast(cPtr), cMemoryOwn);
     swigCPtr = cPtr;
   }

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

   protected static long getCPtrAndDisown (XMLTokenizer obj)
   {
     long ptr = 0;

     if (obj != null)
     {
       ptr             = obj.swigCPtr;
       obj.swigCMemOwn = false;
     }

     return ptr;
   }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      libsbmlJNI.delete_XMLTokenizer(swigCPtr);
    }
    swigCPtr = 0;
    super.delete();
  }

  
  /**
   * Creates a new XMLTokenizer.
   <p>
 * @deprecated libSBML internal
 */
 public XMLTokenizer() {
    this(libsbmlJNI.new_XMLTokenizer(), true);
  }

  
  /**
   * @return the encoding of the underlying XML document.
   <p>
 * @deprecated libSBML internal
 */
 public String getEncoding() {
    return libsbmlJNI.XMLTokenizer_getEncoding(swigCPtr, this);
  }

  
  /**
   * @return the xml version of the underlying XML document.
   <p>
 * @deprecated libSBML internal
 */
 public String getVersion() {
    return libsbmlJNI.XMLTokenizer_getVersion(swigCPtr, this);
  }

  
  /**
   * @return true if this XMLTokenizer has at least one XMLToken ready to
   * deliver, false otherwise.
   * <p>
   * Note that hasNext() == false does not imply isEOF() == true.  The
   * XMLTokenizer may simply be waiting for the XMLParser to parse more of
   * the document.
   <p>
 * @deprecated libSBML internal
 */
 public boolean hasNext() {
    return libsbmlJNI.XMLTokenizer_hasNext(swigCPtr, this);
  }

  
  /**
   * @return true if the end of the XML file (document) has been reached
   * and there are no more tokens to consume, false otherwise.
   <p>
 * @deprecated libSBML internal
 */
 public boolean isEOF() {
    return libsbmlJNI.XMLTokenizer_isEOF(swigCPtr, this);
  }

  
  /**
   * Consume the next XMLToken and return it.
   * <p>
   * @return the next XMLToken.
   <p>
 * @deprecated libSBML internal
 */
 public XMLToken next() {
    return new XMLToken(libsbmlJNI.XMLTokenizer_next(swigCPtr, this), true);
  }

  
  /**
   * Returns the next XMLToken without consuming it.  A subsequent call to
   * either peek() or next() will return the same token.
   * <p>
   * @return the next XMLToken.
   <p>
 * @deprecated libSBML internal
 */
 public XMLToken peek() {
    return new XMLToken(libsbmlJNI.XMLTokenizer_peek(swigCPtr, this), false);
  }

  
  /**
   * Prints a string representation of the underlying token stream, for
   * debugging purposes.
   <p>
 * @deprecated libSBML internal
 */
 public String toString() {
    return libsbmlJNI.XMLTokenizer_toString(swigCPtr, this);
  }

  
  /**
   * Receive notification of the XML declaration, i.e.
   * <?xml version='1.0' encoding='UTF-8'?>
   <p>
 * @deprecated libSBML internal
 */
 public void XML(String version, String encoding) {
    libsbmlJNI.XMLTokenizer_XML(swigCPtr, this, version, encoding);
  }

  
  /**
   * Receive notification of the start of an element.
   <p>
 * @deprecated libSBML internal
 */
 public void startElement(XMLToken element) {
    libsbmlJNI.XMLTokenizer_startElement(swigCPtr, this, XMLToken.getCPtr(element), element);
  }

  
  /**
   * Receive notification of the end of the document.
   <p>
 * @deprecated libSBML internal
 */
 public void endDocument() {
    libsbmlJNI.XMLTokenizer_endDocument(swigCPtr, this);
  }

  
  /**
   * Receive notification of the end of an element.
   <p>
 * @deprecated libSBML internal
 */
 public void endElement(XMLToken element) {
    libsbmlJNI.XMLTokenizer_endElement(swigCPtr, this, XMLToken.getCPtr(element), element);
  }

  
  /**
   * Receive notification of character data inside an element.
   <p>
 * @deprecated libSBML internal
 */
 public void characters(XMLToken data) {
    libsbmlJNI.XMLTokenizer_characters(swigCPtr, this, XMLToken.getCPtr(data), data);
  }

}
