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