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