1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 4.0.2
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8 
9 package org.sbml.libsbml;
10 
11 /**
12  *  Exceptions thrown by some libSBML constructors.
13  <p>
14  * <p style='color: #777; font-style: italic'>
15 This class of objects is defined by libSBML only and has no direct
16 equivalent in terms of SBML components.  This class is not prescribed by
17 the SBML specifications, although it is used to implement features
18 defined in SBML.
19 </p>
20 
21  <p>
22  * In some situations, constructors for SBML objects may need to indicate
23  * to callers that the creation of the object failed.  The failure may be
24  * for different reasons, such as an attempt to use invalid parameters or a
25  * system condition such as a memory error.  To communicate this to
26  * callers, those classes will throw an {@link XMLConstructorException}.
27  <p>
28  * In languages that don't have an exception mechanism (e.g., C), the
29  * constructors generally try to return an error code instead of throwing
30  * an exception.
31  <p>
32  * @see SBMLConstructorException
33  */
34 
35 public class XMLConstructorException extends java.lang.IllegalArgumentException {
36    private long swigCPtr;
37    protected boolean swigCMemOwn;
38 
XMLConstructorException(long cPtr, boolean cMemoryOwn)39    protected XMLConstructorException(long cPtr, boolean cMemoryOwn)
40    {
41      swigCMemOwn = cMemoryOwn;
42      swigCPtr    = cPtr;
43    }
44 
getCPtr(XMLConstructorException obj)45    protected static long getCPtr(XMLConstructorException obj)
46    {
47      return (obj == null) ? 0 : obj.swigCPtr;
48    }
49 
getCPtrAndDisown(XMLConstructorException obj)50    protected static long getCPtrAndDisown (XMLConstructorException obj)
51    {
52      long ptr = 0;
53 
54      if (obj != null)
55      {
56        ptr             = obj.swigCPtr;
57        obj.swigCMemOwn = false;
58      }
59 
60      return ptr;
61    }
62 
63   @SuppressWarnings("deprecation")
finalize()64   protected void finalize() {
65     delete();
66   }
67 
delete()68   public synchronized void delete() {
69     if (swigCPtr != 0) {
70       if (swigCMemOwn) {
71         swigCMemOwn = false;
72         libsbmlJNI.delete_XMLConstructorException(swigCPtr);
73       }
74       swigCPtr = 0;
75     }
76   }
77 
78   /*
79    * To pass the message from an exception to the parent exception class,
80    * we have to create our own variant of the constructor that takes an
81    * extra string argument.
82    */
XMLConstructorException(long cPtr, boolean cMemoryOwn, String v)83   protected XMLConstructorException(long cPtr, boolean cMemoryOwn, String v)
84   {
85     super(v);
86     swigCMemOwn = cMemoryOwn;
87     swigCPtr    = cPtr;
88   }
89 
90   /*
91    * Next, we define the public constructor to take a string (like all basic
92    * Java exception class constructors), and invoke our internal special
93    * constructor with the extra argument.
94    */
XMLConstructorException(String v)95   public XMLConstructorException(String v)
96   {
97     this(libsbmlJNI.new_XMLConstructorException(), true, v);
98   }
99 
100 
101 /** * @internal */ public
XMLConstructorException()102  XMLConstructorException() {
103     this(libsbmlJNI.new_XMLConstructorException(), true);
104   }
105 
106 }
107