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 * In some situations, constructors for SBML objects may need to indicate to
016 * callers that the creation of the object failed.  The failure may be for
017 * different reasons, such as an attempt to use invalid parameters or a
018 * system condition such as a memory error.  To communicate this to callers,
019 * those classes will throw an {@link SBMLConstructorException}.
020 * <p>
021 * In languages that don't have an exception mechanism (e.g., C), the
022 * constructors generally try to return an error code instead of throwing
023 * an exception.
024 */
025
026public class SBMLConstructorException extends java.lang.IllegalArgumentException {
027   private long swigCPtr;
028   protected boolean swigCMemOwn;
029
030   protected SBMLConstructorException(long cPtr, boolean cMemoryOwn)
031   {
032     swigCMemOwn = cMemoryOwn;
033     swigCPtr    = cPtr;
034   }
035
036   protected static long getCPtr(SBMLConstructorException obj)
037   {
038     return (obj == null) ? 0 : obj.swigCPtr;
039   }
040
041   protected static long getCPtrAndDisown (SBMLConstructorException obj)
042   {
043     long ptr = 0;
044
045     if (obj != null)
046     {
047       ptr             = obj.swigCPtr;
048       obj.swigCMemOwn = false;
049     }
050
051     return ptr;
052   }
053
054  protected void finalize() {
055    delete();
056  }
057
058  public synchronized void delete() {
059    if (swigCPtr != 0) {
060      if (swigCMemOwn) {
061        swigCMemOwn = false;
062        libsbmlJNI.delete_SBMLConstructorException(swigCPtr);
063      }
064      swigCPtr = 0;
065    }
066  }
067
068  protected SBMLConstructorException(long cPtr, boolean cMemoryOwn, String v)
069  {
070    super(v);
071    swigCMemOwn = cMemoryOwn;
072    swigCPtr    = cPtr;
073  }
074
075  /**
076   * Exception thrown by libSBML object constructors if something prevents
077   * the object from being properly created.
078   *
079   * An example of what can cause this exception to be thrown is attempting
080   * to create an SBML component with an invalid SBML Level/Version
081   * combination.
082   */
083  public SBMLConstructorException(String v)
084  {
085    this(libsbmlJNI.new_SBMLConstructorException__SWIG_0(), true, v);
086  }
087
088  public SBMLConstructorException() {
089    this(libsbmlJNI.new_SBMLConstructorException__SWIG_0(), true);
090  }
091
092  public SBMLConstructorException(String errmsg, String sbmlErrMsg) {
093    this(libsbmlJNI.new_SBMLConstructorException__SWIG_1(errmsg, sbmlErrMsg), true);
094  }
095
096  public SBMLConstructorException(String elementName, SBMLNamespaces xmlns) {
097    this(libsbmlJNI.new_SBMLConstructorException__SWIG_2(elementName, SBMLNamespaces.getCPtr(xmlns), xmlns), true);
098  }
099
100  
101/**
102   * Returns the message associated with this SBML exception.
103   * <p>
104   * @return the message string.
105   */ public
106 String getSBMLErrMsg() {
107    return libsbmlJNI.SBMLConstructorException_getSBMLErrMsg(swigCPtr, this);
108  }
109
110}