001/* ----------------------------------------------------------------------------
002 * This file was automatically generated by SWIG (http://www.swig.org).
003 * Version 3.0.12
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 *  Abstract Syntax Trees for mathematical expressions.
013 <p>
014 * <p style='color: #777; font-style: italic'>
015This class of objects is defined by libSBML only and has no direct
016equivalent in terms of SBML components.  This class is not prescribed by
017the SBML specifications, although it is used to implement features
018defined in SBML.
019</p>
020
021 <p>
022 * <a target='_blank'
023 * href='http://en.wikipedia.org/wiki/Abstract_syntax_tree'>Abstract Syntax
024 * Trees</a> (ASTs) are a simple kind of data structure used in libSBML for
025 * storing mathematical expressions.  LibSBML ASTs provide a canonical,
026 * in-memory representation for all mathematical formulas regardless of their
027 * original format (which might be MathML or might be text strings).
028 <p>
029 * <p>
030 * An AST <em>node</em> in libSBML is a recursive tree structure; each node has a
031 * type, a pointer to a value, and a list of children nodes.  Each {@link ASTNode}
032 * node may have none, one, two, or more children depending on its type.
033 * There are node types to represent numbers (with subtypes to distinguish
034 * integer, real, and rational numbers), names (e.g., constants or
035 * variables), simple mathematical operators, logical or relational operators
036 * and functions.  The following diagram illustrates an example of how the
037 * mathematical expression <code>'1 + 2'</code> is represented as an AST with
038 * one <em>plus</em> node having two <em>integer</em> children nodes for the numbers
039 * <code>1</code> and <code>2</code>.  The figure also shows the
040 * corresponding MathML representation:
041 <p>
042 * <table border="0" class="centered text-table width80 normal-font" style="padding-bottom: 0.5em">
043<caption class="top-caption">Example AST representation of a mathematical expression.</caption>
044<tr>
045<th width="50px">Infix</th>
046<th>AST</th>
047<th>MathML</th>
048</tr>
049<tr>
050<td valign="middle" align="center">
051<code>1 + 2</code>
052</td>
053<td valign="middle">
054  <object type="image/svg+xml" data="simple-ast.svg" class="centered" width="140px"></object>
055</td>
056<td valign="middle">
057<code>&lt;math xmlns="http://www.w3.org/1998/Math/MathML"&gt;</code><br>
058<code>&nbsp;&nbsp;&lt;apply&gt;</code><br>
059<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;plus/&gt;</code><br>
060<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;cn type="integer"&gt; 1 &lt;/cn&gt;</code><br>
061<code>&nbsp;&nbsp;&nbsp;&nbsp;&lt;cn type="integer"&gt; 2 &lt;/cn&gt;</code><br>
062<code>&nbsp;&nbsp;&lt;/apply&gt;</code><br>
063<code>&lt;/math&gt;</code>
064</td>
065</tr>
066</table>
067
068 <p>
069 * The following are other noteworthy points about the AST representation
070 * in libSBML:
071<p>
072 * <ul>
073 * <li> A numerical value represented in MathML as a real number with an
074 * exponent is preserved as such in the AST node representation, even if the
075 * number could be stored in a <code>double</code> data type.  This is done so that
076 * when an SBML model is read in and then written out again, the amount of
077 * change introduced by libSBML to the SBML during the round-trip activity is
078 * minimized.
079 <p>
080 * <li> Rational numbers are represented in an AST node using separate
081 * numerator and denominator values.  These can be retrieved using the
082 * methods {@link ASTNode#getNumerator()} and {@link ASTNode#getDenominator()}.
083 <p>
084 * <li> The children of an {@link ASTNode} are other {@link ASTNode} objects.  The list of
085 * children is empty for nodes that are leaf elements, such as numbers.
086 * For nodes that are actually roots of expression subtrees, the list of
087 * children points to the parsed objects that make up the rest of the
088 * expression.
089 *
090 * </ul> <p>
091 * For many applications, the details of ASTs are irrelevant because libSBML
092 * provides text-string based translation functions such as
093 * <a href='libsbml.html#formulaToL3String(org.sbml.libsbml.ASTNode)'><code>libsbml.formulaToL3String(ASTNode)</code></a> and
094 * <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a>.  If you find the complexity
095 * of using the AST representation of expressions too high for your purposes,
096 * perhaps the string-based functions will be more suitable.
097 <p>
098 * <h3><a class='anchor'
099 * name='ASTNodeType_t'>The set of possible ASTNode types</a></h3> 
100 <p>
101 * <p>
102 * Every {@link ASTNode} has an associated type code to indicate whether, for
103 * example, it holds a number or stands for an arithmetic operator.
104 <p>
105 * The type is recorded as a value drawn from a
106 * set of static integer constants defined in the class {@link 
107 * libsbmlConstants}. Their names begin with the characters <code>AST_.</code>
108 <p>
109 * The list of possible types is quite long, because it covers all the
110 * mathematical functions that are permitted in SBML. The values are shown
111 * in the following table:
112 <p>
113 * <table border="0" class="centered text-table align-bottom borderless code">
114<tr><td>AST_CONSTANT_E</td><td>         AST_FUNCTION_CSC</td><td>                       AST_LOGICAL_AND</td></tr>
115<tr><td>AST_CONSTANT_FALSE</td><td>     AST_FUNCTION_CSCH</td><td>                      AST_LOGICAL_IMPLIES<sup>2</sup></td></tr>
116<tr><td>AST_CONSTANT_PI</td><td>        AST_FUNCTION_DELAY</td><td>                     AST_LOGICAL_NOT</td></tr>
117<tr><td>AST_CONSTANT_TRUE</td><td>      AST_FUNCTION_EXP</td><td>                       AST_LOGICAL_OR</td></tr>
118<tr><td>AST_DIVIDE</td><td>             AST_FUNCTION_FACTORIAL</td><td>                 AST_LOGICAL_XOR</td></tr>
119<tr><td>AST_FUNCTION</td><td>           AST_FUNCTION_FLOOR</td><td>                     AST_MINUS</td></tr>
120<tr><td>AST_FUNCTION_ABS</td><td>       AST_FUNCTION_LN</td><td>                        AST_NAME</td></tr>
121<tr><td>AST_FUNCTION_ARCCOS</td><td>    AST_FUNCTION_LOG</td><td>                       AST_NAME_AVOGADRO<sup>1</sup></td></tr>
122<tr><td>AST_FUNCTION_ARCCOSH</td><td>   AST_FUNCTION_MAX<sup>2</sup></td><td>           AST_NAME_TIME</td></tr>
123<tr><td>AST_FUNCTION_ARCCOT</td><td>    AST_FUNCTION_MIN<sup>2</sup></td><td>           AST_ORIGINATES_IN_PACKAGE<sup>2</sup></tr>
124<tr><td>AST_FUNCTION_ARCCOTH</td><td>   AST_FUNCTION_PIECEWISE</td><td>                 AST_PLUS</td></tr>
125<tr><td>AST_FUNCTION_ARCCSC</td><td>    AST_FUNCTION_POWER</td><td>                     AST_POWER</td></tr>
126<tr><td>AST_FUNCTION_ARCCSCH</td><td>   AST_FUNCTION_QUOTIENT<sup>2</sup></td><td>      AST_RATIONAL</td></tr>
127<tr><td>AST_FUNCTION_ARCSEC</td><td>    AST_FUNCTION_RATE_OF<sup>2</sup></td><td>       AST_REAL</td></tr>
128<tr><td>AST_FUNCTION_ARCSECH</td><td>   AST_FUNCTION_REM<sup>2</sup></td><td>           AST_REAL_E</td></tr>
129<tr><td>AST_FUNCTION_ARCSIN</td><td>    AST_FUNCTION_ROOT</td><td>                      AST_RELATIONAL_EQ</td></tr>
130<tr><td>AST_FUNCTION_ARCSINH</td><td>   AST_FUNCTION_SEC</td><td>                       AST_RELATIONAL_GEQ</td></tr>
131<tr><td>AST_FUNCTION_ARCTAN</td><td>    AST_FUNCTION_SECH</td><td>                      AST_RELATIONAL_GT</td></tr>
132<tr><td>AST_FUNCTION_ARCTANH</td><td>   AST_FUNCTION_SIN</td><td>                       AST_RELATIONAL_LEQ</td></tr>
133<tr><td>AST_FUNCTION_CEILING</td><td>   AST_FUNCTION_SINH</td><td>                      AST_RELATIONAL_LT</td></tr>
134<tr><td>AST_FUNCTION_COS</td><td>       AST_FUNCTION_TAN</td><td>                       AST_RELATIONAL_NEQ</td></tr>
135<tr><td>AST_FUNCTION_COSH</td><td>      AST_FUNCTION_TANH</td><td>                      AST_TIMES</td></tr>
136<tr><td>AST_FUNCTION_COT</td><td>       AST_INTEGER</td><td>                            AST_UNKNOWN</td></tr>
137<tr><td>AST_FUNCTION_COTH</td><td>      AST_LAMBDA</td></tr>
138<tr><td><sup>1</sup> <span class='warning'><em>(Level&nbsp;3 only)</em></span><br/></td></tr>
139<tr><td><sup>2</sup> <span class='warning'><em>(Level&nbsp;3 Version&nbsp;2+ only)</em></span></td></tr>
140</table>
141
142
143
144 <p>
145 * The types have the following meanings:
146 <p>
147 * <ul>
148 * <li> If the node is basic mathematical operator (e.g., <code>'+'</code>), then the
149 * node's type will be {@link libsbmlConstants#AST_PLUS AST_PLUS},
150 * {@link libsbmlConstants#AST_MINUS AST_MINUS},
151 * {@link libsbmlConstants#AST_TIMES AST_TIMES},
152 * {@link libsbmlConstants#AST_DIVIDE AST_DIVIDE}, or
153 * {@link libsbmlConstants#AST_POWER AST_POWER}, as appropriate.
154 <p>
155 * <li> If the node is a predefined function or operator from SBML
156 * Level&nbsp;1 (in the string-based formula syntax used in Level&nbsp;1) or
157 * SBML Level&nbsp;2 and&nbsp;3 (in the subset of MathML used in SBML
158 * Levels&nbsp;2 and&nbsp;3), then the node's type
159 * will be either <code style='margin-right: 0'>AST_FUNCTION_</code><span
160 * class='placeholder-nospace'>X</span>, <code style='margin-right: 0'>AST_LOGICAL_</code><span
161 * class='placeholder-nospace'>X</span>, or <code style='margin-right: 0'>AST_RELATIONAL_</code><span
162 * class='placeholder-nospace'>X</span>, as appropriate.  (Examples:
163 * {@link libsbmlConstants#AST_FUNCTION_LOG AST_FUNCTION_LOG},
164 * {@link libsbmlConstants#AST_RELATIONAL_LEQ AST_RELATIONAL_LEQ}.)
165 <p>
166 * <li> If the node refers to a user-defined function, the node's type will
167 * be {@link libsbmlConstants#AST_FUNCTION AST_FUNCTION} (because it holds the
168 * name of the function).
169 <p>
170 * <li> If the node is a lambda expression, its type will be
171 * {@link libsbmlConstants#AST_LAMBDA AST_LAMBDA}.
172 <p>
173 * <li> If the node is a predefined constant (<code>'ExponentialE'</code>, <code>'Pi'</code>,
174 * <code>'True'</code> or <code>'False'</code>), then the node's type will be
175 * {@link libsbmlConstants#AST_CONSTANT_E AST_CONSTANT_E},
176 * {@link libsbmlConstants#AST_CONSTANT_PI AST_CONSTANT_PI},
177 * {@link libsbmlConstants#AST_CONSTANT_TRUE AST_CONSTANT_TRUE}, or
178 * {@link libsbmlConstants#AST_CONSTANT_FALSE AST_CONSTANT_FALSE}.
179 <p>
180 * <li> (Levels&nbsp;2 and&nbsp;3 only) If the node is the special MathML
181 * csymbol <code>time</code>, the value of the node will be
182 * {@link libsbmlConstants#AST_NAME_TIME AST_NAME_TIME}.  (Note, however, that the
183 * MathML csymbol <code>delay</code> is translated into a node of type
184 * {@link libsbmlConstants#AST_FUNCTION_DELAY AST_FUNCTION_DELAY}.  The difference is due to
185 * the fact that <code>time</code> is a single variable, whereas <code>delay</code> is actually a
186 * function taking arguments.)
187 <p>
188 * <li> (Level&nbsp;3 only) If the node is the special MathML csymbol
189 * <code>avogadro</code>, the value of the node will be
190 * {@link libsbmlConstants#AST_NAME_AVOGADRO AST_NAME_AVOGADRO}.
191 <p>
192 * <li> (Level&nbsp;3 Version&nbsp;2+ only) If the node is the special MathML
193 * csymbol <code>rateOf</code>, the value of the node will be
194 * {@link libsbmlConstants#AST_FUNCTION_RATE_OF AST_FUNCTION_RATE_OF}.
195 <p>
196 * <li> (Level&nbsp;3 Version&nbsp;2+ only) If the node is a MathML 
197 * operator that originates in a package, and is not defined in SBML 
198 * Leve&nbsp;3 core, the value of the node will be
199 * {@link libsbmlConstants#AST_ORIGINATES_IN_PACKAGE AST_ORIGINATES_IN_PACKAGE}.
200 <p>
201 * <li> If the node contains a numerical value, its type will be
202 * {@link libsbmlConstants#AST_INTEGER AST_INTEGER},
203 * {@link libsbmlConstants#AST_REAL AST_REAL},
204 * {@link libsbmlConstants#AST_REAL_E AST_REAL_E}, or
205 * {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}, as appropriate.
206 *
207 * </ul>
208 <p>
209 * <h3><a class='anchor' name='math-convert'>Converting between ASTs and text
210 * strings</a></h3>
211 <p>
212 * The text-string form of mathematical formulas produced by
213 * <a href='libsbml.html#formulaToString(java.lang.String)'><code>libsbml.formulaToString(String)</code></a> and
214 * <a href='libsbml.html#formulaToL3String(java.lang.String)'><code>libsbml.formulaToL3String(String)</code></a>, and read by
215 * <a href='libsbml.html#parseFormula(org.sbml.libsbml.ASTNode)'><code>libsbml.parseFormula(ASTNode)</code></a> and
216 * <a href='libsbml.html#parseL3Formula(org.sbml.libsbml.ASTNode)'><code>libsbml.parseL3Formula(ASTNode)</code></a>, are in a simple C-inspired
217 * infix notation.  A formula in one of these two text-string formats can be
218 * handed to a program that understands SBML mathematical expressions, or
219 * used as part of a translation system.  The libSBML distribution comes with
220 * example programs in the <code>'examples'</code> subdirectory that demonstrate such
221 * things as translating infix formulas into MathML and vice-versa.
222 <p>
223 * Please see the documentation for the functions <a href='libsbml.html#parseFormula(org.sbml.libsbml.ASTNode)'><code>libsbml.parseFormula(ASTNode)</code></a> and <a href='libsbml.html#parseL3Formula(org.sbml.libsbml.ASTNode)'><code>libsbml.parseL3Formula(ASTNode)</code></a> for detailed
224 * explanations of the infix syntax they accept.
225 <p>
226 * <h3><a class='anchor' name='math-interpretation'>Interpretation</a></h3>
227 <p>
228 * Proper mathematical interpretation of an {@link ASTNode} requires an 
229 * understanding of all the allowed MathML operators, the SBML-specific 
230 * csymbols, and of the named variables in the SBML model.  It is 
231 * important to note that an invalid {@link ASTNode} might not have a proper 
232 * mathematical interpretation--a 'minus' node with three children is 
233 * simply illegal, and cannot be interpreted.  Similarly, a named variable 
234 * that does not exist in the {@link Model} also cannot be interpreted.  In SBML 
235 * Level&nbsp;3 Version&nbsp;2, the ability was added to reference named 
236 * variables in MathML that might exist in SBML Level&nbsp;3 packages.  
237 * This means that if the software reading the SBML file (or this version 
238 * of libsbml) does not understand that package, MathML using named variables 
239 * from those packages will be legal, but will not be interpretable.  It 
240 * is valid to issue a warning in this case, and may be otherwise handled 
241 * as if an invalid variable name was used.  In all cases, the 'required' 
242 * attribute for the package in question must be set to 'true'.
243 <p>
244 * <h3><a class='anchor' name='math-history'>Historical notes</a></h3>
245 <p>
246 * Readers may wonder why this part of libSBML uses a seemingly less
247 * object-oriented design thanother parts.  Originally, much of libSBML was
248 * written in&nbsp;C.  All subsequent development was done in C++, but the
249 * complexity of some of the functionality for converting between infix, AST
250 * and MathML, coupled with the desire to maintain stability and backward
251 * compatibility, means that some of the underlying code is still written
252 * in&nbsp;C.  This has lead to the exposed API being more C-like.
253<p>
254 * @see <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a>
255 * @see <a href='libsbml.html#parseL3FormulaWithSettings(java.lang.String, org.sbml.libsbml.L3ParserSettings)'><code>libsbml.parseL3FormulaWithSettings(String, L3ParserSettings)</code></a>
256 * @see <a href='libsbml.html#parseL3FormulaWithModel(java.lang.String, org.sbml.libsbml.Model)'><code>libsbml.parseL3FormulaWithModel(String, Model)</code></a>
257 * @see <a href='libsbml.html#parseFormula(java.lang.String)'><code>libsbml.parseFormula(String)</code></a>
258 * @see <a href='libsbml.html#formulaToL3StringWithSettings(org.sbml.libsbml.ASTNode, org.sbml.libsbml.L3ParserSettings)'><code>libsbml.formulaToL3StringWithSettings(ASTNode, L3ParserSettings)</code></a>
259 * @see <a href='libsbml.html#formulaToL3String(org.sbml.libsbml.ASTNode)'><code>libsbml.formulaToL3String(ASTNode)</code></a>
260 * @see <a href='libsbml.html#formulaToString(org.sbml.libsbml.ASTNode)'><code>libsbml.formulaToString(ASTNode)</code></a>
261 * @see <a href='libsbml.html#getDefaultL3ParserSettings()'><code>libsbml.getDefaultL3ParserSettings()</code></a>
262 */
263
264public class ASTNode extends ASTBase {
265   private long swigCPtr;
266
267   protected ASTNode(long cPtr, boolean cMemoryOwn)
268   {
269     super(libsbmlJNI.ASTNode_SWIGUpcast(cPtr), cMemoryOwn);
270     swigCPtr = cPtr;
271   }
272
273   protected static long getCPtr(ASTNode obj)
274   {
275     return (obj == null) ? 0 : obj.swigCPtr;
276   }
277
278   protected static long getCPtrAndDisown (ASTNode obj)
279   {
280     long ptr = 0;
281
282     if (obj != null)
283     {
284       ptr             = obj.swigCPtr;
285       obj.swigCMemOwn = false;
286     }
287
288     return ptr;
289   }
290
291  protected void finalize() {
292    delete();
293  }
294
295  public synchronized void delete() {
296    if (swigCPtr != 0) {
297      if (swigCMemOwn) {
298        swigCMemOwn = false;
299        libsbmlJNI.delete_ASTNode(swigCPtr);
300      }
301      swigCPtr = 0;
302    }
303    super.delete();
304  }
305
306  /**
307   * Equality comparison method for ASTNode.
308   * <p>
309   * Because the Java methods for libSBML are actually wrappers around code
310   * implemented in C++ and C, certain operations will not behave as
311   * expected.  Equality comparison is one such case.  An instance of a
312   * libSBML object class is actually a <em>proxy object</em>
313   * wrapping the real underlying C/C++ object.  The normal <code>==</code>
314   * equality operator in Java will <em>only compare the Java proxy objects</em>,
315   * not the underlying native object.  The result is almost never what you
316   * want in practical situations.  Unfortunately, Java does not provide a
317   * way to override <code>==</code>.
318   *  <p>
319   * The alternative that must be followed is to use the
320   * <code>equals()</code> method.  The <code>equals</code> method on this
321   * class overrides the default java.lang.Object one, and performs an
322   * intelligent comparison of instances of objects of this class.  The
323   * result is an assessment of whether two libSBML Java objects are truly 
324   * the same underlying native-code objects.
325   *  <p>
326   * The use of this method in practice is the same as the use of any other
327   * Java <code>equals</code> method.  For example,
328   * <em>a</em><code>.equals(</code><em>b</em><code>)</code> returns
329   * <code>true</code> if <em>a</em> and <em>b</em> are references to the
330   * same underlying object.
331   *
332   * @param sb a reference to an object to which the current object
333   * instance will be compared
334   *
335   * @return <code>true</code> if <code>sb</code> refers to the same underlying 
336   * native object as this one, <code>false</code> otherwise
337   */
338  public boolean equals(Object sb)
339  {
340    if ( this == sb ) 
341    {
342      return true;
343    }
344    return swigCPtr == getCPtr((ASTNode)(sb));
345  }
346
347  /**
348   * Returns a hashcode for this ASTNode object.
349   *
350   * @return a hash code usable by Java methods that need them.
351   */
352  public int hashCode()
353  {
354    return (int)(swigCPtr^(swigCPtr>>>32));
355  }
356
357  
358/** * @internal */ public
359 ASTNode(int type) {
360    this(libsbmlJNI.new_ASTNode__SWIG_0(type), true);
361  }
362
363  
364/** * @internal */ public
365 ASTNode() {
366    this(libsbmlJNI.new_ASTNode__SWIG_1(), true);
367  }
368
369  
370/** * @internal */ public
371 ASTNode(SBMLNamespaces sbmlns, int type) {
372    this(libsbmlJNI.new_ASTNode__SWIG_2(SBMLNamespaces.getCPtr(sbmlns), sbmlns, type), true);
373  }
374
375  
376/** * @internal */ public
377 ASTNode(SBMLNamespaces sbmlns) {
378    this(libsbmlJNI.new_ASTNode__SWIG_3(SBMLNamespaces.getCPtr(sbmlns), sbmlns), true);
379  }
380
381  
382/**
383   * Copy constructor; creates a deep copy of the given {@link ASTNode}.
384   <p>
385   * @param orig the {@link ASTNode} to be copied.
386   */ public
387 ASTNode(ASTNode orig) {
388    this(libsbmlJNI.new_ASTNode__SWIG_4(ASTNode.getCPtr(orig), orig), true);
389  }
390
391  
392/**
393   * Frees the name of this {@link ASTNode} and sets it to <code>null.</code>
394   <p>
395   * This operation is only applicable to {@link ASTNode} objects corresponding to
396   * operators, numbers, or {@link libsbmlConstants#AST_UNKNOWN AST_UNKNOWN}.  This
397   * method has no effect on other types of nodes.
398   <p>
399   * <p>
400 * @return integer value indicating success/failure of the
401 * function.   The possible values
402 * returned by this function are:
403   * <ul>
404   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
405   * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE}
406   * </ul>
407   */ public
408 int freeName() {
409    return libsbmlJNI.ASTNode_freeName(swigCPtr, this);
410  }
411
412  
413/**
414   * Converts this {@link ASTNode} to a canonical form.
415   <p>
416   * The rules determining the canonical form conversion are as follows:
417   <p>
418   * <ul>
419   * <li> If the node type is {@link libsbmlConstants#AST_NAME AST_NAME}
420   * and the node name matches <code>'ExponentialE'</code>, <code>'Pi'</code>, <code>'True'</code> or
421   * <code>'False'</code> the node type is converted to the corresponding
422   * <code>AST_CONSTANT_</code><em><span class='placeholder'>X</span></em> type.
423   * <li> If the node type is an {@link libsbmlConstants#AST_FUNCTION AST_FUNCTION} and
424   * the node name matches an SBML (MathML) function name, logical operator name,
425   * or relational operator name, the node is converted to the corresponding
426   * <code>AST_FUNCTION_</code><em><span class='placeholder'>X</span></em> or
427   * <code>AST_LOGICAL_</code><em><span class='placeholder'>X</span></em> type.
428   *
429   * </ul> <p>
430   * SBML Level&nbsp;1 function names are searched first; thus, for example,
431   * canonicalizing <code>log</code> will result in a node type of
432   * {@link libsbmlConstants#AST_FUNCTION_LN AST_FUNCTION_LN}.  (See the SBML
433   * Level&nbsp;1 Version&nbsp;2 Specification, Appendix C.)
434   <p>
435   * Sometimes, canonicalization of a node results in a structural conversion
436   * of the node as a result of adding a child.  For example, a node with the
437   * SBML Level&nbsp;1 function name <code>sqr</code> and a single child node (the
438   * argument) will be transformed to a node of type
439   * {@link libsbmlConstants#AST_FUNCTION_POWER AST_FUNCTION_POWER} with two children.  The
440   * first child will remain unchanged, but the second child will be an
441   * {@link ASTNode} of type {@link libsbmlConstants#AST_INTEGER AST_INTEGER} and a value of
442   * 2.  The function names that result in structural changes are: <code>log10</code>,
443   * <code>sqr</code>, and <code>sqrt.</code>
444   <p>
445   * @return <code>true</code> if this node was successfully converted to
446   * canonical form, <code>false</code> otherwise.
447   */ public
448 boolean canonicalize() {
449    return libsbmlJNI.ASTNode_canonicalize(swigCPtr, this);
450  }
451
452  
453/**
454   * Adds the given node as a child of this {@link ASTNode}.
455   <p>
456   * Child nodes are added in-order, from left to right.
457   <p>
458   * @param disownedChild the {@link ASTNode} instance to add.  
459   * Will become a child of the parent node.
460   <p>
461   * <p>
462 * @return integer value indicating success/failure of the
463 * function.   The possible values
464 * returned by this function are:
465   * <ul>
466   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
467   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
468   *
469   * </ul> <p>
470   * <p>
471 * @warning Explicitly adding, removing or replacing children of an
472 * {@link ASTNode} object may change the
473 * structure of the mathematical formula it represents, and may even render
474 * the representation invalid.  Callers need to be careful to use this method
475 * in the context of other operations to create complete and correct
476 * formulas.  The method
477 * {@link ASTNode#isWellFormedASTNode()}
478 * may also be useful for checking the results of node modifications.
479   <p>
480   * @see #prependChild(ASTNode disownedChild)
481   * @see #replaceChild(long n, ASTNode disownedChild, boolean delreplaced)
482   * @see #insertChild(long n, ASTNode disownedChild)
483   * @see #removeChild(long n)
484   * @see #isWellFormedASTNode()
485   */ public
486 int addChild(ASTNode disownedChild) {
487    return libsbmlJNI.ASTNode_addChild(swigCPtr, this, ASTNode.getCPtrAndDisown(disownedChild), disownedChild);
488  }
489
490  
491/**
492   * Adds the given node as a child of this {@link ASTNode}.
493   <p>
494   * This method adds child nodes from right to left.
495   <p>
496   * @param disownedChild the {@link ASTNode} instance to add.
497   * Will become a child of the parent node.
498   <p>
499   * <p>
500 * @return integer value indicating success/failure of the
501 * function.   The possible values
502 * returned by this function are:
503   * <ul>
504   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
505   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
506   *
507   * </ul> <p>
508   * <p>
509 * @warning Explicitly adding, removing or replacing children of an
510 * {@link ASTNode} object may change the
511 * structure of the mathematical formula it represents, and may even render
512 * the representation invalid.  Callers need to be careful to use this method
513 * in the context of other operations to create complete and correct
514 * formulas.  The method
515 * {@link ASTNode#isWellFormedASTNode()}
516 * may also be useful for checking the results of node modifications.
517   <p>
518   * @see #addChild(ASTNode disownedChild)
519   * @see #replaceChild(long n, ASTNode disownedChild, boolean delreplaced)
520   * @see #insertChild(long n, ASTNode disownedChild)
521   * @see #removeChild(long n)
522   */ public
523 int prependChild(ASTNode disownedChild) {
524    return libsbmlJNI.ASTNode_prependChild(swigCPtr, this, ASTNode.getCPtrAndDisown(disownedChild), disownedChild);
525  }
526
527  
528/**
529   * Removes the nth child of this {@link ASTNode} object.
530   <p>
531   * @param n long the index of the child to remove.
532   <p>
533   * <p>
534 * @return integer value indicating success/failure of the
535 * function.   The possible values
536 * returned by this function are:
537   * <ul>
538   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
539   * <li> {@link libsbmlConstants#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE}
540   *
541   * </ul> <p>
542   * <p>
543 * @warning Explicitly adding, removing or replacing children of an
544 * {@link ASTNode} object may change the
545 * structure of the mathematical formula it represents, and may even render
546 * the representation invalid.  Callers need to be careful to use this method
547 * in the context of other operations to create complete and correct
548 * formulas.  The method
549 * {@link ASTNode#isWellFormedASTNode()}
550 * may also be useful for checking the results of node modifications.
551   <p>
552   * @see #addChild(ASTNode disownedChild)
553   * @see #prependChild(ASTNode disownedChild)
554   * @see #replaceChild(long n, ASTNode disownedChild, boolean delreplaced)
555   * @see #insertChild(long n, ASTNode disownedChild)
556   */ public
557 int removeChild(long n) {
558    return libsbmlJNI.ASTNode_removeChild(swigCPtr, this, n);
559  }
560
561  
562/**
563   * Replaces the nth child of this {@link ASTNode} with the given {@link ASTNode}.
564   <p>
565   * @param n long the index of the child to replace.
566   * @param disownedChild {@link ASTNode} to replace the nth child.
567   * Will become a child of the parent node.
568   * @param delreplaced boolean indicating whether to delete the replaced child.
569   <p>
570   * <p>
571 * @return integer value indicating success/failure of the
572 * function.   The possible values
573 * returned by this function are:
574   * <ul>
575   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
576   * <li> {@link libsbmlConstants#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE}
577   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
578   *
579   * </ul> <p>
580   * <p>
581 * @warning Explicitly adding, removing or replacing children of an
582 * {@link ASTNode} object may change the
583 * structure of the mathematical formula it represents, and may even render
584 * the representation invalid.  Callers need to be careful to use this method
585 * in the context of other operations to create complete and correct
586 * formulas.  The method
587 * {@link ASTNode#isWellFormedASTNode()}
588 * may also be useful for checking the results of node modifications.
589   <p>
590   * @see #addChild(ASTNode disownedChild)
591   * @see #prependChild(ASTNode disownedChild)
592   * @see #insertChild(long n, ASTNode disownedChild)
593   * @see #removeChild(long n)
594   */ public
595 int replaceChild(long n, ASTNode disownedChild, boolean delreplaced) {
596    return libsbmlJNI.ASTNode_replaceChild__SWIG_0(swigCPtr, this, n, ASTNode.getCPtrAndDisown(disownedChild), disownedChild, delreplaced);
597  }
598
599  
600/**
601   * Replaces the nth child of this {@link ASTNode} with the given {@link ASTNode}.
602   <p>
603   * @param n long the index of the child to replace.
604   * @param disownedChild {@link ASTNode} to replace the nth child.
605   * Will become a child of the parent node.
606   * @param delreplaced boolean indicating whether to delete the replaced child.
607   <p>
608   * <p>
609 * @return integer value indicating success/failure of the
610 * function.   The possible values
611 * returned by this function are:
612   * <ul>
613   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
614   * <li> {@link libsbmlConstants#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE}
615   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
616   *
617   * </ul> <p>
618   * <p>
619 * @warning Explicitly adding, removing or replacing children of an
620 * {@link ASTNode} object may change the
621 * structure of the mathematical formula it represents, and may even render
622 * the representation invalid.  Callers need to be careful to use this method
623 * in the context of other operations to create complete and correct
624 * formulas.  The method
625 * {@link ASTNode#isWellFormedASTNode()}
626 * may also be useful for checking the results of node modifications.
627   <p>
628   * @see #addChild(ASTNode disownedChild)
629   * @see #prependChild(ASTNode disownedChild)
630   * @see #insertChild(long n, ASTNode disownedChild)
631   * @see #removeChild(long n)
632   */ public
633 int replaceChild(long n, ASTNode disownedChild) {
634    return libsbmlJNI.ASTNode_replaceChild__SWIG_1(swigCPtr, this, n, ASTNode.getCPtrAndDisown(disownedChild), disownedChild);
635  }
636
637  
638/**
639   * Inserts the given {@link ASTNode} node at a given point in the current {@link ASTNode}'s
640   * list of children.
641   <p>
642   * @param n long the index of the {@link ASTNode} being added.
643   * @param disownedChild {@link ASTNode} to insert as the nth child.
644   * Will become a child of the parent node.
645   <p>
646   * <p>
647 * @return integer value indicating success/failure of the
648 * function.   The possible values
649 * returned by this function are:
650   * <ul>
651   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
652   * <li> {@link libsbmlConstants#LIBSBML_INDEX_EXCEEDS_SIZE LIBSBML_INDEX_EXCEEDS_SIZE}
653   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
654   *
655   * </ul> <p>
656   * <p>
657 * @warning Explicitly adding, removing or replacing children of an
658 * {@link ASTNode} object may change the
659 * structure of the mathematical formula it represents, and may even render
660 * the representation invalid.  Callers need to be careful to use this method
661 * in the context of other operations to create complete and correct
662 * formulas.  The method
663 * {@link ASTNode#isWellFormedASTNode()}
664 * may also be useful for checking the results of node modifications.
665   <p>
666   * @see #addChild(ASTNode disownedChild)
667   * @see #prependChild(ASTNode disownedChild)
668   * @see #replaceChild(long n, ASTNode disownedChild, boolean delreplaced)
669   * @see #removeChild(long n)
670   */ public
671 int insertChild(long n, ASTNode disownedChild) {
672    return libsbmlJNI.ASTNode_insertChild(swigCPtr, this, n, ASTNode.getCPtrAndDisown(disownedChild), disownedChild);
673  }
674
675  
676/**
677   * Creates a recursive copy of this node and all its children.
678   <p>
679   * @return a copy of this {@link ASTNode} and all its children.  The caller owns
680   * the returned {@link ASTNode} and is responsible for deleting it.
681   */ public
682 ASTBase deepCopy() {
683    long cPtr = libsbmlJNI.ASTNode_deepCopy(swigCPtr, this);
684    return (cPtr == 0) ? null : new ASTNode(cPtr, true);
685  }
686
687  
688/**
689   * Returns the child at index n of this node.
690   <p>
691   * @param n the index of the child to get.
692   <p>
693   * @return the nth child of this {@link ASTNode} or <code>null</code> if this node has no nth
694   * child (<code>n &gt; </code>
695   * {@link ASTNode#getNumChildren()}
696   * <code>- 1</code>).
697   <p>
698   * @see #getNumChildren()
699   * @see #getLeftChild()
700   * @see #getRightChild()
701   */ public
702 ASTNode getChild(long n) {
703    long cPtr = libsbmlJNI.ASTNode_getChild(swigCPtr, this, n);
704    return (cPtr == 0) ? null : new ASTNode(cPtr, false);
705  }
706
707  
708/**
709   * Returns the left child of this node.
710   <p>
711   * @return the left child of this {@link ASTNode}.  This is equivalent to calling
712   * {@link ASTNode#getChild(long)}
713   * with an argument of <code>0.</code>
714   <p>
715   * @see #getNumChildren()
716   * @see #getChild(long)
717   * @see #getRightChild()
718   */ public
719 ASTNode getLeftChild() {
720    long cPtr = libsbmlJNI.ASTNode_getLeftChild(swigCPtr, this);
721    return (cPtr == 0) ? null : new ASTNode(cPtr, false);
722  }
723
724  
725/**
726   * Returns the right child of this node.
727   <p>
728   * @return the right child of this {@link ASTNode}, or <code>null</code> if this node has no
729   * right child.  If
730   * {@link ASTNode#getNumChildren()}
731   * <code>&gt; 1</code>, then this is equivalent to:
732   * <pre class='fragment'>
733getChild( getNumChildren() - 1 );
734</pre>
735   <p>
736   * @see #getNumChildren()
737   * @see #getLeftChild()
738   * @see #getChild(long)
739   */ public
740 ASTNode getRightChild() {
741    long cPtr = libsbmlJNI.ASTNode_getRightChild(swigCPtr, this);
742    return (cPtr == 0) ? null : new ASTNode(cPtr, false);
743  }
744
745  
746/**
747   * Returns the number of children of this node.
748   <p>
749   * @return the number of children of this {@link ASTNode}, or 0 is this node has
750   * no children.
751   */ public
752 long getNumChildren() {
753    return libsbmlJNI.ASTNode_getNumChildren(swigCPtr, this);
754  }
755
756  
757/**
758   * Adds the given {@link XMLNode} as a MathML <code>&lt;semantics&gt;</code>
759   * element to this {@link ASTNode}.
760   <p>
761   * <p>
762 * The <code>&lt;semantics&gt;</code> element is a MathML&nbsp;2.0 construct
763 * that can be used to associate additional information with a MathML
764 * construct.  The construct can be used to decorate a MathML expressions with
765 * a sequence of one or more <code>&lt;annotation&gt;</code> or
766 * <code>&lt;annotation-xml&gt;</code> elements.  Each such element contains a
767 * pair of items; the first is a symbol that acts as an attribute or key, and
768 * the second is the value associated with the attribute or key.  Please refer
769 * to the MathML&nbsp;2.0 documentation, particularly the <a target='_blank'
770 * href='http://www.w3.org/TR/2007/WD-MathML3-20071005/chapter5.html#mixing.semantic.annotations'>Section
771 * 5.2, Semantic Annotations</a> for more information about these constructs.
772   <p>
773   * @param disownedAnnotation the annotation to add.
774   * Will become a child of the parent node.
775   <p>
776   * <p>
777 * @return integer value indicating success/failure of the
778 * function.   The possible values
779 * returned by this function are:
780   * <ul>
781   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
782   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
783   *
784   * </ul> <p>
785   * <p>
786 * @note Although SBML permits the use of the MathML
787 * <code>&lt;semantics&gt;</code> annotation construct, the truth is that
788 * this construct has so far (at this time of this writing, which is early
789 * 2014) seen very little use in SBML software.  The full implications of
790 * using these annotations are still poorly understood.  If you wish to
791 * use this construct, we urge you to discuss possible uses and applications
792 * on the SBML discussion lists, particularly <a target='_blank'
793 * href='http://sbml.org/Forums'>sbml-discuss</a> and/or <a target='_blank'
794 * href='http://sbml.org/Forums'>sbml-interoperability</a>.
795   <p>
796   * @see #getNumSemanticsAnnotations()
797   * @see #getSemanticsAnnotation(long)
798   */ public
799 int addSemanticsAnnotation(XMLNode disownedAnnotation) {
800    return libsbmlJNI.ASTNode_addSemanticsAnnotation(swigCPtr, this, XMLNode.getCPtrAndDisown(disownedAnnotation), disownedAnnotation);
801  }
802
803  
804/**
805   * Returns the number of MathML <code>&lt;semantics&gt;</code> element
806   * elements on this node.
807   <p>
808   * <p>
809 * The <code>&lt;semantics&gt;</code> element is a MathML&nbsp;2.0 construct
810 * that can be used to associate additional information with a MathML
811 * construct.  The construct can be used to decorate a MathML expressions with
812 * a sequence of one or more <code>&lt;annotation&gt;</code> or
813 * <code>&lt;annotation-xml&gt;</code> elements.  Each such element contains a
814 * pair of items; the first is a symbol that acts as an attribute or key, and
815 * the second is the value associated with the attribute or key.  Please refer
816 * to the MathML&nbsp;2.0 documentation, particularly the <a target='_blank'
817 * href='http://www.w3.org/TR/2007/WD-MathML3-20071005/chapter5.html#mixing.semantic.annotations'>Section
818 * 5.2, Semantic Annotations</a> for more information about these constructs.
819   <p>
820   * @return the number of annotations of this {@link ASTNode}.
821   <p>
822   * <p>
823 * @note Although SBML permits the use of the MathML
824 * <code>&lt;semantics&gt;</code> annotation construct, the truth is that
825 * this construct has so far (at this time of this writing, which is early
826 * 2014) seen very little use in SBML software.  The full implications of
827 * using these annotations are still poorly understood.  If you wish to
828 * use this construct, we urge you to discuss possible uses and applications
829 * on the SBML discussion lists, particularly <a target='_blank'
830 * href='http://sbml.org/Forums'>sbml-discuss</a> and/or <a target='_blank'
831 * href='http://sbml.org/Forums'>sbml-interoperability</a>.
832   <p>
833   * @see #addSemanticsAnnotation(XMLNode)
834   * @see #getSemanticsAnnotation(long)
835   */ public
836 long getNumSemanticsAnnotations() {
837    return libsbmlJNI.ASTNode_getNumSemanticsAnnotations(swigCPtr, this);
838  }
839
840  
841/**
842   * Returns the nth MathML <code>&lt;semantics&gt;</code> element on this
843   * {@link ASTNode}.
844   <p>
845   * <p>
846 * The <code>&lt;semantics&gt;</code> element is a MathML&nbsp;2.0 construct
847 * that can be used to associate additional information with a MathML
848 * construct.  The construct can be used to decorate a MathML expressions with
849 * a sequence of one or more <code>&lt;annotation&gt;</code> or
850 * <code>&lt;annotation-xml&gt;</code> elements.  Each such element contains a
851 * pair of items; the first is a symbol that acts as an attribute or key, and
852 * the second is the value associated with the attribute or key.  Please refer
853 * to the MathML&nbsp;2.0 documentation, particularly the <a target='_blank'
854 * href='http://www.w3.org/TR/2007/WD-MathML3-20071005/chapter5.html#mixing.semantic.annotations'>Section
855 * 5.2, Semantic Annotations</a> for more information about these constructs.
856   <p>
857   * @param n the index of the annotation to return.  Callers should
858   * use {@link ASTNode#getNumSemanticsAnnotations()} to first find out how
859   * many annotations there are.
860   <p>
861   * @return the nth annotation inside this {@link ASTNode}, or <code>null</code> if this node has
862   * no nth annotation (<code>n &gt;</code>
863   * {@link ASTNode#getNumSemanticsAnnotations()}
864   * <code>- 1</code>).
865   <p>
866   * <p>
867 * @note Although SBML permits the use of the MathML
868 * <code>&lt;semantics&gt;</code> annotation construct, the truth is that
869 * this construct has so far (at this time of this writing, which is early
870 * 2014) seen very little use in SBML software.  The full implications of
871 * using these annotations are still poorly understood.  If you wish to
872 * use this construct, we urge you to discuss possible uses and applications
873 * on the SBML discussion lists, particularly <a target='_blank'
874 * href='http://sbml.org/Forums'>sbml-discuss</a> and/or <a target='_blank'
875 * href='http://sbml.org/Forums'>sbml-interoperability</a>.
876   <p>
877   * @see #addSemanticsAnnotation(XMLNode)
878   * @see #getNumSemanticsAnnotations()
879   */ public
880 XMLNode getSemanticsAnnotation(long n) {
881    long cPtr = libsbmlJNI.ASTNode_getSemanticsAnnotation(swigCPtr, this, n);
882    return (cPtr == 0) ? null : new XMLNode(cPtr, false);
883  }
884
885  
886/**
887   * Returns the value of this node as a single character.
888   <p>
889   * This function should be called only when {@link ASTNode#getType()} returns
890   * {@link libsbmlConstants#AST_MINUS AST_MINUS}, {@link libsbmlConstants#AST_TIMES AST_TIMES}, {@link libsbmlConstants#AST_DIVIDE AST_DIVIDE} or
891   * {@link libsbmlConstants#AST_POWER AST_POWER}.
892   <p>
893   * @return the value of this {@link ASTNode} as a single character.
894   */ public
895 char getCharacter() {
896    return libsbmlJNI.ASTNode_getCharacter(swigCPtr, this);
897  }
898
899  
900/**
901   * Returns the MathML <code>id</code> attribute value of this {@link ASTNode}.
902   <p>
903   * @return the MathML id of this {@link ASTNode}.
904   <p>
905   * @see #isSetId()
906   * @see #setId(String id)
907   * @see #unsetId()
908   */ public
909 String getId() {
910    return libsbmlJNI.ASTNode_getId(swigCPtr, this);
911  }
912
913  
914/**
915   * Returns the MathML <code>class</code> attribute value of this {@link ASTNode}.
916   <p>
917   * @return the MathML class of this {@link ASTNode}, if any exists.
918   <p>
919   * @see #isSetClass()
920   * @see #setClassName(String id)
921   * @see #unsetClass()
922   */ public
923 String getClassName() {
924    return libsbmlJNI.ASTNode_getClassName(swigCPtr, this);
925  }
926
927  
928/**
929   * Returns the MathML <code>style</code> attribute value of this {@link ASTNode}.
930   <p>
931   * @return the MathML style of this {@link ASTNode}, if any exists.
932   <p>
933   * @see #isSetStyle()
934   * @see #setStyle(String id)
935   * @see #unsetStyle()
936   */ public
937 String getStyle() {
938    return libsbmlJNI.ASTNode_getStyle(swigCPtr, this);
939  }
940
941  
942/**
943   * Returns the value of this node as an integer.
944   <p>
945   * If this node type is {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}, this
946   * method returns the value of the numerator.
947   <p>
948   * @return the value of this {@link ASTNode} as a (<code>long</code>) integer if type {@link libsbmlConstants#AST_INTEGER AST_INTEGER}; the numerator if type {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}, and <code>0</code> (false) otherwise.
949   <p>
950   * @note This function should be called only when
951   * {@link ASTNode#getType()} returns
952   * {@link libsbmlConstants#AST_INTEGER AST_INTEGER} or
953   * {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}.
954   * It will return <code>0</code> if the node type is <em>not</em> one of these, but since
955   * <code>0</code> may be a valid value for integer, it is important to be sure that
956   * the node type is one of the expected types in order to understand if
957   * <code>0</code> is the actual value.
958   <p>
959   * @see #getNumerator()
960   */ public
961 int getInteger() {
962    return libsbmlJNI.ASTNode_getInteger(swigCPtr, this);
963  }
964
965  
966/**
967   * Returns the value of this node as a string.
968   <p>
969   * This function may be called on nodes that (1) are not operators, i.e.,
970   * nodes for which {@link ASTNode#isOperator()}
971   * returns <code>false</code>, and (2) are not numbers, i.e.,
972   * {@link ASTNode#isNumber()} returns <code>false.</code>
973   <p>
974   * @return the value of this {@link ASTNode} as a string, or <code>null</code> if it is
975   * a node that does not have a name equivalent (e.g., if it is a number).
976   */ public
977 String getName() {
978    return libsbmlJNI.ASTNode_getName(swigCPtr, this);
979  }
980
981  
982/**
983   * Returns the value of this operator node as a string.
984   <p>
985   * This function may be called on nodes that are operators, i.e., nodes for
986   * which {@link ASTNode#isOperator()} returns
987   * <code>true.</code>
988   <p>
989   * @return the name of this operator {@link ASTNode} as a string (or <code>null</code> if not
990   * an operator).
991   */ public
992 String getOperatorName() {
993    return libsbmlJNI.ASTNode_getOperatorName(swigCPtr, this);
994  }
995
996  
997/**
998   * Returns the value of the numerator of this node if of type {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}, or the numerical value of the node if of type {@link libsbmlConstants#AST_INTEGER AST_INTEGER}; <code>0</code> (false) otherwise.
999   <p>
1000   * This function should be called only when
1001   * {@link ASTNode#getType()} returns
1002   * {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL} or
1003   * {@link libsbmlConstants#AST_INTEGER AST_INTEGER}.
1004   * It will return <code>0</code> if the node type is another type, but since <code>0</code> may
1005   * be a valid value for the denominator of a rational number or of an integer, it is
1006   * important to be sure that the node type is the correct type in order to
1007   * correctly interpret the returned value.
1008   <p>
1009   * @return the value of the numerator of this {@link ASTNode} if {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}, the value if {@link libsbmlConstants#AST_INTEGER AST_INTEGER}, or <code>0</code> (false) otherwise.
1010   <p>
1011   * @see #getDenominator()
1012   * @see #getInteger()
1013   */ public
1014 int getNumerator() {
1015    return libsbmlJNI.ASTNode_getNumerator(swigCPtr, this);
1016  }
1017
1018  
1019/**
1020   * Returns the value of the denominator of this node.
1021   <p>
1022   * @return the value of the denominator of this {@link ASTNode}, or <code>1</code> (true) if
1023   * this node is not of type {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}.
1024   <p>
1025   * @note This function should be called only when
1026   * {@link ASTNode#getType()} returns
1027   * {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}.
1028   * It will return <code>1</code> (true) if the node type is another type, but since <code>1</code> may
1029   * be a valid value for the denominator of a rational number, it is
1030   * important to be sure that the node type is the correct type in order to
1031   * correctly interpret the returned value.
1032   <p>
1033   * @see #getNumerator()
1034   */ public
1035 int getDenominator() {
1036    return libsbmlJNI.ASTNode_getDenominator(swigCPtr, this);
1037  }
1038
1039  
1040/**
1041   * Returns the real-numbered value of this node.
1042   <p>
1043   * This function performs the necessary arithmetic if the node type is
1044   * {@link libsbmlConstants#AST_REAL_E AST_REAL_E} (<em>mantissa *
1045   * 10<sup>exponent</sup></em>) or
1046   * {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}
1047   * (<em>numerator / denominator</em>).
1048   <p>
1049   * @return the value of this {@link ASTNode} as a real (double), or <code>0</code>
1050   * if this is not a node that holds a number.
1051   <p>
1052   * @note This function should be called only when this {@link ASTNode} has a
1053   * numerical value type.  It will return <code>0</code> if the node type is another
1054   * type, but since <code>0</code> may be a valid value, it is important to be sure
1055   * that the node type is the correct type in order to correctly interpret
1056   * the returned value.
1057   */ public
1058 double getReal() {
1059    return libsbmlJNI.ASTNode_getReal(swigCPtr, this);
1060  }
1061
1062  
1063/**
1064   * Returns the mantissa value of this node.
1065   <p>
1066   * If {@link ASTNode#getType()} returns
1067   * {@link libsbmlConstants#AST_REAL AST_REAL}, this method is
1068   * identical to {@link ASTNode#getReal()}.
1069   <p>
1070   * @return the value of the mantissa of this {@link ASTNode}, or <code>0</code> if this
1071   * node is not a type that has a real-numbered value.
1072   <p>
1073   * @note This function should be called only when
1074   * {@link ASTNode#getType()} returns
1075   * {@link libsbmlConstants#AST_REAL_E AST_REAL_E},
1076   * {@link libsbmlConstants#AST_REAL AST_REAL} or
1077   * {@link libsbmlConstants#AST_NAME_AVOGADRO AST_NAME_AVOGADRO}.  It
1078   * will return <code>0</code> if the node type is another type, but since <code>0</code> may be
1079   * a valid value, it is important to be sure that the node type is the
1080   * correct type in order to correctly interpret the returned value.
1081   <p>
1082   * @see #getExponent()
1083   */ public
1084 double getMantissa() {
1085    return libsbmlJNI.ASTNode_getMantissa(swigCPtr, this);
1086  }
1087
1088  
1089/**
1090   * Returns the exponent value of this {@link ASTNode}.
1091   <p>
1092   * @return the value of the exponent of this {@link ASTNode}, or <code>0</code> if this
1093   * is not a type of node that has an exponent.
1094   <p>
1095   * @note This function should be called only when
1096   * {@link ASTNode#getType()}
1097   * returns {@link libsbmlConstants#AST_REAL_E AST_REAL_E}.
1098   * It will return <code>0</code> if the node type is another type, but since <code>0</code> may
1099   * be a valid value, it is important to be sure that the node type is the
1100   * correct type in order to correctly interpret the returned value.
1101   <p>
1102   * @see #getMantissa()
1103   */ public
1104 int getExponent() {
1105    return libsbmlJNI.ASTNode_getExponent(swigCPtr, this);
1106  }
1107
1108  
1109/**
1110   * Returns the numerical value of this {@link ASTNode}.
1111   <p>
1112   * @return the numerical value of this {@link ASTNode}, or <code>NaN</code> if this
1113   * is not a type of node that has a numerical value.
1114   <p>
1115   * @note This function will return a numerical value (as a double) for 
1116   * any ASTNode_t that represents a number, a constant such as 
1117   * {@link libsbmlConstants#AST_CONSTANT_PI AST_CONSTANT_PI}, 
1118   * {@link libsbmlConstants#AST_CONSTANT_E AST_CONSTANT_E}, or 
1119   * {@link libsbmlConstants#AST_NAME_AVOGADRO AST_NAME_AVOGADRO}, or 
1120   * <code>1</code> for nodes of type 
1121   * {@link libsbmlConstants#AST_CONSTANT_TRUE AST_CONSTANT_TRUE} and <code>0</code> for nodes of type
1122   * {@link libsbmlConstants#AST_CONSTANT_FALSE AST_CONSTANT_FALSE}. It does not evaluate
1123   * the node in any way so, for example, it will not return the value of 
1124   * a named ASTNode_t or attempt to evaluate a function. 
1125   * This includes a node representing <code>time</code> i.e. nodes
1126   * of type {@link libsbmlConstants#AST_NAME_TIME AST_NAME_TIME}.
1127   */ public
1128 double getValue() {
1129    return libsbmlJNI.ASTNode_getValue(swigCPtr, this);
1130  }
1131
1132  
1133/**
1134   * Returns the precedence of this node in the infix math syntax of SBML
1135   * Level&nbsp;1.
1136   <p>
1137   * For more information about the infix syntax, see the discussion about <a
1138   * href='#math-convert'>text string formulas</a> at the top of the
1139   * documentation for {@link ASTNode}.
1140   <p>
1141   * @return an integer indicating the precedence of this {@link ASTNode}.
1142   */ public
1143 int getPrecedence() {
1144    return libsbmlJNI.ASTNode_getPrecedence(swigCPtr, this);
1145  }
1146
1147  
1148/**
1149   * Returns the type of this {@link ASTNode}.
1150   <p>
1151   * The value returned is one of the Core AST type codes such as
1152   * {@link libsbmlConstants#AST_LAMBDA AST_LAMBDA},
1153   * {@link libsbmlConstants#AST_PLUS AST_PLUS}, etc.
1154   <p>
1155   * @return the type of this {@link ASTNode}.
1156   <p>
1157   * @note The introduction of extensibility in SBML Level&nbsp;3 brings with
1158   * it a need to allow for the possibility of node types that are defined by
1159   * plug-ins implementing SBML Level&nbsp;3 packages.  If a given {@link ASTNode} is
1160   * a construct created by a package rather than libSBML Core, then
1161   * {@link ASTNode#getType()} will return
1162   * {@link libsbmlConstants#AST_ORIGINATES_IN_PACKAGE AST_ORIGINATES_IN_PACKAGE}.
1163   * Callers can then obtain the package-specific type by
1164   * calling getExtendedType().
1165   <p>
1166   * @see #getExtendedType()
1167   */ public
1168 int getType() {
1169    return libsbmlJNI.ASTNode_getType(swigCPtr, this);
1170  }
1171
1172  
1173/**
1174   * Returns the extended type of this {@link ASTNode}.
1175   <p>
1176   * The type may be either a core
1177   * integer type code
1178   * or a value of a type code defined by an SBML Level&nbsp;3 package.
1179   <p>
1180   * @return the type of this {@link ASTNode}.
1181   <p>
1182   * @note When the {@link ASTNode} is of a type from a package, the value returned
1183   * by {@link ASTNode#getType()} will be
1184   * {@link libsbmlConstants#AST_ORIGINATES_IN_PACKAGE AST_ORIGINATES_IN_PACKAGE}
1185   * and getExtendedType() will return a package-specific type
1186   * code.  To find out the possible package-specific types (if any), please
1187   * consult the documentation for the particular package.
1188   <p>
1189   * @see #getType()
1190   */ public
1191 int getExtendedType() {
1192    return libsbmlJNI.ASTNode_getExtendedType(swigCPtr, this);
1193  }
1194
1195  
1196/**
1197   * Returns the units of this {@link ASTNode}.
1198   <p>
1199   * SBML Level&nbsp;3 Version&nbsp;1 introduced the ability to include an
1200attribute <code>sbml:units</code> on MathML <code>cn</code> elements
1201appearing in SBML mathematical formulas.  The value of this attribute can
1202be used to indicate the unit of measurement to be associated with the
1203number in the content of the <code>cn</code> element.  The value of this
1204attribute must be the identifier of a unit of measurement defined by SBML
1205or the enclosing Model.  Here, the <code>sbml</code> portion is an XML
1206namespace prefix that must be associated with the SBML namespace for SBML
1207Level&nbsp;3.  The following example illustrates how this attribute can be
1208used to define a number with value <code>10</code> and unit of measurement
1209<code>second</code>:
1210<pre class="fragment">&lt;math xmlns="http://www.w3.org/1998/Math/MathML"
1211      xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core"&gt;
1212        &lt;cn type="integer" sbml:units="second"&gt; 10 &lt;/cn&gt;
1213&lt;/math&gt;
1214</pre>
1215
1216   <p>
1217   * @return the units of this {@link ASTNode}.
1218   <p>
1219   * @note The <code>sbml:units</code> attribute is only available in SBML
1220   * Level&nbsp;3.  It may not be used in Levels 1&ndash;2 of SBML.
1221   <p>
1222   * @see <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a>
1223   */ public
1224 String getUnits() {
1225    return libsbmlJNI.ASTNode_getUnits(swigCPtr, this);
1226  }
1227
1228  
1229/**
1230   * Returns <code>true</code> if this node represents the predefined
1231   * value for Avogadro's constant.
1232   <p>
1233   * SBML Level&nbsp;3 introduced a predefined MathML <code>&lt;csymbol&gt;</code>
1234   * for the value of Avogadro's constant.  LibSBML stores this internally as
1235   * a node of type {@link libsbmlConstants#AST_NAME_AVOGADRO AST_NAME_AVOGADRO}.
1236   * This method returns <code>true</code> if this node has that type.
1237   <p>
1238   * @return <code>true</code> if this {@link ASTNode} is the special symbol avogadro,
1239   * <code>false</code> otherwise.
1240   <p>
1241   * @see <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a>
1242   */ public
1243 boolean isAvogadro() {
1244    return libsbmlJNI.ASTNode_isAvogadro(swigCPtr, this);
1245  }
1246
1247  
1248/**
1249   * Returns <code>true</code> if this node has a Boolean type.
1250   <p>
1251   * The {@link ASTNode} objects that have Boolean types are the logical operators,
1252   * relational operators, and the constants <code>true</code> or <code>false.</code>
1253   <p>
1254   * @return <code>true</code> if this {@link ASTNode} has a Boolean type, <code>false</code> otherwise.
1255   */ public
1256 boolean isBoolean() {
1257    return libsbmlJNI.ASTNode_isBoolean(swigCPtr, this);
1258  }
1259
1260  
1261/**
1262   * Returns <code>true</code> if this node returns a Boolean value.
1263   <p>
1264   * This function looks at the whole {@link ASTNode} rather than just the top level
1265   * of the {@link ASTNode}. Thus, it will consider return values from piecewise
1266   * statements.  In addition, if this {@link ASTNode} uses a function call to a
1267   * user-defined function, the return value of the corresponding
1268   * {@link FunctionDefinition} object will be determined.  Note that this is only
1269   * possible where the {@link ASTNode} can trace its parent {@link Model}; that is, the
1270   * {@link ASTNode} must represent the <code>&lt;math&gt;</code> element of some
1271   * SBML object that has already been added to an instance of an
1272   * {@link SBMLDocument}.
1273   <p>
1274   * @param model the {@link Model} to use as context.
1275   <p>
1276   * 
1277   * @return <code>true</code> if this {@link ASTNode} returns a boolean, <code>false</code> otherwise.
1278   <p>
1279   * @see #isBoolean()
1280   */ public
1281 boolean returnsBoolean(Model model) {
1282    return libsbmlJNI.ASTNode_returnsBoolean__SWIG_0(swigCPtr, this, Model.getCPtr(model), model);
1283  }
1284
1285  
1286/**
1287   * Returns <code>true</code> if this node returns a Boolean value.
1288   <p>
1289   * This function looks at the whole {@link ASTNode} rather than just the top level
1290   * of the {@link ASTNode}. Thus, it will consider return values from piecewise
1291   * statements.  In addition, if this {@link ASTNode} uses a function call to a
1292   * user-defined function, the return value of the corresponding
1293   * {@link FunctionDefinition} object will be determined.  Note that this is only
1294   * possible where the {@link ASTNode} can trace its parent {@link Model}; that is, the
1295   * {@link ASTNode} must represent the <code>&lt;math&gt;</code> element of some
1296   * SBML object that has already been added to an instance of an
1297   * {@link SBMLDocument}.
1298   <p>
1299   * @param model the {@link Model} to use as context.
1300   <p>
1301   * 
1302   * @return <code>true</code> if this {@link ASTNode} returns a boolean, <code>false</code> otherwise.
1303   <p>
1304   * @see #isBoolean()
1305   */ public
1306 boolean returnsBoolean() {
1307    return libsbmlJNI.ASTNode_returnsBoolean__SWIG_1(swigCPtr, this);
1308  }
1309
1310  
1311/**
1312   * Returns <code>true</code> if this node represents a MathML
1313   * constant.
1314   <p>
1315   * Examples of MathML constants include such things as pi.
1316   <p>
1317   * @return <code>true</code> if this {@link ASTNode} is a MathML constant, <code>false</code>
1318   * otherwise.
1319   <p>
1320   * @note This function will also return <code>true</code> for nodes of type
1321   * {@link libsbmlConstants#AST_NAME_AVOGADRO AST_NAME_AVOGADRO} in SBML Level&nbsp;3.
1322   */ public
1323 boolean isConstant() {
1324    return libsbmlJNI.ASTNode_isConstant(swigCPtr, this);
1325  }
1326
1327  
1328/**
1329  * Returns <code>true</code> if this node represents a MathML
1330  * constant numeric.
1331  <p>
1332  * Examples of MathML constants include such things as pi.
1333  <p>
1334  * @return <code>true</code> if this {@link ASTNode} is a MathML constant, <code>false</code>
1335  * otherwise.
1336  <p>
1337  * @note This function will also return <code>true</code> for nodes of type
1338  * {@link libsbmlConstants#AST_NAME_AVOGADRO AST_NAME_AVOGADRO} in SBML Level&nbsp;3.
1339  */ public
1340 boolean isConstantNumber() {
1341    return libsbmlJNI.ASTNode_isConstantNumber(swigCPtr, this);
1342  }
1343
1344  
1345/**
1346   * Returns <code>true</code> if this node represents a function.
1347   <p>
1348   * The three types of functions in SBML are MathML functions (e.g.,
1349   * <code>abs()</code>), SBML Level&nbsp;1 functions (in the SBML
1350   * Level&nbsp;1 math syntax), and user-defined functions (using
1351   * {@link FunctionDefinition} in SBML Level&nbsp;2 and&nbsp;3).
1352   <p>
1353   * @return <code>true</code> if this {@link ASTNode} is a function, <code>false</code> otherwise.
1354   */ public
1355 boolean isFunction() {
1356    return libsbmlJNI.ASTNode_isFunction(swigCPtr, this);
1357  }
1358
1359  
1360/**
1361   * Returns <code>true</code> if this node represents the special IEEE 754
1362   * value for infinity.
1363   <p>
1364   * @return <code>true</code> if this {@link ASTNode} is the special IEEE 754 value infinity,
1365   * <code>false</code> otherwise.
1366   */ public
1367 boolean isInfinity() {
1368    return libsbmlJNI.ASTNode_isInfinity(swigCPtr, this);
1369  }
1370
1371  
1372/**
1373   * Returns <code>true</code> if this node of type {@link libsbmlConstants#AST_INTEGER AST_INTEGER}.
1374   <p>
1375   * @return <code>true</code> if this {@link ASTNode} is of type {@link libsbmlConstants#AST_INTEGER AST_INTEGER}, <code>false</code> otherwise.
1376   */ public
1377 boolean isInteger() {
1378    return libsbmlJNI.ASTNode_isInteger(swigCPtr, this);
1379  }
1380
1381  
1382/**
1383   * Returns <code>true</code> if this node is a MathML
1384   * <code>&lt;lambda&gt;</code>.
1385   <p>
1386   * @return <code>true</code> if this {@link ASTNode} is of type {@link libsbmlConstants#AST_LAMBDA AST_LAMBDA}, <code>false</code> otherwise.
1387   */ public
1388 boolean isLambda() {
1389    return libsbmlJNI.ASTNode_isLambda(swigCPtr, this);
1390  }
1391
1392  
1393/**
1394   * Returns <code>true</code> if this node represents a <code>log10</code> function.
1395   <p>
1396   * More precisely, this predicate returns <code>true</code> if the node type is
1397   * {@link libsbmlConstants#AST_FUNCTION_LOG AST_FUNCTION_LOG} with two children, the
1398   * first of which is an {@link libsbmlConstants#AST_INTEGER AST_INTEGER} equal to
1399   * 10.
1400   <p>
1401   * @return <code>true</code> if the given {@link ASTNode} represents a <code>log10</code>() function,
1402   * <code>false</code> otherwise.
1403   <p>
1404   * @see <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a>
1405   */ public
1406 boolean isLog10() {
1407    return libsbmlJNI.ASTNode_isLog10(swigCPtr, this);
1408  }
1409
1410  
1411/**
1412   * Returns <code>true</code> if this node is a MathML logical operator.
1413   <p>
1414   * The possible MathML logical operators in SBML core are <code>and</code>, <code>or</code>, <code>not</code>,
1415   * <code>xor</code>, and (as of SBML Level&nbsp;3 Version&nbsp;2) <code>implies.</code>  If
1416   * the node represents a logical operator defined in a Level&nbsp;3 package,
1417   * it will also return <code>true.</code>
1418   <p>
1419   * @return <code>true</code> if this {@link ASTNode} is a MathML logical operator, <code>false</code>
1420   * otherwise.
1421   */ public
1422 boolean isLogical() {
1423    return libsbmlJNI.ASTNode_isLogical(swigCPtr, this);
1424  }
1425
1426  
1427/**
1428   * Returns <code>true</code> if this node is a user-defined variable name
1429   * or the symbols for time or Avogadro's constant.
1430   <p>
1431   * SBML Levels&nbsp;2 and&nbsp;3 provides <code>&lt;csymbol&gt;</code>
1432   * definitions for 'time' and 'avogadro', which can be used to represent
1433   * simulation time and Avogadro's constant in MathML.  Note that this
1434   * method does <em>not</em> return <code>true</code> for the other <code>csymbol</code>
1435   * values defined by SBML, 'delay', because the 'delay' is a function
1436   * and not a constant or variable.
1437   <p>
1438   * @return <code>true</code> if this {@link ASTNode} is a user-defined variable name in SBML
1439   * or the special symbols for time or Avogadro's constant. It returns
1440   * <code>false</code> otherwise.
1441   */ public
1442 boolean isName() {
1443    return libsbmlJNI.ASTNode_isName(swigCPtr, this);
1444  }
1445
1446  
1447/**
1448   * Returns <code>true</code> if this node represents the special IEEE 754
1449   * value 'not a number' (NaN).
1450   <p>
1451   * @return <code>true</code> if this {@link ASTNode} is the special IEEE 754 NaN, <code>false</code>
1452   * otherwise.
1453   */ public
1454 boolean isNaN() {
1455    return libsbmlJNI.ASTNode_isNaN(swigCPtr, this);
1456  }
1457
1458  
1459/**
1460   * Returns <code>true</code> if this node represents the special IEEE 754
1461   * value 'negative infinity'.
1462   <p>
1463   * @return <code>true</code> if this {@link ASTNode} is the special IEEE 754 value negative
1464   * infinity, <code>false</code> otherwise.
1465   */ public
1466 boolean isNegInfinity() {
1467    return libsbmlJNI.ASTNode_isNegInfinity(swigCPtr, this);
1468  }
1469
1470  
1471/**
1472   * Returns <code>true</code> if this node contains a number.
1473   <p>
1474   * @return <code>true</code> if this {@link ASTNode} is a number, <code>false</code> otherwise.
1475   */ public
1476 boolean isNumber() {
1477    return libsbmlJNI.ASTNode_isNumber(swigCPtr, this);
1478  }
1479
1480  
1481/**
1482   * Returns <code>true</code> if this node is a mathematical
1483   * operator.
1484   <p>
1485   * The possible mathematical operators in the MathML syntax supported by
1486   * SBML are <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>
1487   * and <code>^</code> (power).
1488   <p>
1489   * @return <code>true</code> if this {@link ASTNode} is an operator, <code>false</code> otherwise.
1490   */ public
1491 boolean isOperator() {
1492    return libsbmlJNI.ASTNode_isOperator(swigCPtr, this);
1493  }
1494
1495  
1496/**
1497   * Returns <code>true</code> if this node is the MathML
1498   * <code>&lt;piecewise&gt;</code> construct.
1499   <p>
1500   * @return <code>true</code> if this {@link ASTNode} is a MathML <code>piecewise</code> function,
1501   * <code>false</code> otherwise.
1502   */ public
1503 boolean isPiecewise() {
1504    return libsbmlJNI.ASTNode_isPiecewise(swigCPtr, this);
1505  }
1506
1507  
1508/**
1509   * Predicate returning <code>true</code> if this node is a MathML
1510   * qualifier.
1511   <p>
1512   * The MathML qualifier node types are <code>bvar</code>, <code>degree</code>, <code>base</code>,
1513   * <code>piece</code>, and <code>otherwise.</code>
1514   <p>
1515   * @return <code>true</code> if this {@link ASTNode} is a MathML qualifier, <code>false</code>
1516   * otherwise.
1517   */ public
1518 boolean isQualifier() {
1519    return libsbmlJNI.ASTNode_isQualifier(swigCPtr, this);
1520  }
1521
1522  
1523/**
1524   * Returns <code>true</code> if this node represents a rational number.
1525   <p>
1526   * @return <code>true</code> if this {@link ASTNode} is of type {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}, <code>false</code> otherwise.
1527   */ public
1528 boolean isRational() {
1529    return libsbmlJNI.ASTNode_isRational(swigCPtr, this);
1530  }
1531
1532  
1533/**
1534   * Returns <code>true</code> if this node can represent a real number.
1535   <p>
1536   * More precisely, this node must be of one of the following types:
1537   * {@link libsbmlConstants#AST_REAL AST_REAL}, {@link libsbmlConstants#AST_REAL_E AST_REAL_E} or {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}.
1538   <p>
1539   * @return <code>true</code> if the value of this {@link ASTNode} can represented as a real
1540   * number, <code>false</code> otherwise.
1541   */ public
1542 boolean isReal() {
1543    return libsbmlJNI.ASTNode_isReal(swigCPtr, this);
1544  }
1545
1546  
1547/**
1548   * Returns <code>true</code> if this node is a MathML
1549   * relational operator.
1550   <p>
1551   * The MathML relational operators are <code>==</code>, <code>&gt;=</code>,
1552   * <code>&gt;</code>, <code>&lt;</code>, and <code>!=</code>.
1553   <p>
1554   * @return <code>true</code> if this {@link ASTNode} is a MathML relational operator,
1555   * <code>false</code> otherwise.
1556   */ public
1557 boolean isRelational() {
1558    return libsbmlJNI.ASTNode_isRelational(swigCPtr, this);
1559  }
1560
1561  
1562/**
1563   * Predicate returning <code>true</code> if this node is a MathML
1564   * semantics node.
1565   <p>
1566   * @return <code>true</code> if this {@link ASTNode} is a MathML semantics node, <code>false</code>
1567   * otherwise.
1568   */ public
1569 boolean isSemantics() {
1570    return libsbmlJNI.ASTNode_isSemantics(swigCPtr, this);
1571  }
1572
1573  
1574/**
1575   * Returns <code>true</code> if this node represents a square root
1576   * function.
1577   <p>
1578   * More precisely, the node type must be {@link libsbmlConstants#AST_FUNCTION_ROOT AST_FUNCTION_ROOT} with two children, the first of which is an
1579   * {@link libsbmlConstants#AST_INTEGER AST_INTEGER} node having value equal to 2.
1580   <p>
1581   * @return <code>true</code> if the given {@link ASTNode} represents a <code>sqrt()</code>
1582   * function, <code>false</code> otherwise.
1583   */ public
1584 boolean isSqrt() {
1585    return libsbmlJNI.ASTNode_isSqrt(swigCPtr, this);
1586  }
1587
1588  
1589/**
1590   * Returns <code>true</code> if this node is a unary minus operator.
1591   <p>
1592   * A node is defined as a unary minus node if it is of type
1593   * {@link libsbmlConstants#AST_MINUS AST_MINUS} and has exactly one child.
1594   <p>
1595   * For numbers, unary minus nodes can be 'collapsed' by negating the
1596   * number.  In fact, <a href='libsbml.html#parseFormula(java.lang.String)'><code>libsbml.parseFormula(String)</code></a> does this during
1597   * its parsing process, and <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a> has a
1598   * configuration option that allows this behavior to be turned on or off.
1599   * However, unary minus nodes for symbols ({@link libsbmlConstants#AST_NAME AST_NAME}) or functions cannot be 'collapsed', so this predicate function is
1600   * necessary.
1601   <p>
1602   * @return <code>true</code> if this {@link ASTNode} is a unary minus, <code>false</code>
1603   * otherwise.
1604   <p>
1605   * @see <a href='libsbml.html#parseL3Formula(java.lang.String)'><code>libsbml.parseL3Formula(String)</code></a>
1606   */ public
1607 boolean isUMinus() {
1608    return libsbmlJNI.ASTNode_isUMinus(swigCPtr, this);
1609  }
1610
1611  
1612/**
1613   * Returns <code>true</code> if this node is a unary plus operator.
1614   <p>
1615   * A node is defined as a unary plus node if it is of type
1616   * {@link libsbmlConstants#AST_PLUS AST_PLUS} and has exactly one child.
1617   <p>
1618   * @return <code>true</code> if this {@link ASTNode} is a unary plus, <code>false</code> otherwise.
1619   */ public
1620 boolean isUPlus() {
1621    return libsbmlJNI.ASTNode_isUPlus(swigCPtr, this);
1622  }
1623
1624  
1625/**
1626  * Returns <code>true</code> if this node is of a certain type with a specific number
1627  * of children.
1628  <p>
1629  * Designed for use in cases where it is useful to discover if the node is a
1630  * unary not or unary minus, or a times node with no children, etc.
1631  <p>
1632  * @param type the type of {@link ASTNode} sought.
1633  * @param numchildren the number of child nodes sought.
1634  <p>
1635  * @return <code>true</code> if this {@link ASTNode} is has the specified type and number of
1636  * children, <code>false</code> otherwise.
1637  */ public
1638 int hasTypeAndNumChildren(int type, long numchildren) {
1639    return libsbmlJNI.ASTNode_hasTypeAndNumChildren(swigCPtr, this, type, numchildren);
1640  }
1641
1642  
1643/**
1644   * Returns <code>true</code> if this node has an unknown type.
1645   <p>
1646   * 'Unknown' nodes have the type {@link libsbmlConstants#AST_UNKNOWN AST_UNKNOWN}.
1647   * Nodes with unknown types will not appear in an {@link ASTNode} tree returned by
1648   * libSBML based upon valid SBML input; the only situation in which a node
1649   * with type {@link libsbmlConstants#AST_UNKNOWN AST_UNKNOWN} may appear is
1650   * immediately after having create a new, untyped node using the {@link ASTNode}
1651   * constructor.  Callers creating nodes should endeavor to set the type to
1652   * a valid node type as soon as possible after creating new nodes.
1653   <p>
1654   * @return <code>true</code> if this {@link ASTNode} is of type {@link libsbmlConstants#AST_UNKNOWN AST_UNKNOWN}, <code>false</code> otherwise.
1655   */ public
1656 boolean isUnknown() {
1657    return libsbmlJNI.ASTNode_isUnknown(swigCPtr, this);
1658  }
1659
1660  
1661/**
1662   * Returns <code>true</code> if this node has a value for the MathML
1663   * attribute <code>id.</code>
1664   <p>
1665   * @return <code>true</code> if this {@link ASTNode} has an attribute id, <code>false</code>
1666   * otherwise.
1667   <p>
1668   * @see #isSetClass()
1669   * @see #isSetStyle()
1670   * @see #setId(String id)
1671   * @see #unsetId()
1672   */ public
1673 boolean isSetId() {
1674    return libsbmlJNI.ASTNode_isSetId(swigCPtr, this);
1675  }
1676
1677  
1678/**
1679   * Returns <code>true</code> if this node has a value for the MathML
1680   * attribute <code>class.</code>
1681   <p>
1682   * @return <code>true</code> if this {@link ASTNode} has an attribute class, <code>false</code>
1683   * otherwise.
1684   <p>
1685   * @see #isSetId()
1686   * @see #isSetStyle()
1687   * @see #setClassName(String id)
1688   * @see #unsetClass()
1689   */ public
1690 boolean isSetClass() {
1691    return libsbmlJNI.ASTNode_isSetClass(swigCPtr, this);
1692  }
1693
1694  
1695/**
1696   * Returns <code>true</code> if this node has a value for the MathML
1697   * attribute <code>style.</code>
1698   <p>
1699   * @return <code>true</code> if this {@link ASTNode} has an attribute style, <code>false</code>
1700   * otherwise.
1701   <p>
1702   * @see #isSetClass()
1703   * @see #isSetId()
1704   * @see #setStyle(String id)
1705   * @see #unsetStyle()
1706   */ public
1707 boolean isSetStyle() {
1708    return libsbmlJNI.ASTNode_isSetStyle(swigCPtr, this);
1709  }
1710
1711  
1712/**
1713   * Returns <code>true</code> if this node has the attribute
1714   * <code>sbml:units</code>.
1715   <p>
1716   * SBML Level&nbsp;3 Version&nbsp;1 introduced the ability to include an
1717attribute <code>sbml:units</code> on MathML <code>cn</code> elements
1718appearing in SBML mathematical formulas.  The value of this attribute can
1719be used to indicate the unit of measurement to be associated with the
1720number in the content of the <code>cn</code> element.  The value of this
1721attribute must be the identifier of a unit of measurement defined by SBML
1722or the enclosing Model.  Here, the <code>sbml</code> portion is an XML
1723namespace prefix that must be associated with the SBML namespace for SBML
1724Level&nbsp;3.  The following example illustrates how this attribute can be
1725used to define a number with value <code>10</code> and unit of measurement
1726<code>second</code>:
1727<pre class="fragment">&lt;math xmlns="http://www.w3.org/1998/Math/MathML"
1728      xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core"&gt;
1729        &lt;cn type="integer" sbml:units="second"&gt; 10 &lt;/cn&gt;
1730&lt;/math&gt;
1731</pre>
1732
1733   <p>
1734   * @return <code>true</code> if this {@link ASTNode} has units associated with it, <code>false</code>
1735   * otherwise.
1736   <p>
1737   * @note The <code>sbml:units</code> attribute is only available in SBML
1738   * Level&nbsp;3.  It may not be used in Levels 1&ndash;2 of SBML.
1739   <p>
1740   * @see #hasUnits()
1741   * @see #setUnits(String units)
1742   */ public
1743 boolean isSetUnits() {
1744    return libsbmlJNI.ASTNode_isSetUnits(swigCPtr, this);
1745  }
1746
1747  
1748/**
1749   * Returns <code>true</code> if this node or any of its
1750   * children nodes have the attribute <code>sbml:units</code>.
1751   <p>
1752   * SBML Level&nbsp;3 Version&nbsp;1 introduced the ability to include an
1753attribute <code>sbml:units</code> on MathML <code>cn</code> elements
1754appearing in SBML mathematical formulas.  The value of this attribute can
1755be used to indicate the unit of measurement to be associated with the
1756number in the content of the <code>cn</code> element.  The value of this
1757attribute must be the identifier of a unit of measurement defined by SBML
1758or the enclosing Model.  Here, the <code>sbml</code> portion is an XML
1759namespace prefix that must be associated with the SBML namespace for SBML
1760Level&nbsp;3.  The following example illustrates how this attribute can be
1761used to define a number with value <code>10</code> and unit of measurement
1762<code>second</code>:
1763<pre class="fragment">&lt;math xmlns="http://www.w3.org/1998/Math/MathML"
1764      xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core"&gt;
1765        &lt;cn type="integer" sbml:units="second"&gt; 10 &lt;/cn&gt;
1766&lt;/math&gt;
1767</pre>
1768
1769   <p>
1770   * @return <code>true</code> if this {@link ASTNode} or its children has units associated
1771   * with it, <code>false</code> otherwise.
1772   <p>
1773   * @note The <code>sbml:units</code> attribute is only available in SBML
1774   * Level&nbsp;3.  It may not be used in Levels 1&ndash;2 of SBML.
1775   <p>
1776   * @see #isSetUnits()
1777   * @see #setUnits(String units)
1778   */ public
1779 boolean hasUnits() {
1780    return libsbmlJNI.ASTNode_hasUnits(swigCPtr, this);
1781  }
1782
1783  
1784/**
1785   * Sets the value of this {@link ASTNode} to the given character.  If character
1786   * is one of <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code> or <code>^</code>, the node
1787   * type will be set accordingly.  For all other characters, the node type
1788   * will be set to {@link libsbmlConstants#AST_UNKNOWN AST_UNKNOWN}.
1789   <p>
1790   * @param value the character value to which the node's value should be
1791   * set.
1792   <p>
1793   * <p>
1794 * @return integer value indicating success/failure of the
1795 * function.   The possible values
1796 * returned by this function are:
1797   * <ul>
1798   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1799   * </ul>
1800   */ public
1801 int setCharacter(char value) {
1802    return libsbmlJNI.ASTNode_setCharacter(swigCPtr, this, value);
1803  }
1804
1805  
1806/**
1807   * Sets the MathML attribute <code>id</code> of this {@link ASTNode}.
1808   <p>
1809   * @param id <code>string</code> representing the identifier.
1810   <p>
1811   * <p>
1812 * @return integer value indicating success/failure of the
1813 * function.   This particular
1814 * function only does one thing irrespective of user input or 
1815 * object state, and thus will only return a single value:
1816   * <ul>
1817   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1818   *
1819   * </ul> <p>
1820   * @see #isSetId()
1821   * @see #getId()
1822   * @see #unsetId()
1823   */ public
1824 int setId(String id) {
1825    return libsbmlJNI.ASTNode_setId(swigCPtr, this, id);
1826  }
1827
1828  
1829/**
1830   * Sets the MathML attribute <code>class</code> of this {@link ASTNode}.
1831   <p>
1832   * @param className <code>string</code> representing the MathML class for this node.
1833   <p>
1834   * <p>
1835 * @return integer value indicating success/failure of the
1836 * function.   This particular
1837 * function only does one thing irrespective of user input or 
1838 * object state, and thus will only return a single value:
1839   * <ul>
1840   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1841   *
1842   * </ul> <p>
1843   * @note In the API interfaces for languages other than Java, this method
1844   * is named <code>setClass()</code>, but in Java it is renamed
1845   * <code>setClassName()</code> to avoid a name collision with Java's
1846   * standard object method of the same name.
1847   <p>
1848   * @see #isSetClass()
1849   * @see #getClass()
1850   * @see #unsetClass()
1851   */ public
1852 int setClassName(String className) {
1853    return libsbmlJNI.ASTNode_setClassName(swigCPtr, this, className);
1854  }
1855
1856  
1857/**
1858   * Sets the MathML attribute <code>style</code> of this {@link ASTNode}.
1859   <p>
1860   * @param style <code>string</code> representing the identifier.
1861   <p>
1862   * <p>
1863 * @return integer value indicating success/failure of the
1864 * function.   This particular
1865 * function only does one thing irrespective of user input or 
1866 * object state, and thus will only return a single value:
1867   * <ul>
1868   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1869   *
1870   * </ul> <p>
1871   * @see #isSetStyle()
1872   * @see #getStyle()
1873   * @see #unsetStyle()
1874   */ public
1875 int setStyle(String style) {
1876    return libsbmlJNI.ASTNode_setStyle(swigCPtr, this, style);
1877  }
1878
1879  
1880/**
1881   * Sets the value of this {@link ASTNode} to the given name.
1882   <p>
1883   * As a side effect, this {@link ASTNode} object's type will be reset to
1884   * {@link libsbmlConstants#AST_NAME AST_NAME} if (and <em>only if</em>) the
1885   * {@link ASTNode} was previously an operator (i.e., * {@link ASTNode#isOperator()} returns <code>true</code>), number (i.e., {@link ASTNode#isNumber()} returns <code>true</code>), or
1886   * unknown.  This allows names to be set for {@link libsbmlConstants#AST_FUNCTION AST_FUNCTION} nodes and the like.
1887   <p>
1888   * @param name the string containing the name to which this node's value
1889   * should be set.
1890   <p>
1891   * <p>
1892 * @return integer value indicating success/failure of the
1893 * function.   The possible values
1894 * returned by this function are:
1895   * <ul>
1896   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1897   * </ul>
1898   */ public
1899 int setName(String name) {
1900    return libsbmlJNI.ASTNode_setName(swigCPtr, this, name);
1901  }
1902
1903  
1904/**
1905   * Sets the value of this {@link ASTNode} to the given (<code>long</code>) integer
1906   <p>
1907   * As a side effect, this operation sets the node type to
1908   * {@link libsbmlConstants#AST_INTEGER AST_INTEGER}.
1909   <p>
1910   * @param value the integer to which this node's value should be set.
1911   <p>
1912   * <p>
1913 * @return integer value indicating success/failure of the
1914 * function.   The possible values
1915 * returned by this function are:
1916   * <ul>
1917   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1918   * </ul>
1919   */ public
1920 int setValue(int value) {
1921    return libsbmlJNI.ASTNode_setValue__SWIG_0(swigCPtr, this, value);
1922  }
1923
1924  
1925/**
1926   * Sets the value of this {@link ASTNode} to the given rational.
1927   <p>
1928   * As a side effect, this operation sets the node type to
1929   * {@link libsbmlConstants#AST_RATIONAL AST_RATIONAL}.
1930   <p>
1931   * @param numerator the numerator value of the rational.
1932   * @param denominator the denominator value of the rational.
1933   <p>
1934   * <p>
1935 * @return integer value indicating success/failure of the
1936 * function.   The possible values
1937 * returned by this function are:
1938   * <ul>
1939   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1940   * </ul>
1941   */ public
1942 int setValue(int numerator, int denominator) {
1943    return libsbmlJNI.ASTNode_setValue__SWIG_1(swigCPtr, this, numerator, denominator);
1944  }
1945
1946  
1947/**
1948   * Sets the value of this {@link ASTNode} to the given real (<code>double</code>).
1949   <p>
1950   * As a side effect, this operation sets the node type to
1951   * {@link libsbmlConstants#AST_REAL AST_REAL}.
1952   <p>
1953   * This is functionally equivalent to:
1954   * <pre class='fragment'>
1955setValue(value, 0);
1956</pre>
1957   <p>
1958   * @param value the <code>double</code> format number to which this node's value
1959   * should be set.
1960   <p>
1961   * <p>
1962 * @return integer value indicating success/failure of the
1963 * function.   The possible values
1964 * returned by this function are:
1965   * <ul>
1966   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1967   * </ul>
1968   */ public
1969 int setValue(double value) {
1970    return libsbmlJNI.ASTNode_setValue__SWIG_2(swigCPtr, this, value);
1971  }
1972
1973  
1974/**
1975   * Sets the value of this {@link ASTNode} to the given real (<code>double</code>)
1976   <p>
1977   * As a side effet, this operation sets the node type to
1978   * {@link libsbmlConstants#AST_REAL_E AST_REAL_E}.
1979   <p>
1980   * @param mantissa the mantissa of this node's real-numbered value.
1981   * @param exponent the exponent of this node's real-numbered value.
1982   <p>
1983   * <p>
1984 * @return integer value indicating success/failure of the
1985 * function.   The possible values
1986 * returned by this function are:
1987   * <ul>
1988   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
1989   * </ul>
1990   */ public
1991 int setValue(double mantissa, int exponent) {
1992    return libsbmlJNI.ASTNode_setValue__SWIG_3(swigCPtr, this, mantissa, exponent);
1993  }
1994
1995  
1996/**
1997   * Sets the type of this {@link ASTNode}.
1998   <p>
1999   * This uses integer type codes, which may come from the set
2000   * of static integer constants whose names begin with the prefix
2001   * <code>AST_</code>  defined in the interface class
2002   * <code><a href='libsbmlConstants.html'>libsbmlConstants</a></code>
2003   *  or an enumeration of AST types in an SBML
2004   * Level&nbsp;3 package.
2005   <p>
2006   * @param type the integer representing the type to which this node should
2007   * be set.
2008   <p>
2009   * <p>
2010 * @return integer value indicating success/failure of the
2011 * function.   The possible values
2012 * returned by this function are:
2013   * <ul>
2014   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2015   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
2016   *
2017   * </ul> <p>
2018   * @note A side-effect of doing this is that any numerical values
2019   * previously stored in this node are reset to zero.
2020   <p>
2021   * @see #getType()
2022   */ public
2023 int setType(int type) {
2024    return libsbmlJNI.ASTNode_setType(swigCPtr, this, type);
2025  }
2026
2027  
2028/**
2029   * Sets the units of this {@link ASTNode} to units.
2030   <p>
2031   * The units will be set <em>only</em> if this {@link ASTNode} object represents a
2032   * MathML <code>&lt;cn&gt;</code> element, i.e., represents a number.
2033   * Callers may use
2034   * {@link ASTNode#isNumber()}
2035   * to inquire whether the node is of that type.
2036   <p>
2037   * SBML Level&nbsp;3 Version&nbsp;1 introduced the ability to include an
2038attribute <code>sbml:units</code> on MathML <code>cn</code> elements
2039appearing in SBML mathematical formulas.  The value of this attribute can
2040be used to indicate the unit of measurement to be associated with the
2041number in the content of the <code>cn</code> element.  The value of this
2042attribute must be the identifier of a unit of measurement defined by SBML
2043or the enclosing Model.  Here, the <code>sbml</code> portion is an XML
2044namespace prefix that must be associated with the SBML namespace for SBML
2045Level&nbsp;3.  The following example illustrates how this attribute can be
2046used to define a number with value <code>10</code> and unit of measurement
2047<code>second</code>:
2048<pre class="fragment">&lt;math xmlns="http://www.w3.org/1998/Math/MathML"
2049      xmlns:sbml="http://www.sbml.org/sbml/level3/version1/core"&gt;
2050        &lt;cn type="integer" sbml:units="second"&gt; 10 &lt;/cn&gt;
2051&lt;/math&gt;
2052</pre>
2053
2054   <p>
2055   * @param units <code>string</code> representing the unit identifier.
2056   <p>
2057   * <p>
2058 * @return integer value indicating success/failure of the
2059 * function.   The possible values
2060 * returned by this function are:
2061   * <ul>
2062   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2063   * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE}
2064   * <li> {@link libsbmlConstants#LIBSBML_INVALID_ATTRIBUTE_VALUE LIBSBML_INVALID_ATTRIBUTE_VALUE}
2065   *
2066   * </ul> <p>
2067   * @note The <code>sbml:units</code> attribute is only available in SBML
2068   * Level&nbsp;3.  It may not be used in Levels 1&ndash;2 of SBML.
2069   <p>
2070   * @see #isSetUnits()
2071   * @see #hasUnits()
2072   */ public
2073 int setUnits(String units) {
2074    return libsbmlJNI.ASTNode_setUnits(swigCPtr, this, units);
2075  }
2076
2077  
2078/**
2079   * Swaps the children of this node with the children of another node.
2080   <p>
2081   * @param that the other node whose children should be used to replace
2082   * <em>this</em> node's children.
2083   <p>
2084   * <p>
2085 * @return integer value indicating success/failure of the
2086 * function.   The possible values
2087 * returned by this function are:
2088   * <ul>
2089   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2090   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2091   * </ul>
2092   */ public
2093 int swapChildren(ASTNode that) {
2094    return libsbmlJNI.ASTNode_swapChildren(swigCPtr, this, ASTNode.getCPtr(that), that);
2095  }
2096
2097  
2098/**
2099   * Renames all the SIdRef attributes on this node and its child nodes.
2100   <p>
2101   * @param oldid the old identifier.
2102   * @param newid the new identifier.
2103   */ public
2104 void renameSIdRefs(String oldid, String newid) {
2105    libsbmlJNI.ASTNode_renameSIdRefs(swigCPtr, this, oldid, newid);
2106  }
2107
2108  
2109/**
2110   * Renames all the UnitSIdRef attributes on this node and its child nodes.
2111   <p>
2112   * The only place UnitSIDRefs appear in MathML <code>&lt;cn&gt;</code>
2113   * elements, so the effects of this method are limited to that.
2114   <p>
2115   * @param oldid the old identifier.
2116   * @param newid the new identifier.
2117   */ public
2118 void renameUnitSIdRefs(String oldid, String newid) {
2119    libsbmlJNI.ASTNode_renameUnitSIdRefs(swigCPtr, this, oldid, newid);
2120  }
2121
2122  
2123/** * @internal */ public
2124 void replaceIDWithFunction(String id, ASTNode function) {
2125    libsbmlJNI.ASTNode_replaceIDWithFunction(swigCPtr, this, id, ASTNode.getCPtr(function), function);
2126  }
2127
2128  
2129/** * @internal */ public
2130 void setIsChildFlag(boolean flag) {
2131    libsbmlJNI.ASTNode_setIsChildFlag(swigCPtr, this, flag);
2132  }
2133
2134  
2135/**
2136   * Unsets the units of this {@link ASTNode}.
2137   <p>
2138   * <p>
2139 * @return integer value indicating success/failure of the
2140 * function.   The possible values
2141 * returned by this function are:
2142   * <ul>
2143   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2144   * <li> {@link libsbmlConstants#LIBSBML_UNEXPECTED_ATTRIBUTE LIBSBML_UNEXPECTED_ATTRIBUTE}
2145   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2146   * </ul>
2147   */ public
2148 int unsetUnits() {
2149    return libsbmlJNI.ASTNode_unsetUnits(swigCPtr, this);
2150  }
2151
2152  
2153/**
2154   * Unsets the MathML <code>id</code> attribute of this {@link ASTNode}.
2155   <p>
2156   * <p>
2157 * @return integer value indicating success/failure of the
2158 * function.   The possible values
2159 * returned by this function are:
2160   * <ul>
2161   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2162   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2163   * </ul>
2164   */ public
2165 int unsetId() {
2166    return libsbmlJNI.ASTNode_unsetId(swigCPtr, this);
2167  }
2168
2169  
2170/**
2171   * Unsets the MathML <code>class</code> attribute of this {@link ASTNode}.
2172   <p>
2173   * <p>
2174 * @return integer value indicating success/failure of the
2175 * function.   The possible values
2176 * returned by this function are:
2177   * <ul>
2178   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2179   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2180   * </ul>
2181   */ public
2182 int unsetClass() {
2183    return libsbmlJNI.ASTNode_unsetClass(swigCPtr, this);
2184  }
2185
2186  
2187/**
2188   * Unsets the MathML <code>style</code> attribute of this {@link ASTNode}.
2189   <p>
2190   * <p>
2191 * @return integer value indicating success/failure of the
2192 * function.   The possible values
2193 * returned by this function are:
2194   * <ul>
2195   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2196   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2197   * </ul>
2198   */ public
2199 int unsetStyle() {
2200    return libsbmlJNI.ASTNode_unsetStyle(swigCPtr, this);
2201  }
2202
2203  
2204/**
2205   * Sets the MathML attribute <code>definitionURL.</code>
2206   <p>
2207   * @param url the URL value for the <code>definitionURL</code> attribute.
2208   <p>
2209   * <p>
2210 * @return integer value indicating success/failure of the
2211 * function.   The possible values
2212 * returned by this function are:
2213   * <ul>
2214   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2215   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
2216   *
2217   * </ul> <p>
2218   * @see #setDefinitionURL(String url)
2219   * @see #getDefinitionURL()
2220   * @see #getDefinitionURLString()
2221   */ public
2222 int setDefinitionURL(XMLAttributes url) {
2223    return libsbmlJNI.ASTNode_setDefinitionURL__SWIG_0(swigCPtr, this, XMLAttributes.getCPtr(url), url);
2224  }
2225
2226  
2227/**
2228   * Sets the MathML attribute <code>definitionURL.</code>
2229   <p>
2230   * @param url the URL value for the <code>definitionURL</code> attribute.
2231   <p>
2232   * <p>
2233 * @return integer value indicating success/failure of the
2234 * function.   The possible values
2235 * returned by this function are:
2236   * <ul>
2237   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2238   * <li> {@link libsbmlConstants#LIBSBML_INVALID_OBJECT LIBSBML_INVALID_OBJECT}
2239   *
2240   * </ul> <p>
2241   * @see #setDefinitionURL(XMLAttributes url)
2242   * @see #getDefinitionURL()
2243   * @see #getDefinitionURLString()
2244   */ public
2245 int setDefinitionURL(String url) {
2246    return libsbmlJNI.ASTNode_setDefinitionURL__SWIG_1(swigCPtr, this, url);
2247  }
2248
2249  
2250/**
2251   * Returns the MathML <code>definitionURL</code> attribute value.
2252   <p>
2253   * @return the value of the <code>definitionURL</code> attribute, in the form of
2254   * a libSBML {@link XMLAttributes} object.
2255   <p>
2256   * @see #setDefinitionURL(XMLAttributes url)
2257   * @see #setDefinitionURL(String url)
2258   * @see #getDefinitionURLString()
2259   */ public
2260 XMLAttributes getDefinitionURL() {
2261    long cPtr = libsbmlJNI.ASTNode_getDefinitionURL(swigCPtr, this);
2262    return (cPtr == 0) ? null : new XMLAttributes(cPtr, false);
2263  }
2264
2265  
2266/**
2267   * Replaces occurrences of a given name with a given {@link ASTNode}.
2268   <p>
2269   * For example, if the formula in this {@link ASTNode} is <code>x + y</code>,
2270   * and the function is called with <code>bvar</code> = <code>'x'</code> and <code>arg</code> = an {@link ASTNode}
2271   * representing the real value <code>3.</code>  This method would substitute <code>3</code> for
2272   * <code>x</code> within this {@link ASTNode} object, resulting in the forula <code>3 + y</code>.
2273   <p>
2274   * @param bvar a string representing the variable name to be substituted.
2275   <p>
2276   * @param arg an {@link ASTNode} representing the name/value/formula to use as
2277   * a replacement.
2278   */ public
2279 void replaceArgument(String bvar, ASTNode arg) {
2280    libsbmlJNI.ASTNode_replaceArgument(swigCPtr, this, bvar, ASTNode.getCPtr(arg), arg);
2281  }
2282
2283  
2284/**
2285   * Returns the parent SBML object.
2286   <p>
2287   * @return the parent SBML object of this {@link ASTNode}.
2288   <p>
2289   * 
2290   * @see #unsetParentSBMLObject()
2291   <p>
2292   * @see #isSetParentSBMLObject()
2293   */ public
2294 SBase getParentSBMLObject() {
2295  return libsbml.DowncastSBase(libsbmlJNI.ASTNode_getParentSBMLObject(swigCPtr, this), false);
2296}
2297
2298  
2299/**
2300   * Unsets the parent SBML object.
2301   <p>
2302   * <p>
2303 * @return integer value indicating success/failure of the
2304 * function.   The possible values
2305 * returned by this function are:
2306   * <ul>
2307   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2308   * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2309   *
2310   * </ul> <p>
2311   * @see #isSetParentSBMLObject()
2312   * @see #getParentSBMLObject()
2313   */ public
2314 int unsetParentSBMLObject() {
2315    return libsbmlJNI.ASTNode_unsetParentSBMLObject(swigCPtr, this);
2316  }
2317
2318  
2319/**
2320   * Returns <code>true</code> if this node has a value for the parent SBML
2321   * object.
2322   <p>
2323   * @return <code>true</code> if this {@link ASTNode} has an parent SBML object set, <code>false</code> otherwise.
2324   <p>
2325   * 
2326   * @see #unsetParentSBMLObject()
2327   <p>
2328   * @see #getParentSBMLObject()
2329   */ public
2330 boolean isSetParentSBMLObject() {
2331    return libsbmlJNI.ASTNode_isSetParentSBMLObject(swigCPtr, this);
2332  }
2333
2334  
2335/**
2336   * Reduces this {@link ASTNode} to a binary tree.
2337   <p>
2338   * Example: if this {@link ASTNode} is <code>and(x, y, z)</code>, then the
2339   * formula of the reduced node is <code>and(and(x, y), z)</code>.  The
2340   * operation replaces the formula stored in the current {@link ASTNode} object.
2341   */ public
2342 void reduceToBinary() {
2343    libsbmlJNI.ASTNode_reduceToBinary(swigCPtr, this);
2344  }
2345
2346  
2347/**
2348  * Unsets the user data of this node.
2349  <p>
2350  * The user data can be used by the application developer to attach custom
2351  * information to the node.  In case of a deep copy, this attribute will
2352  * passed as it is. The attribute will be never interpreted by this class.
2353  <p>
2354  * <p>
2355 * @return integer value indicating success/failure of the
2356 * function.   The possible values
2357 * returned by this function are:
2358  * <ul>
2359  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_SUCCESS LIBSBML_OPERATION_SUCCESS}
2360  * <li> {@link libsbmlConstants#LIBSBML_OPERATION_FAILED LIBSBML_OPERATION_FAILED}
2361  *
2362  * </ul> */ public
2363 int unsetUserData() {
2364    return libsbmlJNI.ASTNode_unsetUserData(swigCPtr, this);
2365  }
2366
2367  
2368/**
2369  * Returns <code>true</code> if this node has a user data object.
2370  <p>
2371  * @return <code>true</code> if this {@link ASTNode} has a user data object set, <code>false</code>
2372  * otherwise.
2373  */ public
2374 boolean isSetUserData() {
2375    return libsbmlJNI.ASTNode_isSetUserData(swigCPtr, this);
2376  }
2377
2378  
2379/**
2380  * Returns <code>true</code> or <code>false</code> depending on whether this
2381  * {@link ASTNode} is well-formed.
2382  <p>
2383  * @note An {@link ASTNode} may be well-formed, with each node and its children
2384  * having the appropriate number of children for the given type, but may
2385  * still be invalid in the context of its use within an SBML model.
2386  <p>
2387  * @return <code>true</code> if this {@link ASTNode} is well-formed, <code>false</code> otherwise.
2388  <p>
2389  * @see #hasCorrectNumberArguments()
2390  */ public
2391 boolean isWellFormedASTNode() {
2392    return libsbmlJNI.ASTNode_isWellFormedASTNode(swigCPtr, this);
2393  }
2394
2395  
2396/**
2397  * Returns <code>true</code> if this {@link ASTNode} has the correct number of children for
2398  * its type.
2399  <p>
2400  * For example, an {@link ASTNode} with type {@link libsbmlConstants#AST_MINUS AST_MINUS}
2401  * expects 1 or 2 child nodes.
2402  <p>
2403  * @return <code>true</code> if this {@link ASTNode} has the appropriate number of children
2404  * for its type, <code>false</code> otherwise.
2405  <p>
2406  * @note This function performs a check on the top-level node only.  Child
2407  * nodes are not checked.
2408  <p>
2409  * @see #isWellFormedASTNode()
2410  */ public
2411 boolean hasCorrectNumberArguments() {
2412    return libsbmlJNI.ASTNode_hasCorrectNumberArguments(swigCPtr, this);
2413  }
2414
2415  
2416/**
2417   * Returns the MathML <code>definitionURL</code> attribute value as a string.
2418   <p>
2419   * @return the value of the <code>definitionURL</code> attribute, as a string.
2420   <p>
2421   * @see #getDefinitionURL()
2422   * @see #setDefinitionURL(String url)
2423   * @see #setDefinitionURL(XMLAttributes url)
2424   */ public
2425 String getDefinitionURLString() {
2426    return libsbmlJNI.ASTNode_getDefinitionURLString(swigCPtr, this);
2427  }
2428
2429  
2430/** * @internal */ public
2431 boolean representsBvar() {
2432    return libsbmlJNI.ASTNode_representsBvar(swigCPtr, this);
2433  }
2434
2435  
2436/** * @internal */ public
2437 boolean usesL3V2MathConstructs() {
2438    return libsbmlJNI.ASTNode_usesL3V2MathConstructs(swigCPtr, this);
2439  }
2440
2441  
2442/** * @internal */ public
2443 boolean usesRateOf() {
2444    return libsbmlJNI.ASTNode_usesRateOf(swigCPtr, this);
2445  }
2446
2447  
2448/** * @internal */ public
2449 void write(XMLOutputStream stream) {
2450    libsbmlJNI.ASTNode_write(swigCPtr, this, XMLOutputStream.getCPtr(stream), stream);
2451  }
2452
2453  
2454/** * @internal */ public
2455 boolean read(XMLInputStream stream, String reqd_prefix) {
2456    return libsbmlJNI.ASTNode_read__SWIG_0(swigCPtr, this, XMLInputStream.getCPtr(stream), stream, reqd_prefix);
2457  }
2458
2459  
2460/** * @internal */ public
2461 boolean read(XMLInputStream stream) {
2462    return libsbmlJNI.ASTNode_read__SWIG_1(swigCPtr, this, XMLInputStream.getCPtr(stream), stream);
2463  }
2464
2465  
2466/** * @internal */ public
2467 void writeNodeOfType(XMLOutputStream stream, int type, boolean inChildNode) {
2468    libsbmlJNI.ASTNode_writeNodeOfType__SWIG_0(swigCPtr, this, XMLOutputStream.getCPtr(stream), stream, type, inChildNode);
2469  }
2470
2471  
2472/** * @internal */ public
2473 void writeNodeOfType(XMLOutputStream stream, int type) {
2474    libsbmlJNI.ASTNode_writeNodeOfType__SWIG_1(swigCPtr, this, XMLOutputStream.getCPtr(stream), stream, type);
2475  }
2476
2477  
2478/** * @internal */ public
2479 long getNumBvars() {
2480    return libsbmlJNI.ASTNode_getNumBvars(swigCPtr, this);
2481  }
2482
2483  
2484/** * @internal */ public
2485 int getTypeCode() {
2486    return libsbmlJNI.ASTNode_getTypeCode(swigCPtr, this);
2487  }
2488
2489  
2490/** * @internal */ public
2491 String getPackageName() {
2492    return libsbmlJNI.ASTNode_getPackageName(swigCPtr, this);
2493  }
2494
2495  
2496/** * @internal */ public
2497 ASTBasePlugin getPlugin(String arg0) {
2498  return libsbml.DowncastASTBasePlugin(libsbmlJNI.ASTNode_getPlugin__SWIG_0(swigCPtr, this, arg0), false);
2499}
2500
2501  
2502/** * @internal */ public
2503 ASTBasePlugin getPlugin(long n) {
2504  return libsbml.DowncastASTBasePlugin(libsbmlJNI.ASTNode_getPlugin__SWIG_2(swigCPtr, this, n), false);
2505}
2506
2507  
2508/** * @internal */ public
2509 long getNumPlugins() {
2510    return libsbmlJNI.ASTNode_getNumPlugins(swigCPtr, this);
2511  }
2512
2513  
2514/** * @internal */ public
2515 long getNumPiece() {
2516    return libsbmlJNI.ASTNode_getNumPiece(swigCPtr, this);
2517  }
2518
2519  public ASTNodeList getListOfNodes() {
2520    long cPtr = libsbmlJNI.ASTNode_getListOfNodes(swigCPtr, this);
2521    return (cPtr == 0) ? null : new ASTNodeList(cPtr, true);
2522  }
2523
2524}