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