/* ----------------------------------------------------------------------------
 * 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 providing a unified interface to different XML parsers.
 * <p>
 * @deprecated libSBML internal 
 */

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

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

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

   protected static long getCPtrAndDisown (XMLHandler 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_XMLHandler(swigCPtr);
    }
    swigCPtr = 0;
  }

  /**
   * Equality comparison method for XMLHandler.
   * <p>
   * Because the Java methods for libSBML are actually wrappers around code
   * implemented in C++ and C, certain operations will not behave as
   * expected.  Equality comparison is one such case.  An instance of a
   * libSBML object class is actually a <em>proxy object</em>
   * wrapping the real underlying C/C++ object.  The normal <code>==</code>
   * equality operator in Java will <em>only compare the Java proxy objects</em>,
   * not the underlying native object.  The result is almost never what you
   * want in practical situations.  Unfortunately, Java does not provide a
   * way to override <code>==</code>.
   *  <p>
   * The alternative that must be followed is to use the
   * <code>equals()</code> method.  The <code>equals</code> method on this
   * class overrides the default java.lang.Object one, and performs an
   * intelligent comparison of instances of objects of this class.  The
   * result is an assessment of whether two libSBML Java objects are truly 
   * the same underlying native-code objects.
   *  <p>
   * The use of this method in practice is the same as the use of any other
   * Java <code>equals</code> method.  For example,
   * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns
   * <code>true</code> if <em>a</em> and <em>b</em> are references to the
   * same underlying object.
   *
   * @param sb a reference to an object to which the current object
   * instance will be compared
   *
   * @return <code>true</code> if <code>sb</code> refers to the same underlying 
   * native object as this one, <code>false</code> otherwise
   */
  public boolean equals(Object sb)
  {
    if ( this == sb ) 
    {
      return true;
    }
    return swigCPtr == getCPtr((XMLHandler)(sb));
  }

  /**
   * Returns a hashcode for this XMLHandler object.
   *
   * @return a hash code usable by Java methods that need them.
   */
  public int hashCode()
  {
    return (int)(swigCPtr^(swigCPtr>>>32));
  }

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

  
  /**
   * Receive notification of the beginning of the document.
   * <p>
   * By default, do nothing. Application writers may override this method
   * in a subclass to take specific actions at the start of the document.
   <p>
 * @deprecated libSBML internal
 */
 public void startDocument() {
    libsbmlJNI.XMLHandler_startDocument(swigCPtr, this);
  }

  
  /**
   * Receive notification of the XML declaration, i.e.
   * <?xml version='1.0' encoding='UTF-8'?>
   * <p>
   * By default, do nothing. Application writers may override this method
   * in a subclass to take specific actions at the declaration.
   <p>
 * @deprecated libSBML internal
 */
 public void XML(String version, String encoding) {
    libsbmlJNI.XMLHandler_XML(swigCPtr, this, version, encoding);
  }

  
  /**
   * Receive notification of the start of an element.
   * <p>
   * By default, do nothing. Application writers may override this method
   * in a subclass to take specific actions at the start of each element.
   <p>
 * @deprecated libSBML internal
 */
 public void startElement(XMLToken element) {
    libsbmlJNI.XMLHandler_startElement(swigCPtr, this, XMLToken.getCPtr(element), element);
  }

  
  /**
   * Receive notification of the end of the document.
   * <p>
   * By default, do nothing. Application writers may override this method
   * in a subclass to take specific actions at the end of the document.
   <p>
 * @deprecated libSBML internal
 */
 public void endDocument() {
    libsbmlJNI.XMLHandler_endDocument(swigCPtr, this);
  }

  
  /**
   * Receive notification of the end of an element.
   * <p>
   * By default, do nothing. Application writers may override this method
   * in a subclass to take specific actions at the end of each element.
   <p>
 * @deprecated libSBML internal
 */
 public void endElement(XMLToken element) {
    libsbmlJNI.XMLHandler_endElement(swigCPtr, this, XMLToken.getCPtr(element), element);
  }

  
  /**
   * Receive notification of character data inside an element.
   * <p>
   * By default, do nothing. Application writers may override this method
   * to take specific actions for each chunk of character data.
   <p>
 * @deprecated libSBML internal
 */
 public void characters(XMLToken data) {
    libsbmlJNI.XMLHandler_characters(swigCPtr, this, XMLToken.getCPtr(data), data);
  }

}
