001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 2.0.11
004 *
005 * Do not make changes to this file unless you know what you are doing--modify
006 * the SWIG interface file instead.
007 * ----------------------------------------------------------------------------- */
008
009package org.sbml.libsbml;
010
011/** 
012 * 
013 * Class of exceptions thrown by constructors of some libSBML objects.
014 * <p>
015 * <p style='color: #777; font-style: italic'>
016This class of objects is defined by libSBML only and has no direct
017equivalent in terms of SBML components.  This class is not prescribed by
018the SBML specifications, although it is used to implement features
019defined in SBML.
020</p>
021
022 * <p>
023 * In some situations, constructors for SBML objects may need to indicate
024 * to callers that the creation of the object failed.  The failure may be
025 * for different reasons, such as an attempt to use invalid parameters or a
026 * system condition such as a memory error.  To communicate this to
027 * callers, those classes will throw an {@link XMLConstructorException}.  
028 * <p>
029 * In languages that don't have an exception mechanism (e.g., C), the
030 * constructors generally try to return an error code instead of throwing
031 * an exception.
032 * <p>
033 * @see SBMLConstructorException
034 */
035
036public class XMLConstructorException extends java.lang.IllegalArgumentException {
037   private long swigCPtr;
038   protected boolean swigCMemOwn;
039
040   protected XMLConstructorException(long cPtr, boolean cMemoryOwn)
041   {
042     swigCMemOwn = cMemoryOwn;
043     swigCPtr    = cPtr;
044   }
045
046   protected static long getCPtr(XMLConstructorException obj)
047   {
048     return (obj == null) ? 0 : obj.swigCPtr;
049   }
050
051   protected static long getCPtrAndDisown (XMLConstructorException obj)
052   {
053     long ptr = 0;
054
055     if (obj != null)
056     {
057       ptr             = obj.swigCPtr;
058       obj.swigCMemOwn = false;
059     }
060
061     return ptr;
062   }
063
064  protected void finalize() {
065    delete();
066  }
067
068  public synchronized void delete() {
069    if (swigCPtr != 0) {
070      if (swigCMemOwn) {
071        swigCMemOwn = false;
072        libsbmlJNI.delete_XMLConstructorException(swigCPtr);
073      }
074      swigCPtr = 0;
075    }
076  }
077
078  /*
079   * To pass the message from an exception to the parent exception class,
080   * we have to create our own variant of the constructor that takes an
081   * extra string argument.
082   */
083  protected XMLConstructorException(long cPtr, boolean cMemoryOwn, String v)
084  {
085    super(v);
086    swigCMemOwn = cMemoryOwn;
087    swigCPtr    = cPtr;
088  }
089
090  /*
091   * Next, we define the public constructor to take a string (like all basic
092   * Java exception class constructors), and invoke our internal special
093   * constructor with the extra argument.
094   */
095  public XMLConstructorException(String v)
096  {
097    this(libsbmlJNI.new_XMLConstructorException(), true, v);
098  }
099
100  public XMLConstructorException() {
101    this(libsbmlJNI.new_XMLConstructorException(), true);
102  }
103
104}