/usr/include/sbml/math/ASTNode.h is in libsbml5-dev 5.16.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 | /**
* @file ASTNode.h
* @brief Abstract Syntax Tree (AST) for representing formula trees.
* @author Sarah Keating
*
* <!--------------------------------------------------------------------------
* This file is part of libSBML. Please visit http://sbml.org for more
* information about SBML, and the latest version of libSBML.
*
* Copyright (C) 2013-2017 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
* 3. University of Heidelberg, Heidelberg, Germany
*
* Copyright (C) 2009-2013 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK
*
* Copyright (C) 2006-2008 by the California Institute of Technology,
* Pasadena, CA, USA
*
* Copyright (C) 2002-2005 jointly by the following organizations:
* 1. California Institute of Technology, Pasadena, CA, USA
* 2. Japan Science and Technology Agency, Japan
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation. A copy of the license agreement is provided
* in the file named "LICENSE.txt" included with this software distribution and
* also available online as http://sbml.org/software/libsbml/license.html
* ------------------------------------------------------------------------ -->
*
* @class ASTNode
* @sbmlbrief{core} Abstract Syntax Trees for mathematical expressions.
*
* @htmlinclude not-sbml-warning.html
*
* <a target="_blank"
* href="http://en.wikipedia.org/wiki/Abstract_syntax_tree">Abstract Syntax
* Trees</a> (ASTs) are a simple kind of data structure used in libSBML for
* storing mathematical expressions. 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).
*
* @copydetails doc_what_is_astnode
*
* @if clike <h3><a class="anchor" name="ASTNodeType_t">
* ASTNodeType_t</a></h3> @else <h3><a class="anchor"
* name="ASTNodeType_t">The set of possible %ASTNode types</a></h3> @endif@~
*
* @copydetails doc_astnode_types
*
* <h3><a class="anchor" name="math-convert">Converting between ASTs and text
* strings</a></h3>
*
* The text-string form of mathematical formulas produced by
* @sbmlfunction{formulaToString, String} and
* @sbmlfunction{formulaToL3String, String}, and read by
* @sbmlfunction{parseFormula, ASTNode} and
* @sbmlfunction{parseL3Formula, ASTNode}, 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 @c "examples" subdirectory that demonstrate such
* things as translating infix formulas into MathML and vice-versa.
*
* Please see the documentation for the functions @sbmlfunction{parseFormula,
* ASTNode} and @sbmlfunction{parseL3Formula, ASTNode} for detailed
* explanations of the infix syntax they accept.
*
* <h3><a class="anchor" name="math-interpretation">Interpretation</a></h3>
*
* Proper mathematical interpretation of an ASTNode requires an
* understanding of all the allowed MathML operators, the SBML-specific
* csymbols, and of the named variables in the SBML model. It is
* important to note that an invalid ASTNode might not have a proper
* mathematical interpretation--a 'minus' node with three children is
* simply illegal, and cannot be interpreted. Similarly, a named variable
* that does not exist in the Model also cannot be interpreted. In SBML
* Level 3 Version 2, the ability was added to reference named
* variables in MathML that might exist in SBML Level 3 packages.
* This means that if the software reading the SBML file (or this version
* of libsbml) does not understand that package, MathML using named variables
* from those packages will be legal, but will not be interpretable. It
* is valid to issue a warning in this case, and may be otherwise handled
* as if an invalid variable name was used. In all cases, the "required"
* attribute for the package in question must be set to "true".
*
* <h3><a class="anchor" name="math-history">Historical notes</a></h3>
*
* Readers may wonder why this part of libSBML uses a seemingly less
* object-oriented design thanother parts. Originally, much of libSBML was
* written in C. All subsequent development was done in C++, but the
* complexity of some of the functionality for converting between infix, AST
* and MathML, coupled with the desire to maintain stability and backward
* compatibility, means that some of the underlying code is still written
* in C. This has lead to the exposed API being more C-like.
* @see @sbmlfunction{parseL3Formula, String}
* @see @sbmlfunction{parseL3FormulaWithSettings, String\, L3ParserSettings}
* @see @sbmlfunction{parseL3FormulaWithModel, String\, Model}
* @see @sbmlfunction{parseFormula, String}
* @see @sbmlfunction{formulaToL3StringWithSettings, ASTNode\, L3ParserSettings}
* @see @sbmlfunction{formulaToL3String, ASTNode}
* @see @sbmlfunction{formulaToString, ASTNode}
* @see @sbmlfunction{getDefaultL3ParserSettings,}
*/
/**
* <!-- ~ ~ ~ ~ ~ Start of common documentation strings ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
* The following text is used as common documentation blocks copied multiple
* times elsewhere in this file. The use of @class is a hack needed because
* Doxygen's @copydetails command has limited functionality. Symbols
* beginning with "doc_" are marked as ignored in our Doxygen configuration.
* ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ -->
*
* @class doc_warning_modifying_structure
*
* @warning Explicitly adding, removing or replacing children of an
* @if conly ASTNode_t structure@else ASTNode object@endif@~ 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
* @if conly ASTNode_isWellFormedASTNode()@else ASTNode::isWellFormedASTNode()@endif@~
* may also be useful for checking the results of node modifications.
*
* <!-- ------------------------------------------------------------------- -->
* @class doc_about_mathml_semantic_annotations
*
* 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.
*
* <!-- ------------------------------------------------------------------- -->
* @class doc_note_mathml_semantic_annotations_uncommon
*
* @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>.
*/
#ifndef ASTNode_h
#define ASTNode_h
#include <sbml/common/extern.h>
#include <sbml/common/sbmlfwd.h>
#include <sbml/math/FormulaTokenizer.h>
#include <sbml/math/ASTFunction.h>
#include <sbml/math/ASTNumber.h>
#include <sbml/math/ASTTypes.h>
#include <sbml/math/ASTBase.h>
LIBSBML_CPP_NAMESPACE_BEGIN
/**
* @typedef ASTNodePredicate
* @brief Function signature for use with
* @if conly ASTNode_fillListOfNodes() @else ASTNode::fillListOfNodes() @endif
* and @if conly ASTNode_getListOfNodes() @else ASTNode::getListOfNodes() @endif.
*
* A pointer to a function that takes an ASTNode and returns @if conly @c 1
* (true) or @c 0 (false) @else @c true (nonzero) or @c false (0)@endif.
*
* @if conly @see ASTNode_getListOfNodes()@else @see ASTNode::getListOfNodes()@endif
* @if conly @see ASTNode_fillListOfNodes()@else @see ASTNode::fillListOfNodes()@endif
*
* @if conly
* @memberof ASTNode_t
* @endif
*/
typedef int (*ASTNodePredicate) (const ASTNode_t *node);
LIBSBML_CPP_NAMESPACE_END
#ifdef __cplusplus
LIBSBML_CPP_NAMESPACE_BEGIN
class LIBSBML_EXTERN ASTNode : public ASTBase
{
public:
/**
* Creates a new ASTNode.
*
* Unless the argument @p type is given, the returned node will by default
* have a type of @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}. 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
* @if clike setType()@else ASTNode::setType(int)@endif.
*
* @param type an optional
* @if clike #ASTNodeType_t@else integer type@endif@~
* code indicating the type of node to create.
*
* @ifnot hasDefaultArgs @htmlinclude warn-default-args-in-docs.html @endif@~
*/
ASTNode (ASTNodeType_t type);
/** @cond doxygenLibsbmlInternal */
/* constructor for use by mathml reader */
ASTNode(SBMLNamespaces* sbmlns, ASTNodeType_t type);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/*
* Creates and returns a new ASTNode.
*/
ASTNode (int type = AST_UNKNOWN);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/* constructor for use by mathml reader */
ASTNode(SBMLNamespaces* sbmlns, int type = AST_UNKNOWN);
/** @endcond */
/**
* Creates a new ASTNode from the given Token.
*
* The resulting ASTNode will contain the same data as the given @p token.
*
* @param token the token to use as a starting point for creating the
* ASTNode object.
*/
ASTNode (Token_t *token);
/**
* Copy constructor; creates a deep copy of the given ASTNode.
*
* @param orig the ASTNode to be copied.
*/
ASTNode (const ASTNode& orig);
/**
* Assignment operator for ASTNode.
*
* @param rhs the object whose values are used as the basis of the
* assignment.
*/
ASTNode& operator=(const ASTNode& rhs);
/**
* Destroys this ASTNode, including any child nodes.
*/
virtual ~ASTNode ();
/**
* Frees the name of this ASTNode and sets it to @c NULL.
*
* This operation is only applicable to ASTNode objects corresponding to
* operators, numbers, or @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}. This
* method has no effect on other types of nodes.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t}
*/
int freeName ();
/**
* Converts this ASTNode to a canonical form.
*
* The rules determining the canonical form conversion are as follows:
*
* @li If the node type is @sbmlconstant{AST_NAME, ASTNodeType_t}
* and the node name matches @c "ExponentialE", @c "Pi", @c "True" or
* @c "False" 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 @sbmlconstant{AST_FUNCTION, ASTNodeType_t} 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.
*
* SBML Level 1 function names are searched first; thus, for example,
* canonicalizing @c log will result in a node type of
* @sbmlconstant{AST_FUNCTION_LN, ASTNodeType_t}. (See the SBML
* Level 1 Version 2 Specification, Appendix C.)
*
* 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 @c sqr and a single child node (the
* argument) will be transformed to a node of type
* @sbmlconstant{AST_FUNCTION_POWER, ASTNodeType_t} with two children. The
* first child will remain unchanged, but the second child will be an
* ASTNode of type @sbmlconstant{AST_INTEGER, ASTNodeType_t} and a value of
* 2. The function names that result in structural changes are: @c log10,
* @c sqr, and @c sqrt.
*
* @return @c true if this node was successfully converted to
* canonical form, @c false otherwise.
*/
bool canonicalize ();
/**
* Adds the given node as a child of this ASTNode.
*
* Child nodes are added in-order, from left to right.
*
* @param disownedChild the ASTNode instance to add.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see prependChild(ASTNode* disownedChild)
* @see replaceChild(unsigned int n, ASTNode* disownedChild, bool delreplaced)
* @see insertChild(unsigned int n, ASTNode* disownedChild)
* @see removeChild(unsigned int n)
* @see isWellFormedASTNode()
*/
int addChild (ASTNode* disownedChild);
/**
* Adds the given node as a child of this ASTNode.
*
* This method adds child nodes from right to left.
*
* @param disownedChild the ASTNode instance to add.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see addChild(ASTNode* disownedChild)
* @see replaceChild(unsigned int n, ASTNode* disownedChild, bool delreplaced)
* @see insertChild(unsigned int n, ASTNode* disownedChild)
* @see removeChild(unsigned int n)
*/
int prependChild (ASTNode* disownedChild);
/**
* Removes the nth child of this ASTNode object.
*
* @param n unsigned int the index of the child to remove.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see addChild(ASTNode* disownedChild)
* @see prependChild(ASTNode* disownedChild)
* @see replaceChild(unsigned int n, ASTNode* disownedChild, bool delreplaced)
* @see insertChild(unsigned int n, ASTNode* disownedChild)
*/
int removeChild(unsigned int n);
/**
* Replaces the nth child of this ASTNode with the given ASTNode.
*
* @param n unsigned int the index of the child to replace.
* @param disownedChild ASTNode to replace the nth child.
* Will become a child of the parent node.
* @param delreplaced boolean indicating whether to delete the replaced child.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see addChild(ASTNode* disownedChild)
* @see prependChild(ASTNode* disownedChild)
* @see insertChild(unsigned int n, ASTNode* disownedChild)
* @see removeChild(unsigned int n)
*/
int replaceChild(unsigned int n, ASTNode *disownedChild, bool delreplaced=false);
/**
* Inserts the given ASTNode node at a given point in the current ASTNode's
* list of children.
*
* @param n unsigned int the index of the ASTNode being added.
* @param disownedChild ASTNode to insert as the nth child.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see addChild(ASTNode* disownedChild)
* @see prependChild(ASTNode* disownedChild)
* @see replaceChild(unsigned int n, ASTNode* disownedChild, bool delreplaced)
* @see removeChild(unsigned int n)
*/
int insertChild(unsigned int n, ASTNode *disownedChild);
/**
* Creates a recursive copy of this node and all its children.
*
* @return a copy of this ASTNode and all its children. The caller owns
* the returned ASTNode and is responsible for deleting it.
*/
ASTNode* deepCopy () const;
/**
* Returns the child at index n of this node.
*
* @param n the index of the child to get.
*
* @return the nth child of this ASTNode or @c NULL if this node has no nth
* child (<code>n > </code>
* @if clike getNumChildren()@else ASTNode::getNumChildren()@endif@~
* <code>- 1</code>).
*
* @see getNumChildren()
* @see getLeftChild()
* @see getRightChild()
*/
virtual ASTNode* getChild (unsigned int n) const;
/**
* Returns the left child of this node.
*
* @return the left child of this ASTNode. This is equivalent to calling
* @if clike getChild()@else ASTNode::getChild(unsigned int)@endif@~
* with an argument of @c 0.
*
* @see getNumChildren()
* @see getChild(@if java unsigned int@endif)
* @see getRightChild()
*/
ASTNode* getLeftChild () const;
/**
* Returns the right child of this node.
*
* @return the right child of this ASTNode, or @c NULL if this node has no
* right child. If
* @if clike getNumChildren()@else ASTNode::getNumChildren()@endif@~
* <code>> 1</code>, then this is equivalent to:
* @verbatim
getChild( getNumChildren() - 1 );
@endverbatim
*
* @see getNumChildren()
* @see getLeftChild()
* @see getChild(@if java unsigned int@endif)
*/
ASTNode* getRightChild () const;
/**
* Returns the number of children of this node.
*
* @return the number of children of this ASTNode, or 0 is this node has
* no children.
*/
unsigned int getNumChildren () const;
/**
* Adds the given XMLNode as a MathML <code><semantics></code>
* element to this ASTNode.
*
* @copydetails doc_about_mathml_semantic_annotations
*
* @param disownedAnnotation the annotation to add.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @copydetails doc_note_mathml_semantic_annotations_uncommon
*
* @see getNumSemanticsAnnotations()
* @see getSemanticsAnnotation(@if java unsigned int@endif)
*/
int addSemanticsAnnotation (XMLNode* disownedAnnotation);
/**
* Returns the number of MathML <code><semantics></code> element
* elements on this node.
*
* @copydetails doc_about_mathml_semantic_annotations
*
* @return the number of annotations of this ASTNode.
*
* @copydetails doc_note_mathml_semantic_annotations_uncommon
*
* @see addSemanticsAnnotation(@if java XMLNode@endif)
* @see getSemanticsAnnotation(@if java unsigned int@endif)
*/
unsigned int getNumSemanticsAnnotations () const;
/**
* Returns the nth MathML <code><semantics></code> element on this
* ASTNode.
*
* @copydetails doc_about_mathml_semantic_annotations
*
* @param n the index of the annotation to return. Callers should
* use ASTNode::getNumSemanticsAnnotations() to first find out how
* many annotations there are.
*
* @return the nth annotation inside this ASTNode, or @c NULL if this node has
* no nth annotation (<code>n ></code>
* @if clike getNumSemanticsAnnotations()@else ASTNode::getNumSemanticsAnnotations()@endif@~
* <code>- 1</code>).
*
* @copydetails doc_note_mathml_semantic_annotations_uncommon
*
* @see addSemanticsAnnotation(@if java XMLNode@endif)
* @see getNumSemanticsAnnotations()
*/
XMLNode* getSemanticsAnnotation (unsigned int n) const;
/**
* Returns a list of nodes satisfying a given predicate.
*
* This performs a depth-first search of the tree rooted at this ASTNode
* object, and returns a List of nodes for which the given function
* <code>predicate(node)</code> returns @c true. For portability between
* different programming languages, the predicate is passed in as a pointer
* to a function. @if clike The function definition must have the type
* @link ASTNode.h::ASTNodePredicate ASTNodePredicate@endlink, which is defined as
* @code{.cpp}
int (*ASTNodePredicate) (const ASTNode *node);
@endcode
* where a return value of nonzero represents @c true and zero
* represents @c false. @endif
*
* @param predicate the predicate to use.
*
* @return the list of nodes for which the predicate returned @c true.
* The List returned is owned by the caller and should be
* deleted after the caller is done using it. The ASTNode objects in the
* list; however, are not owned by the caller (as they still belong to
* the tree itself), and therefore should not be deleted.
*
* @see fillListOfNodes(@if java ASTNodePredicate, List@endif)
*/
List* getListOfNodes (ASTNodePredicate predicate) const;
/**
* Returns a list of nodes rooted at a given node and satisfying a given
* predicate.
*
* This method is identical to calling
* ASTNode::getListOfNodes(@if java ASTNodePredicate@endif), except
* that instead of creating a new List object, it uses the one passed in as
* argument @p lst. This method a depth-first search of the tree rooted at
* this ASTNode object, and adds to the list @p lst the nodes for which the
* given function <code>predicate(node)</code> returns @c true.
*
* For portability between different programming languages, the predicate
* is passed in as a pointer to a function. The function definition must
* have the type @link ASTNode.h::ASTNodePredicate
* ASTNodePredicate@endlink, which is defined as
* @code{.cpp}
int (*ASTNodePredicate) (const ASTNode_t *node);
@endcode
* where a return value of nonzero represents @c true and zero
* represents @c false.
*
* @param predicate the predicate to use.
*
* @param lst the List to which ASTNode objects should be added.
*
* @see getListOfNodes(@if java ASTNodePredicate@endif)
*/
void fillListOfNodes (ASTNodePredicate predicate, List* lst) const;
/**
* Returns the value of this node as a single character.
*
* This function should be called only when ASTNode::getType() returns
* @sbmlconstant{AST_MINUS, ASTNodeType_t}, @sbmlconstant{AST_TIMES,
* ASTNodeType_t}, @sbmlconstant{AST_DIVIDE, ASTNodeType_t} or
* @sbmlconstant{AST_POWER, ASTNodeType_t}.
*
* @return the value of this ASTNode as a single character.
*/
char getCharacter () const;
/**
* Returns the MathML @c id attribute value of this ASTNode.
*
* @return the MathML id of this ASTNode.
*
* @see isSetId()
* @see setId(const std::string& id)
* @see unsetId()
*/
std::string getId () const;
/**
* Returns the MathML @c class attribute value of this ASTNode.
*
* @return the MathML class of this ASTNode, if any exists.
*
* @see isSetClass()
* @see @if java setClassName(const std::string& id)@else setClass()@endif@~
* @see unsetClass()
*/
std::string getClass () const;
/**
* Returns the MathML @c style attribute value of this ASTNode.
*
* @return the MathML style of this ASTNode, if any exists.
*
* @see isSetStyle()
* @see setStyle(const std::string& id)
* @see unsetStyle()
*/
std::string getStyle () const;
/**
* Returns the value of this node as an integer.
*
* If this node type is @sbmlconstant{AST_RATIONAL, ASTNodeType_t}, this
* method returns the value of the numerator.
*
* @return the value of this ASTNode as a (<code>long</code>) integer if type @sbmlconstant{AST_INTEGER, ASTNodeType_t}; the numerator if type @sbmlconstant{AST_RATIONAL, ASTNodeType_t}, and @c 0 (false) otherwise.
*
* @note This function should be called only when
* @if clike getType()@else ASTNode::getType()@endif@~ returns
* @sbmlconstant{AST_INTEGER, ASTNodeType_t} or
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
* It will return @c 0 if the node type is @em not one of these, but since
* @c 0 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
* @c 0 is the actual value.
*
* @see getNumerator()
*/
long getInteger () const;
/**
* Returns the value of this node as a string.
*
* This function may be called on nodes that (1) are not operators, i.e.,
* nodes for which @if clike isOperator()@else ASTNode::isOperator()@endif@~
* returns @c false, and (2) are not numbers, i.e.,
* @if clike isNumber()@else ASTNode::isNumber()@endif@~ returns @c false.
*
* @return the value of this ASTNode as a string, or @c NULL if it is
* a node that does not have a name equivalent (e.g., if it is a number).
*/
const char* getName () const;
/**
* Returns the value of this operator node as a string.
*
* This function may be called on nodes that are operators, i.e., nodes for
* which @if clike isOperator()@else ASTNode::isOperator()@endif@~ returns
* @c true.
*
* @return the name of this operator ASTNode as a string (or @c NULL if not
* an operator).
*/
const char* getOperatorName () const;
/**
* Returns the value of the numerator of this node if of type @sbmlconstant{AST_RATIONAL, ASTNodeType_t}, or the numerical value of the node if of type @sbmlconstant{AST_INTEGER, ASTNodeType_t}; @c 0 (false) otherwise.
*
* This function should be called only when
* @if clike getType()@else ASTNode::getType()@endif@~ returns
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t} or
* @sbmlconstant{AST_INTEGER, ASTNodeType_t}.
* It will return @c 0 if the node type is another type, but since @c 0 may
* be a valid value for the denominator of a rational number or of an integer, it is
* important to be sure that the node type is the correct type in order to
* correctly interpret the returned value.
*
* @return the value of the numerator of this ASTNode if @sbmlconstant{AST_RATIONAL, ASTNodeType_t}, the value if @sbmlconstant{AST_INTEGER, ASTNodeType_t}, or @c 0 (false) otherwise.
*
* @see getDenominator()
* @see getInteger()
*/
long getNumerator () const;
/**
* Returns the value of the denominator of this node.
*
* @return the value of the denominator of this ASTNode, or @c 1 (true) if
* this node is not of type @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
*
* @note This function should be called only when
* @if clike getType()@else ASTNode::getType()@endif@~ returns
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
* It will return @c 1 (true) if the node type is another type, but since @c 1 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.
*
* @see getNumerator()
*/
long getDenominator () const;
/**
* Returns the real-numbered value of this node.
*
* This function performs the necessary arithmetic if the node type is
* @sbmlconstant{AST_REAL_E, ASTNodeType_t} (<em>mantissa *
* 10<sup>exponent</sup></em>) or
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t}
* (<em>numerator / denominator</em>).
*
* @return the value of this ASTNode as a real (double), or @c 0
* if this is not a node that holds a number.
*
* @note This function should be called only when this ASTNode has a
* numerical value type. It will return @c 0 if the node type is another
* type, but since @c 0 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.
*/
double getReal () const;
/**
* Returns the mantissa value of this node.
*
* If @if clike getType()@else ASTNode::getType()@endif@~ returns
* @sbmlconstant{AST_REAL, ASTNodeType_t}, this method is
* identical to ASTNode::getReal().
*
* @return the value of the mantissa of this ASTNode, or @c 0 if this
* node is not a type that has a real-numbered value.
*
* @note This function should be called only when
* @if clike getType()@else ASTNode::getType()@endif@~ returns
* @sbmlconstant{AST_REAL_E, ASTNodeType_t},
* @sbmlconstant{AST_REAL, ASTNodeType_t} or
* @sbmlconstant{AST_NAME_AVOGADRO, ASTNodeType_t}. It
* will return @c 0 if the node type is another type, but since @c 0 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.
*
* @see getExponent()
*/
double getMantissa () const;
/**
* Returns the exponent value of this ASTNode.
*
* @return the value of the exponent of this ASTNode, or @c 0 if this
* is not a type of node that has an exponent.
*
* @note This function should be called only when
* @if clike getType()@else ASTNode::getType()@endif@~
* returns @sbmlconstant{AST_REAL_E, ASTNodeType_t}.
* It will return @c 0 if the node type is another type, but since @c 0 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.
*
* @see getMantissa()
*/
long getExponent () const;
/**
* Returns the numerical value of this ASTNode.
*
* @return the numerical value of this ASTNode, or @c NaN if this
* is not a type of node that has a numerical value.
*
* @note This function will return a numerical value (as a double) for
* any ASTNode_t that represents a number, a constant such as
* @sbmlconstant{AST_CONSTANT_PI, ASTNodeType_t},
* @sbmlconstant{AST_CONSTANT_E, ASTNodeType_t}, or
* @sbmlconstant{AST_NAME_AVOGADRO, ASTNodeType_t}, or
* @c 1 for nodes of type
* @sbmlconstant{AST_CONSTANT_TRUE, ASTNodeType_t} and @c 0 for nodes of type
* @sbmlconstant{AST_CONSTANT_FALSE, ASTNodeType_t}. It does not evaluate
* the node in any way so, for example, it will not return the value of
* a named ASTNode_t or attempt to evaluate a function.
* This includes a node representing @c time i.e. nodes
* of type @sbmlconstant{AST_NAME_TIME, ASTNodeType_t}.
*/
double getValue() const;
/**
* Returns the precedence of this node in the infix math syntax of SBML
* Level 1.
*
* 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 ASTNode.
*
* @return an integer indicating the precedence of this ASTNode.
*/
int getPrecedence () const;
/**
* Returns the type of this ASTNode.
*
* The value returned is one of the Core AST type codes such as
* @sbmlconstant{AST_LAMBDA, ASTNodeType_t},
* @sbmlconstant{AST_PLUS, ASTNodeType_t}, etc.
*
* @return the type of this ASTNode.
*
* @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 ASTNode is
* a construct created by a package rather than libSBML Core, then
* ASTNode::getType() will return
* @sbmlconstant{AST_ORIGINATES_IN_PACKAGE, ASTNodeType_t}.
* Callers can then obtain the package-specific type by
* calling getExtendedType().
*
* @see getExtendedType()
*/
ASTNodeType_t getType () const;
/**
* Returns the extended type of this ASTNode.
*
* The type may be either a core
* @ifnot clike integer type code@else #ASTNodeType_t value@endif
* or a value of a type code defined by an SBML Level 3 package.
*
* @return the type of this ASTNode.
*
* @note When the ASTNode is of a type from a package, the value returned
* by ASTNode::getType() will be
* @sbmlconstant{AST_ORIGINATES_IN_PACKAGE, ASTNodeType_t}
* 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.
*
* @see getType()
*/
virtual int getExtendedType() const;
/**
* Returns the units of this ASTNode.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @return the units of this ASTNode.
*
* @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.
*
* @see @sbmlfunction{parseL3Formula, String}
*/
std::string getUnits () const;
/**
* Returns @c true if this node represents the predefined
* value for Avogadro's constant.
*
* 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 @sbmlconstant{AST_NAME_AVOGADRO, ASTNodeType_t}.
* This method returns @c true if this node has that type.
*
* @return @c true if this ASTNode is the special symbol avogadro,
* @c false otherwise.
*
* @see @sbmlfunction{parseL3Formula, String}
*/
virtual bool isAvogadro () const;
/**
* Returns @c true if this node has a Boolean type.
*
* The ASTNode objects that have Boolean types are the logical operators,
* relational operators, and the constants @c true or @c false.
*
* @return @c true if this ASTNode has a Boolean type, @c false otherwise.
*/
virtual bool isBoolean () const;
/**
* Returns @c true if this node returns a Boolean value.
*
* This function looks at the whole ASTNode rather than just the top level
* of the ASTNode. Thus, it will consider return values from piecewise
* statements. In addition, if this ASTNode uses a function call to a
* user-defined function, the return value of the corresponding
* FunctionDefinition object will be determined. Note that this is only
* possible where the ASTNode can trace its parent Model; that is, the
* ASTNode must represent the <code><math></code> element of some
* SBML object that has already been added to an instance of an
* SBMLDocument.
*
* @param model the Model to use as context.
*
* @see isBoolean()
*
* @return @c true if this ASTNode returns a boolean, @c false otherwise.
*/
bool returnsBoolean (const Model* model=NULL) const;
/**
* Returns @c true if this node represents a MathML
* constant.
*
* Examples of MathML constants include such things as pi.
*
* @return @c true if this ASTNode is a MathML constant, @c false
* otherwise.
*
* @note This function will also return @c true for nodes of type
* @sbmlconstant{AST_NAME_AVOGADRO, ASTNodeType_t} in SBML Level 3.
*/
virtual bool isConstant () const;
/**
* Returns @c true if this node represents a MathML
* constant numeric.
*
* Examples of MathML constants include such things as pi.
*
* @return @c true if this ASTNode is a MathML constant, @c false
* otherwise.
*
* @note This function will also return @c true for nodes of type
* @sbmlconstant{AST_NAME_AVOGADRO, ASTNodeType_t} in SBML Level 3.
*/
virtual bool isConstantNumber() const;
/**
* Returns @c true if this node represents a function.
*
* 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
* FunctionDefinition in SBML Level 2 and 3).
*
* @return @c true if this ASTNode is a function, @c false otherwise.
*/
virtual bool isFunction () const;
/**
* Returns @c true if this node represents the special IEEE 754
* value for infinity.
*
* @return @c true if this ASTNode is the special IEEE 754 value infinity,
* @c false otherwise.
*/
bool isInfinity () const;
/**
* Returns @c true if this node of type @sbmlconstant{AST_INTEGER,
* ASTNodeType_t}.
*
* @return @c true if this ASTNode is of type @sbmlconstant{AST_INTEGER,
* ASTNodeType_t}, @c false otherwise.
*/
virtual bool isInteger () const;
/**
* Returns @c true if this node is a MathML
* <code><lambda></code>.
*
* @return @c true if this ASTNode is of type @sbmlconstant{AST_LAMBDA,
* ASTNodeType_t}, @c false otherwise.
*/
virtual bool isLambda () const;
/**
* Returns @c true if this node represents a @c log10 function.
*
* More precisely, this predicate returns @c true if the node type is
* @sbmlconstant{AST_FUNCTION_LOG, ASTNodeType_t} with two children, the
* first of which is an @sbmlconstant{AST_INTEGER, ASTNodeType_t} equal to
* 10.
*
* @return @c true if the given ASTNode represents a @c log10() function,
* @c false otherwise.
*
* @see @sbmlfunction{parseL3Formula, String}
*/
virtual bool isLog10 () const;
/**
* Returns @c true if this node is a MathML logical operator.
*
* The possible MathML logical operators in SBML core are @c and, @c or, @c not,
* @c xor, and (as of SBML Level 3 Version 2) @c implies. If
* the node represents a logical operator defined in a Level 3 package,
* it will also return @c true.
*
* @return @c true if this ASTNode is a MathML logical operator, @c false
* otherwise.
*/
virtual bool isLogical () const;
/**
* Returns @c true if this node is a user-defined variable name
* or the symbols for time or Avogadro's constant.
*
* 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. Note that this
* method does @em not return @c true for the other <code>csymbol</code>
* values defined by SBML, "delay", because the "delay" is a function
* and not a constant or variable.
*
* @return @c true if this ASTNode is a user-defined variable name in SBML
* or the special symbols for time or Avogadro's constant. It returns
* @c false otherwise.
*/
virtual bool isName () const;
/**
* Returns @c true if this node represents the special IEEE 754
* value "not a number" (NaN).
*
* @return @c true if this ASTNode is the special IEEE 754 NaN, @c false
* otherwise.
*/
bool isNaN () const;
/**
* Returns @c true if this node represents the special IEEE 754
* value "negative infinity".
*
* @return @c true if this ASTNode is the special IEEE 754 value negative
* infinity, @c false otherwise.
*/
bool isNegInfinity () const;
/**
* Returns @c true if this node contains a number.
*
* @return @c true if this ASTNode is a number, @c false otherwise.
*/
virtual bool isNumber () const;
/**
* Returns @c true if this node is a mathematical
* operator.
*
* The possible mathematical operators in the MathML syntax supported by
* SBML are <code>+</code>, <code>-</code>, <code>*</code>, <code>/</code>
* and <code>^</code> (power).
*
* @return @c true if this ASTNode is an operator, @c false otherwise.
*/
virtual bool isOperator () const;
/**
* Returns @c true if this node is the MathML
* <code><piecewise></code> construct.
*
* @return @c true if this ASTNode is a MathML @c piecewise function,
* @c false otherwise.
*/
virtual bool isPiecewise () const;
/**
* Predicate returning @c true if this node is a MathML
* qualifier.
*
* The MathML qualifier node types are @c bvar, @c degree, @c base,
* @c piece, and @c otherwise.
*
* @return @c true if this ASTNode is a MathML qualifier, @c false
* otherwise.
*/
virtual bool isQualifier() const;
/**
* Returns @c true if this node represents a rational number.
*
* @return @c true if this ASTNode is of type @sbmlconstant{AST_RATIONAL,
* ASTNodeType_t}, @c false otherwise.
*/
virtual bool isRational () const;
/**
* Returns @c true if this node can represent a real number.
*
* More precisely, this node must be of one of the following types:
* @sbmlconstant{AST_REAL, ASTNodeType_t}, @sbmlconstant{AST_REAL_E,
* ASTNodeType_t} or @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
*
* @return @c true if the value of this ASTNode can represented as a real
* number, @c false otherwise.
*/
virtual bool isReal () const;
/**
* Returns @c true if this node is a MathML
* relational operator.
*
* The MathML relational operators are <code>==</code>, <code>>=</code>,
* <code>></code>, <code><</code>, and <code>!=</code>.
*
* @return @c true if this ASTNode is a MathML relational operator,
* @c false otherwise.
*/
virtual bool isRelational () const;
/**
* Predicate returning @c true if this node is a MathML
* semantics node.
*
* @return @c true if this ASTNode is a MathML semantics node, @c false
* otherwise.
*/
virtual bool isSemantics() const;
/**
* Returns @c true if this node represents a square root
* function.
*
* More precisely, the node type must be @sbmlconstant{AST_FUNCTION_ROOT,
* ASTNodeType_t} with two children, the first of which is an
* @sbmlconstant{AST_INTEGER, ASTNodeType_t} node having value equal to 2.
*
* @return @c true if the given ASTNode represents a <code>sqrt()</code>
* function, @c false otherwise.
*/
bool isSqrt () const;
/**
* Returns @c true if this node is a unary minus operator.
*
* A node is defined as a unary minus node if it is of type
* @sbmlconstant{AST_MINUS, ASTNodeType_t} and has exactly one child.
*
* For numbers, unary minus nodes can be "collapsed" by negating the
* number. In fact, @sbmlfunction{parseFormula, String} does this during
* its parsing process, and @sbmlfunction{parseL3Formula, String} has a
* configuration option that allows this behavior to be turned on or off.
* However, unary minus nodes for symbols (@sbmlconstant{AST_NAME,
* ASTNodeType_t}) or functions cannot be "collapsed", so this predicate function is
* necessary.
*
* @return @c true if this ASTNode is a unary minus, @c false
* otherwise.
*
* @see @sbmlfunction{parseL3Formula, String}
*/
bool isUMinus () const;
/**
* Returns @c true if this node is a unary plus operator.
*
* A node is defined as a unary plus node if it is of type
* @sbmlconstant{AST_PLUS, ASTNodeType_t} and has exactly one child.
*
* @return @c true if this ASTNode is a unary plus, @c false otherwise.
*/
bool isUPlus () const;
/**
* Returns @c true if this node is of a certain type with a specific number
* of children.
*
* 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.
*
* @param type the type of ASTNode sought.
* @param numchildren the number of child nodes sought.
*
* @return @c true if this ASTNode is has the specified type and number of
* children, @c false otherwise.
*/
int hasTypeAndNumChildren(int type, unsigned int numchildren) const;
/**
* Returns @c true if this node has an unknown type.
*
* "Unknown" nodes have the type @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}.
* Nodes with unknown types will not appear in an ASTNode tree returned by
* libSBML based upon valid SBML input; the only situation in which a node
* with type @sbmlconstant{AST_UNKNOWN, ASTNodeType_t} may appear is
* immediately after having create a new, untyped node using the ASTNode
* constructor. Callers creating nodes should endeavor to set the type to
* a valid node type as soon as possible after creating new nodes.
*
* @return @c true if this ASTNode is of type @sbmlconstant{AST_UNKNOWN,
* ASTNodeType_t}, @c false otherwise.
*/
virtual bool isUnknown() const;
/**
* Returns @c true if this node has a value for the MathML
* attribute @c id.
*
* @return @c true if this ASTNode has an attribute id, @c false
* otherwise.
*
* @see isSetClass()
* @see isSetStyle()
* @see setId(const std::string& id)
* @see unsetId()
*/
bool isSetId() const;
/**
* Returns @c true if this node has a value for the MathML
* attribute @c class.
*
* @return @c true if this ASTNode has an attribute class, @c false
* otherwise.
*
* @see isSetId()
* @see isSetStyle()
* @see @if java setClassName(const std::string& id)@else setClass()@endif@~
* @see unsetClass()
*/
bool isSetClass() const;
/**
* Returns @c true if this node has a value for the MathML
* attribute @c style.
*
* @return @c true if this ASTNode has an attribute style, @c false
* otherwise.
*
* @see isSetClass()
* @see isSetId()
* @see setStyle(const std::string& id)
* @see unsetStyle()
*/
bool isSetStyle() const;
/**
* Returns @c true if this node has the attribute
* <code>sbml:units</code>.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @return @c true if this ASTNode has units associated with it, @c false
* otherwise.
*
* @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.
*
* @see hasUnits()
* @see setUnits(const std::string& units)
*/
bool isSetUnits() const;
/**
* Returns @c true if this node or any of its
* children nodes have the attribute <code>sbml:units</code>.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @return @c true if this ASTNode or its children has units associated
* with it, @c false otherwise.
*
* @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.
*
* @see isSetUnits()
* @see setUnits(const std::string& units)
*/
bool hasUnits() const;
/**
* Sets the value of this ASTNode to the given character. If character
* is one of @c +, @c -, <code>*</code>, <code>/</code> or @c ^, the node
* type will be set accordingly. For all other characters, the node type
* will be set to @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}.
*
* @param value the character value to which the node's value should be
* set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setCharacter(char value);
/**
* Sets the MathML attribute @c id of this ASTNode.
*
* @param id @c string representing the identifier.
*
* @copydetails doc_returns_one_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @see isSetId()
* @see getId()
* @see unsetId()
*/
int setId(const std::string& id);
/**
* Sets the MathML attribute @c class of this ASTNode.
*
* @param className @c string representing the MathML class for this node.
*
* @copydetails doc_returns_one_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @if java
* @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.
* @endif@~
*
* @see isSetClass()
* @see getClass()
* @see unsetClass()
*/
int setClass(const std::string& className);
/**
* Sets the MathML attribute @c style of this ASTNode.
*
* @param style @c string representing the identifier.
*
* @copydetails doc_returns_one_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @see isSetStyle()
* @see getStyle()
* @see unsetStyle()
*/
int setStyle(const std::string& style);
/**
* Sets the value of this ASTNode to the given name.
*
* As a side effect, this ASTNode object's type will be reset to
* @sbmlconstant{AST_NAME, ASTNodeType_t} if (and <em>only if</em>) the
* ASTNode was previously an operator (i.e., @if clike isOperator()@else
* ASTNode::isOperator()@endif@~ returns @c true), number (i.e., @if clike
* isNumber()@else ASTNode::isNumber()@endif@~ returns @c true), or
* unknown. This allows names to be set for @sbmlconstant{AST_FUNCTION,
* ASTNodeType_t} nodes and the like.
*
* @param name the string containing the name to which this node's value
* should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setName(const char* name);
/**
* Sets the value of this ASTNode to the given integer
*
* As a side effect, this operation sets the node type to
* @sbmlconstant{AST_INTEGER, ASTNodeType_t}.
*
* @param value the integer to which this node's value should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setValue(int value);
/**
* Sets the value of this ASTNode to the given (@c long) integer
*
* As a side effect, this operation sets the node type to
* @sbmlconstant{AST_INTEGER, ASTNodeType_t}.
*
* @param value the integer to which this node's value should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setValue(long value);
/**
* Sets the value of this ASTNode to the given rational.
*
* As a side effect, this operation sets the node type to
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
*
* @param numerator the numerator value of the rational.
* @param denominator the denominator value of the rational.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setValue(long numerator, long denominator);
/**
* Sets the value of this ASTNode to the given real (@c double).
*
* As a side effect, this operation sets the node type to
* @sbmlconstant{AST_REAL, ASTNodeType_t}.
*
* This is functionally equivalent to:
* @verbatim
setValue(value, 0);
@endverbatim
*
* @param value the @c double format number to which this node's value
* should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setValue(double value);
/**
* Sets the value of this ASTNode to the given real (@c double)
*
* As a side effet, this operation sets the node type to
* @sbmlconstant{AST_REAL_E, ASTNodeType_t}.
*
* @param mantissa the mantissa of this node's real-numbered value.
* @param exponent the exponent of this node's real-numbered value.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*/
int setValue(double mantissa, long exponent);
/**
* Sets the type of this ASTNode to the given type code.
*
* @param type the type to which this node should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
*
* @note A side-effect of doing this is that any numerical values
* previously stored in this node are reset to zero.
*
* @see getType()
* @see setType(int Type)
*/
int setType (ASTNodeType_t type);
/**
* Sets the type of this ASTNode.
*
* This uses integer type codes, which may come from @if clike the
* enumeration #ASTNodeType_t@else the set
* of static integer constants whose names begin with the prefix
* <code>AST_</code> @endif @if java defined in the interface class
* <code><a href="libsbmlConstants.html">libsbmlConstants</a></code>
* @endif@if python defined in the interface class @link libsbml
* libsbml@endlink@endif@~ or an enumeration of AST types in an SBML
* Level 3 package.
*
* @param type the integer representing the type to which this node should
* be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
*
* @note A side-effect of doing this is that any numerical values
* previously stored in this node are reset to zero.
*
* @see getType()
* @if clike @see setType(ASTNodeType_t type)@endif@~
*/
int setType (int type);
/**
* Sets the units of this ASTNode to units.
*
* The units will be set @em only if this ASTNode object represents a
* MathML <code><cn></code> element, i.e., represents a number.
* Callers may use
* @if clike isNumber()@else ASTNode::isNumber()@endif@~
* to inquire whether the node is of that type.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @param units @c string representing the unit identifier.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_ATTRIBUTE_VALUE, OperationReturnValues_t}
*
* @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.
*
* @see isSetUnits()
* @see hasUnits()
*/
int setUnits(const std::string& units);
/**
* Swaps the children of this node with the children of another node.
*
* @param that the other node whose children should be used to replace
* <em>this</em> node's children.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
int swapChildren(ASTNode* that);
/**
* Renames all the SIdRef attributes on this node and its child nodes.
*
* @param oldid the old identifier.
* @param newid the new identifier.
*/
virtual void renameSIdRefs(const std::string& oldid, const std::string& newid);
/**
* Renames all the UnitSIdRef attributes on this node and its child nodes.
*
* The only place UnitSIDRefs appear in MathML <code><cn></code>
* elements, so the effects of this method are limited to that.
*
* @param oldid the old identifier.
* @param newid the new identifier.
*/
virtual void renameUnitSIdRefs(const std::string& oldid, const std::string& newid);
/** @cond doxygenLibsbmlInternal */
/**
* Replace any nodes of type AST_NAME with the name 'id' from the child
* 'math' object with the provided ASTNode.
*
*/
virtual void replaceIDWithFunction(const std::string& id, const ASTNode* function);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Replaces any 'AST_NAME_TIME' nodes with a node that multiplies time by
* the given function.
*
*/
//virtual void multiplyTimeBy(const ASTNode* function);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
virtual void setIsChildFlag(bool flag);
/** @endcond */
/**
* Unsets the units of this ASTNode.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
int unsetUnits();
/**
* Unsets the MathML @c id attribute of this ASTNode.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
int unsetId();
/**
* Unsets the MathML @c class attribute of this ASTNode.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
int unsetClass();
/**
* Unsets the MathML @c style attribute of this ASTNode.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*/
int unsetStyle();
/**
* Sets the MathML attribute @c definitionURL.
*
* @param url the URL value for the @c definitionURL attribute.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
*
* @see setDefinitionURL(const std::string& url)
* @see getDefinitionURL()
* @see getDefinitionURLString()
*/
int setDefinitionURL(XMLAttributes url);
/**
* Sets the MathML attribute @c definitionURL.
*
* @param url the URL value for the @c definitionURL attribute.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
*
* @see setDefinitionURL(XMLAttributes url)
* @see getDefinitionURL()
* @see getDefinitionURLString()
*/
int setDefinitionURL(const std::string& url);
/**
* Returns the MathML @c definitionURL attribute value.
*
* @return the value of the @c definitionURL attribute, in the form of
* a libSBML XMLAttributes object.
*
* @see setDefinitionURL(XMLAttributes url)
* @see setDefinitionURL(const std::string& url)
* @see getDefinitionURLString()
*/
XMLAttributes* getDefinitionURL() const;
/**
* Replaces occurrences of a given name with a given ASTNode.
*
* For example, if the formula in this ASTNode is <code>x + y</code>,
* and the function is called with @c bvar = @c "x" and @c arg = an ASTNode
* representing the real value @c 3. This method would substitute @c 3 for
* @c x within this ASTNode object, resulting in the forula <code>3 + y</code>.
*
* @param bvar a string representing the variable name to be substituted.
*
* @param arg an ASTNode representing the name/value/formula to use as
* a replacement.
*/
void replaceArgument(const std::string& bvar, ASTNode *arg);
/**
* Sets the parent SBML object of this node. Is not recursive, and will not set the parent SBML object of any children of this node.
*
* @param sb the parent SBML object of this ASTNode.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @see isSetParentSBMLObject()
* @see getParentSBMLObject()
* @see unsetParentSBMLObject()
*/
int setParentSBMLObject(SBase* sb);
/**
* Returns the parent SBML object.
*
* @return the parent SBML object of this ASTNode.
*
* @see isSetParentSBMLObject()
* @if clike @see setParentSBMLObject()@endif@~
* @see unsetParentSBMLObject()
*/
SBase * getParentSBMLObject() const;
/**
* Unsets the parent SBML object.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @see isSetParentSBMLObject()
* @see getParentSBMLObject()
* @if clike @see setParentSBMLObject()@endif@~
*/
int unsetParentSBMLObject();
/**
* Returns @c true if this node has a value for the parent SBML
* object.
*
* @return @c true if this ASTNode has an parent SBML object set, @c false otherwise.
*
* @see getParentSBMLObject()
* @if clike @see setParentSBMLObject()@endif@~
* @see unsetParentSBMLObject()
*/
bool isSetParentSBMLObject() const;
/**
* Reduces this ASTNode to a binary tree.
*
* Example: if this 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 ASTNode object.
*/
void reduceToBinary();
/**
* Sets the user data of this node.
*
* 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.
*
* @param userData specifies the new user data.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @if clike
* @see isSetUserData()
* @see getUserData()
* @see unsetUserData()
* @endif
*/
int setUserData(void *userData);
/**
* Returns the user data that has been previously set via setUserData().
*
* @return the user data of this node, or @c NULL if no user data has been
* set.
*
* @if clike
* @see isSetUserData()
* @see setUserData()
* @see unsetUserData()
* @endif@~
*/
void *getUserData() const;
/**
* Unsets the user data of this node.
*
* 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.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @if clike
* @see setUserData()
* @see getUserData()
* @see isSetUserData()
* @endif@~
*/
int unsetUserData();
/**
* Returns @c true if this node has a user data object.
*
* @return @c true if this ASTNode has a user data object set, @c false
* otherwise.
*
* @if clike
* @see setUserData()
* @see getUserData()
* @see unsetUserData()
* @endif@~
*/
bool isSetUserData() const;
/**
* Returns @c true or @c false depending on whether this
* ASTNode is well-formed.
*
* @note An 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.
*
* @return @c true if this ASTNode is well-formed, @c false otherwise.
*
* @see hasCorrectNumberArguments()
*/
bool isWellFormedASTNode() const;
/**
* Returns @c true if this ASTNode has the correct number of children for
* its type.
*
* For example, an ASTNode with type @sbmlconstant{AST_MINUS, ASTNodeType_t}
* expects 1 or 2 child nodes.
*
* @return @c true if this ASTNode has the appropriate number of children
* for its type, @c false otherwise.
*
* @note This function performs a check on the top-level node only. Child
* nodes are not checked.
*
* @see isWellFormedASTNode()
*/
bool hasCorrectNumberArguments() const;
/* additional to original AST */
/**
* Returns the MathML @c definitionURL attribute value as a string.
*
* @return the value of the @c definitionURL attribute, as a string.
*
* @see getDefinitionURL()
* @see setDefinitionURL(const std::string& url)
* @see setDefinitionURL(XMLAttributes url)
*/
std::string getDefinitionURLString() const;
/** @cond doxygenLibsbmlInternal */
virtual bool representsBvar() const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Returns @c true if this ASTNode has uses math constructs introduced in L3V2.
*
* @return @c true if this ASTNode uses math constructs introduced in
* L3V2, @c false otherwise.
*/
bool usesL3V2MathConstructs() const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Returns @c true if this ASTNode has uses math rateOf constructs introduced in L3V2.
*
* @return @c true if this ASTNode uses math constructs introduced in
* L3V2, @c false otherwise.
*/
bool usesRateOf() const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/*
* writes the node to the stream
*/
virtual void write(XMLOutputStream& stream) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/*
* reads the node from the stream
*/
virtual bool read(XMLInputStream& stream, const std::string& reqd_prefix="");
/** @endcond */
/** @cond doxygenLibsbmlInternal */
virtual void writeNodeOfType(XMLOutputStream& stream, int type,
bool inChildNode = false) const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
unsigned int getNumBvars() const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
virtual int getTypeCode () const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
virtual const std::string& getPackageName () const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
virtual ASTBasePlugin* getPlugin(const std::string& package);
virtual const ASTBasePlugin* getPlugin(const std::string& package) const;
virtual ASTBasePlugin* getPlugin(unsigned int n);
virtual const ASTBasePlugin* getPlugin(unsigned int n) const;
virtual unsigned int getNumPlugins() const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
unsigned int getNumPiece () const;
/** @endcond */
protected:
/** @cond doxygenLibsbmlInternal */
ASTNumber * mNumber;
ASTFunction * mFunction;
/* put this here for historical purposes */
char mChar;
std::string mHistoricalName;
bool containsVariable(const std::string id) const;
unsigned int getNumVariablesWithUndeclaredUnits(Model * m = NULL) const;
friend class UnitFormulaFormatter;
friend class ASTFunctionBase;
friend class RateOfAssignmentMathCheck;
/**
* Internal helper function for canonicalize().
*/
bool canonicalizeConstant ();
bool canonicalizeFunction ();
bool canonicalizeFunctionL1 ();
bool canonicalizeLogical ();
bool canonicalizeRelational ();
friend class MathML;
/* additional to original astnode */
bool hasCnUnits() const;
const std::string& getUnitsPrefix() const;
/* constructors for wrapping a number or a function node into
* a newASTNode
*/
ASTNode(ASTNumber* number);
ASTNode(ASTFunction* function);
void reset();
void connectPlugins();
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/*
* return the number member variable
*/
virtual ASTNumber * getNumber() const;
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/*
* return the function member variable
*/
virtual ASTFunction * getFunction() const;
/** @endcond */
friend class ASTSemanticsNode;
};
LIBSBML_CPP_NAMESPACE_END
#endif /* __cplusplus */
#ifndef SWIG
LIBSBML_CPP_NAMESPACE_BEGIN
BEGIN_C_DECLS
/**
* Creates a new ASTNode_t structure and returns a pointer to it.
*
* The returned node will have a type of @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}. The caller should
* be set the node type to something else as soon as possible using
* ASTNode_setType().
*
* @returns a pointer to the fresh ASTNode_t structure.
*
* @see ASTNode_createWithType()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_create (void);
/**
* Creates a new ASTNode_t structure and sets its type.
*
* @param type the type of node to create.
*
* @returns a pointer to the fresh ASTNode_t structure.
*
* @see ASTNode_create()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_createWithType (ASTNodeType_t type);
/**
* Creates a new ASTNode_t structure from the given Token_t data and returns
* a pointer to it.
*
* The returned ASTNode_t structure will contain the same data as the Token_t
* structure. The Token_t structure is used to store a token returned by
* FormulaTokenizer_nextToken(). It contains a union whose members can store
* different types of tokens, such as numbers and symbols.
*
* @param token the Token_t structure to use.
*
* @returns a pointer to the new ASTNode_t structure.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_createFromToken (Token_t *token);
/**
* Frees the given ASTNode_t structure, including any child nodes.
*
* @param node the node to be freed.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
void
ASTNode_free (ASTNode_t *node);
/**
* Frees the name field of a given node and sets it to null.
*
* This operation is only applicable to ASTNode_t structures corresponding to
* operators, numbers, or @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}. This
* method will have no effect on other types of nodes.
*
* @param node the node whose name field should be freed.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_UNEXPECTED_ATTRIBUTE, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_freeName (ASTNode_t *node);
/**
* Converts a given node to a canonical form and returns @c 1 (true) if successful,
* @c 0 (false) otherwise.
*
* The rules determining the canonical form conversion are as follows:
*
* @li If the node type is @sbmlconstant{AST_NAME, ASTNodeType_t}
* and the node name matches @c "ExponentialE", @c "Pi", @c "True" or
* @c "False" 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 @sbmlconstant{AST_FUNCTION, ASTNodeType_t} 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.
*
* SBML Level 1 function names are searched first; thus, for example,
* canonicalizing @c log will result in a node type of
* @sbmlconstant{AST_FUNCTION_LN, ASTNodeType_t}. (See the SBML Level 1
* Version 2 Specification, Appendix C.)
*
* 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 @c sqr and a single
* child node (the argument) will be transformed to a node of type
* @sbmlconstant{AST_FUNCTION_POWER, ASTNodeType_t} with
* two children. The first child will remain unchanged, but the second child
* will be an ASTNode_t of type @sbmlconstant{AST_INTEGER, ASTNodeType_t} and
* a value of 2. The function names that result in structural changes are:
* @c log10, @c sqr, and @c sqrt.
*
* @param node the node to be converted.
*
* @returns @c 1 (true) if successful, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_canonicalize (ASTNode_t *node);
/**
* Adds a node as a child of another node.
*
* Child nodes are added in order from "left-to-right".
*
* @param node the node which will get the new child node.
* @param disownedChild the ASTNode_t instance to add.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see ASTNode_prependChild()
* @see ASTNode_replaceChild()
* @see ASTNode_insertChild()
* @see ASTNode_removeChild()
* @see ASTNode_isWellFormedASTNode()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_addChild (ASTNode_t *node, ASTNode_t *disownedChild);
/**
* Adds a node as a child of another node.
*
* This method adds child nodes from right to left.
*
* @param node the node that will receive the given child node.
* @param disownedChild the ASTNode_t instance to add.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see ASTNode_addChild()
* @see ASTNode_replaceChild()
* @see ASTNode_insertChild()
* @see ASTNode_removeChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_prependChild (ASTNode_t *node, ASTNode_t *disownedChild);
/**
* Removes the nth child of a given node.
*
* @param node the node whose child element is to be removed.
* @param n unsigned int the index of the child to remove.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see ASTNode_addChild()
* @see ASTNode_prependChild()
* @see ASTNode_replaceChild()
* @see ASTNode_insertChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_removeChild(ASTNode_t* node, unsigned int n);
/**
* Replaces but does not delete the nth child of a given node.
*
* @param node the ASTNode_t node to modify.
* @param n unsigned int the index of the child to replace.
* @param disownedChild ASTNode_t structure to replace the nth child.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see ASTNode_addChild()
* @see ASTNode_prependChild()
* @see ASTNode_insertChild()
* @see ASTNode_removeChild()
* @see ASTNode_replaceAndDeleteChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_replaceChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
/**
* Replaces and deletes the nth child of a given node.
*
* @param node the ASTNode_t node to modify.
* @param n unsigned int the index of the child to replace.
* @param disownedChild ASTNode_t structure to replace the nth child.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see ASTNode_addChild()
* @see ASTNode_prependChild()
* @see ASTNode_insertChild()
* @see ASTNode_removeChild()
* @see ASTNode_replaceChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_replaceAndDeleteChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
/**
* Insert a new child node at a given point in the list of children of a
* node.
*
* @param node the ASTNode_t structure to modify.
* @param n unsigned int the index of the location where the @p disownedChild is
* to be added.
* @param disownedChild ASTNode_t structure to insert as the nth child.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INDEX_EXCEEDS_SIZE, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @copydetails doc_warning_modifying_structure
*
* @see ASTNode_addChild()
* @see ASTNode_prependChild()
* @see ASTNode_replaceChild()
* @see ASTNode_removeChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_insertChild(ASTNode_t* node, unsigned int n, ASTNode_t * disownedChild);
/**
* Creates a recursive copy of a node and all its children.
*
* @param node the ASTNode_t structure to copy.
*
* @return a copy of this ASTNode_t structure and all its children. The
* caller owns the returned structure and is reponsible for deleting it.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_deepCopy (const ASTNode_t *node);
/**
* Returns a child of a node according to its index number.
*
* @param node the node whose child should be obtained.
* @param n the index of the desired child node.
*
* @return the nth child of this ASTNode_t or a null pointer if this node has
* no nth child (<code>n > </code> ASTNode_getNumChildre() <code>- 1</code>).
*
* @see ASTNode_getNumChildren()
* @see ASTNode_getLeftChild()
* @see ASTNode_getRightChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_getChild (const ASTNode_t *node, unsigned int n);
/**
* Returns the left-most child of a given node.
*
* This is equivalent to <code>ASTNode_getChild(node, 0)</code>.
*
* @param node the node whose child is to be returned.
*
* @return the left child, or a null pointer if there are no children.
*
* @see ASTNode_getNumChildren()
* @see ASTNode_getChild()
* @see ASTNode_getRightChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_getLeftChild (const ASTNode_t *node);
/**
* Returns the right-most child of a given node.
*
* If <code>ASTNode_getNumChildren(node) > 1</code>, then this is equivalent
* to:
* @verbatim
ASTNode_getChild(node, ASTNode_getNumChildren(node) - 1);
@endverbatim
*
* @param node the node whose child node is to be obtained.
*
* @return the right child of @p node, or a null pointer if @p node has no
* right child.
*
* @see ASTNode_getNumChildren()
* @see ASTNode_getLeftChild()
* @see ASTNode_getChild()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNode_t *
ASTNode_getRightChild (const ASTNode_t *node);
/**
* Returns the number of children of a given node.
*
* @param node the ASTNode_t structure whose children are to be counted.
*
* @return the number of children of @p node, or @c 0 is it has no children.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
unsigned int
ASTNode_getNumChildren (const ASTNode_t *node);
/**
* Returns a list of nodes rooted at a given node and satisfying a given
* predicate.
*
* This function performs a depth-first search of the tree rooted at the
* given ASTNode_t structure, and returns a List_t structure of nodes for
* which the given function <code>predicate(node)</code> returns true (i.e.,
* nonzero).
*
* The predicate is passed in as a pointer to a function. The function
* definition must have the type @link ASTNode.h::ASTNodePredicate
* ASTNodePredicate@endlink, which is defined as
* @code{.c}
int (*ASTNodePredicate) (const ASTNode_t *node);
@endcode
* where a return value of @c nonzero represents true and @c zero
* represents false.
*
* @param node the node at which the search is to be started.
* @param predicate the predicate to use.
*
* @return the list of nodes for which the predicate returned true (i.e.,
* nonzero). The List_t structure returned is owned by the caller and
* should be deleted after the caller is done using it. The ASTNode_t
* structures in the list, however, are @em not owned by the caller (as they
* still belong to the tree itself), and therefore should @em not be deleted.
*
* @see ASTNode_fillListOfNodes()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
List_t *
ASTNode_getListOfNodes (const ASTNode_t *node, ASTNodePredicate predicate);
/**
* Returns a list of nodes rooted at a given node and satisfying a given
* predicate.
*
* This method is identical to ASTNode_getListOfNodes(), except that instead
* of creating a new List_t structure, it uses the one passed in as argument
* @p lst. This function performs a depth-first search of the tree rooted at
* the given ASTNode_t structure, and adds to @p lst the nodes for which the
* given function <code>predicate(node)</code> returns true (i.e., nonzero).
*
* The predicate is passed in as a pointer to a function. The function
* definition must have the type @link ASTNode.h::ASTNodePredicate
* ASTNodePredicate@endlink, which is defined as
* @code{.c}
int (*ASTNodePredicate) (const ASTNode_t *node);
@endcode
* where a return value of @c nonzero represents true and @c zero
* represents false.
*
* @param node the node at which the search is to be started.
* @param predicate the predicate to use.
* @param lst the list to use.
*
* @see ASTNode_getListOfNodes()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
void
ASTNode_fillListOfNodes ( const ASTNode_t *node,
ASTNodePredicate predicate,
List_t *lst );
/**
* Returns the value of a node as a single character.
*
* This function should be called only when ASTNode_getType() returns
* @sbmlconstant{AST_PLUS, ASTNodeType_t},
* @sbmlconstant{AST_MINUS, ASTNodeType_t},
* @sbmlconstant{AST_TIMES, ASTNodeType_t},
* @sbmlconstant{AST_DIVIDE, ASTNodeType_t} or
* @sbmlconstant{AST_POWER, ASTNodeType_t} for the given
* @p node.
*
* @param node the node whose value is to be returned.
*
* @return the value of @p node as a single character, or the value
* @c CHAR_MAX if @p node is @c NULL.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
char
ASTNode_getCharacter (const ASTNode_t *node);
/**
* Returns the value of a node as an integer.
*
* This function should be called only when ASTNode_getType() returns
* @sbmlconstant{AST_INTEGER, ASTNodeType_t} for the given @p node.
*
* @param node the node whose value is to be returned.
*
* @return the value of the given ASTNode_t structure as a
* (<code>long</code>) integer, or the value @c LONG_MAX if @p node is @c NULL.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
long
ASTNode_getInteger (const ASTNode_t *node);
/**
* Returns the value of a node as a string.
*
* This function may be called on nodes that (1) are not operators, i.e.,
* nodes for which ASTNode_isOperator() returns false (@c 0), and (2) are not
* numbers, i.e., for which ASTNode_isNumber() also returns false (@c 0).
*
* @param node the node whose value is to be returned.
*
* @return the value of @p node as a string, or a null pointer if @p node is @c NULL.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
const char *
ASTNode_getName (const ASTNode_t *node);
/**
* Returns the numerator value of a node representing a rational number.
*
* This function should be called only when ASTNode_getType() returns
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t} for the given @p node.
*
* @param node the node whose value is to be returned.
* @return the value of the numerator of @p node, or the value @c LONG_MAX if
* @p is @c NULL.
*
* @see ASTNode_getDenominator()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
long
ASTNode_getNumerator (const ASTNode_t *node);
/**
* Returns the numerator value of a node representing a rational number.
*
* This function should be called only when ASTNode_getType() returns
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t} for the given @p node.
*
* @param node the node whose value is to be returned.
*
* @return the value of the denominator of @p node, or the value @c LONG_MAX
* if @p node is @c NULL.
*
* @see ASTNode_getNumerator()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
long
ASTNode_getDenominator (const ASTNode_t *node);
/**
* Get the real-numbered value of a node.
*
* This function should be called only when ASTNode_isReal() returns nonzero
* for @p node. This function performs the necessary arithmetic if the node
* type is @sbmlconstant{AST_REAL_E, ASTNodeType_t} (<em>mantissa *
* 10<sup>exponent</sup></em>) or @sbmlconstant{AST_RATIONAL, ASTNodeType_t}
* (<em>numerator / denominator</em>).
*
* @param node the node whose value is to be returned.
*
* @return the value of @p node as a real (double), or NaN if @p node
* is @c NULL.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
double
ASTNode_getReal (const ASTNode_t *node);
/**
* Get the mantissa value of a node.
*
* This function should be called only when ASTNode_getType() returns
* @sbmlconstant{AST_REAL_E, ASTNodeType_t} or
* @sbmlconstant{AST_REAL, ASTNodeType_t} for the given @p node. If
* ASTNode_getType() returns @sbmlconstant{AST_REAL, ASTNodeType_t} for @p
* node, this method behaves identically to ASTNode_getReal().
*
* @param node the node whose value is to be returned.
*
* @return the value of the mantissa of @p node, or NaN if @p node is @c NULL.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
double
ASTNode_getMantissa (const ASTNode_t *node);
/**
* Get the exponent value of a node.
*
* This function should be called only when ASTNode_getType() returns
* @sbmlconstant{AST_REAL_E, ASTNodeType_t} or @sbmlconstant{AST_REAL,
* ASTNodeType_t} for the given @p node.
*
* @param node the node whose value is to be returned.
*
* @return the value of the exponent field in the given @p node ASTNode_t
* structure, or NaN if @p node is @c NULL.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
long
ASTNode_getExponent (const ASTNode_t *node);
/**
* Returns the numerical value of this ASTNode_t.
*
* @param node the ASTNode_t whose value is to be returned.
*
* @return the numerical value of this ASTNode_t, or @c NaN if this
* is not a type of node that has a numerical value.
*
* @note This function will return a numerical value (as a double) for
* any ASTNode_t that represents a number, a constant such as pi or
* avogadro or @c 1 for nodes of type
* @sbmlconstant{AST_CONSTANT_TRUE, ASTNodeType_t} and @c 0 for nodes of type
* @sbmlconstant{AST_CONSTANT_FALSE, ASTNodeType_t}. It does not evaluate
* the node in any way so, for example, it will not return the value of
* a named ASTNode_t or attempt to evaluate a function.
* This includes a node representing @c time i.e. nodes
* of type @sbmlconstant{AST_NAME_TIME, ASTNodeType_t}.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
double
ASTNode_getValue(const ASTNode_t *node);
/**
* Returns the precedence of a node in the infix math syntax of SBML
* Level 1.
*
* @copydetails doc_summary_of_string_math
*
* @param node the node whose precedence is to be calculated.
*
* @return the precedence of @p node (as defined in the SBML Level 1
* specification).
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_getPrecedence (const ASTNode_t *node);
/**
* Returns the type of the given node.
*
* @param node the node.
*
* @return the type of the given ASTNode_t structure.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
ASTNodeType_t
ASTNode_getType (const ASTNode_t *node);
/**
* Returns the MathML @c id attribute of a given node.
*
* @param node the node whose identifier should be returned.
*
* @returns the identifier of the node, or @c NULL if @p node is a null pointer.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
char *
ASTNode_getId(const ASTNode_t * node);
/**
* Returns the MathML @c class attribute of a given node.
*
* @param node the node whose class should be returned.
*
* @returns the class identifier, or @c NULL if @p node is a null pointer.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
char *
ASTNode_getClass(const ASTNode_t * node);
/**
* Returns the MathML @c style attribute of a given node.
*
* @param node the node.
*
* @return a string representing the @c style value, or a null value if @p node is
* a null pointer.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
char *
ASTNode_getStyle(const ASTNode_t * node);
/**
* Returns the SBML "units" attribute of a given node.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @param node the node whose units are to be returned.
*
* @return the units, as a string, or a null value if @p node is a null pointer.
*
* @note The <code>sbml:units</code> attribute for MathML expressions is only
* defined in SBML Level 3. It may not be used in Levels 1–2 of
* SBML.
*
* @see SBML_parseL3Formula()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
char *
ASTNode_getUnits(const ASTNode_t * node);
/**
* Returns @c 1 (true) if the given node represents the special symbol @c avogadro.
*
* @param node the node to query.
*
* @return @c 1 (true) if this stands for @c avogadro, @c 0 (false) otherwise.
*
* @see SBML_parseL3Formula()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isAvogadro (const ASTNode_t * node);
/**
* Returns @c 1 (true) if this node is some type of Boolean value or operator.
*
* @param node the node in question.
*
* @return @c 1 (true) if @p node is a Boolean (a logical operator, a
* relational operator, or the constants @c true or @c false),
* @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isBoolean (const ASTNode_t * node);
/**
* Returns @c 1 (true) if the given node is something that returns a Boolean value.
*
* This function looks at the whole ASTNode_t structure rather than just the
* top level of @p node. Thus, it will consider return values from MathML
* @c piecewise statements. In addition, if the ASTNode_t structure in @p node
* uses a function call, this function will examine the return value of the
* function. Note that this is only possible in cases the ASTNode_t
* structure can trace its parent Model_t structure; that is, the ASTNode_t
* structure must represent the <code><math></code> element of some
* SBML object that has already been added to an instance of an
* SBMLDocument_t structure.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node returns a boolean, @c 0 (false) otherwise.
*
* @see ASTNode_isBoolean()
* @see ASTNode_returnsBooleanForModel()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_returnsBoolean (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is something that returns a Boolean value.
*
* This function looks at the whole ASTNode_t structure rather than just the
* top level of @p node. Thus, it will consider return values from MathML
* @c piecewise statements. In addition, if the ASTNode_t structure in @p node
* uses a function call, this function will examine the return value of the
* function using the definition of the function found in the given Model_t
* structure given by @p model (rather than the model that might be traced
* from @p node itself). This function is similar to
* ASTNode_returnsBoolean(), but is useful in situations where the ASTNode_t
* structure has not been hooked into a model yet.
*
* @param node the node to query.
* @param model the model to use as the basis for finding the definition
* of the function.
*
* @return @c 1 (true) if @p node returns a boolean, @c 0 (false) otherwise.
*
* @see ASTNode_isBoolean()
* @see ASTNode_returnsBoolean()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_returnsBooleanForModel (const ASTNode_t *node, const Model_t* model);
/**
* Returns @c 1 (true) if the given node represents a MathML constant.
*
* Examples of constants in this context are @c Pi, @c true, etc.
*
* @param node the node.
*
* @return @c 1 (true) if @p node is a MathML constant, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isConstant (const ASTNode_t * node);
/**
* Returns @c 1 (true) if the given node represents a MathML constant.
*
* Examples of constants in this context are @c Pi, @c true, etc.
*
* @param node the node
*
* @return @c 1 (true) if @p node is a MathML constant, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isConstantNumber(const ASTNode_t * node);
/**
* Returns @c 1 (true) if the given node represents a function.
*
* @param node the node.
*
* @return @c 1 (true) if @p node is a function in SBML, whether predefined (in SBML
* Level 1), defined by MathML (SBML Levels 2–3) or
* user-defined.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isFunction (const ASTNode_t * node);
/**
* Returns @c 1 (true) if the given node stands for infinity.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is the special IEEE 754 value for infinity,
* @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isInfinity (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node contains an integer value.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is of type
* @sbmlconstant{AST_INTEGER, ASTNodeType_t}, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isInteger (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is a MathML lambda function.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is of type
* @sbmlconstant{AST_LAMBDA, ASTNodeType_t}, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isLambda (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents the log base-10 function.
*
* More precisely, this function tests if the given @p node's type is
* @sbmlconstant{AST_FUNCTION_LOG, ASTNodeType_t} with two children, the
* first of which is an @sbmlconstant{AST_INTEGER, ASTNodeType_t} equal to
* @c 10.
*
* @return @c 1 (true) if @p node represents a @c log10() function,
* @c 0 (false) otherwise.
*
* @see SBML_parseL3Formula()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isLog10 (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is a logical operator.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a MathML logical operator (@c and, @c or,
* @c not, @c xor), @c 0otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isLogical (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is a named entity.
*
* More precisely, this returns a true value if @p node is a user-defined
* variable name or the special symbols @c time or @c avogadro.
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a named variable, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isName (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents not-a-number.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is the special IEEE 754 value NaN ("not a
* number"), @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isNaN (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents negative infinity.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is the special IEEE 754 value negative infinity,
* @c 0 (false) otherwise.
*
* @see ASTNode_isInfinity()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isNegInfinity (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node contains a number.
*
* This is functionally equivalent to:
* @code{.c}
ASTNode_isInteger(node) || ASTNode_isReal(node).
@endcode
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a number, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isNumber (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is a mathematical operator.
*
* The possible mathematical operators are <code>+</code>, <code>-</code>,
* <code>*</code>, <code>/</code> and <code>^</code> (power).
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is an operator, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isOperator (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents the MathML
* <code><piecewise></code> operator.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is the MathML piecewise function, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isPiecewise (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents a MathML
* qualifier (i.e., @c bvar, @c degree, @c base, @c piece, @c otherwise),
* @c 0 (false) otherwise.
*
* More precisely, this node must be of one of the following types:
* @sbmlconstant{AST_QUALIFIER_BVAR, ASTNodeType_t},
* @sbmlconstant{AST_QUALIFIER_LOGBASE, ASTNodeType_t},
* @sbmlconstant{AST_QUALIFIER_DEGREE, ASTNodeType_t},
* @sbmlconstant{AST_CONSTRUCTOR_PIECE, ASTNodeType_t} or
* @sbmlconstant{AST_CONSTRUCTOR_OTHERWISE, ASTNodeType_t}.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a MathML qualifier, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isQualifier (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents a rational number.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is of type @sbmlconstant{AST_RATIONAL,
* ASTNodeType_t}, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isRational (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents a real number.
*
* More precisely, this node must be of one of the following types:
* @sbmlconstant{AST_REAL, ASTNodeType_t}, @sbmlconstant{AST_REAL_E,
* ASTNodeType_t} or @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
*
* @param node the node to query.
*
* @return @c 1 (true) if the value of @p node can represent a real number,
* @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isReal (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents a MathML relational operator.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a MathML relational operator, meaning
* <code>==</code>, <code>>=</code>, <code><=</code>, <code>></code>,
* <code><</code>, and <code>!=</code>.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isRelational (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents a semantics node.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is of type
* @sbmlconstant{AST_SEMANTICS, ASTNodeType_t}, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSemantics (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is the MathML square-root operator.
*
* More precisely, the node type must be @sbmlconstant{AST_FUNCTION_ROOT,
* ASTNodeType_t} with two children, the first of which is an
* @sbmlconstant{AST_INTEGER, ASTNodeType_t} node having value equal to 2.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node represents a sqrt() function, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSqrt (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node represents a unary minus.
*
* A node is defined as a unary minus node if it is of type
* @sbmlconstant{AST_MINUS, ASTNodeType_t} and has exactly one child.
*
* For numbers, unary minus nodes can be "collapsed" by negating the number.
* In fact, SBML_parseFormula() does this during its parsing process, and
* SBML_parseL3Formula() has a configuration option that allows this behavior
* to be turned on or off. However, unary minus nodes for symbols
* (@sbmlconstant{AST_NAME, ASTNodeType_t}) cannot be "collapsed", so this
* predicate function is still necessary.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a unary minus, @c 0 (false) otherwise.
*
* @see SBML_parseL3Formula()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isUMinus (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is a unary plus.
*
* A node is defined as a unary minus node if it is of type
* @sbmlconstant{AST_PLUS, ASTNodeType_t} and has exactly one child.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is a unary plus, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isUPlus (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node is of a specific type and has a specific
* number of children.
*
* This function is designed for use in cases such as when callers want to
* determine if the node is a unary @c not or unary @c minus, or a @c times
* node with no children, etc.
*
* @param node the node to query.
* @param type the type that the node should have.
* @param numchildren the number of children that the node should have.
*
* @return @c 1 (true) if @p node is has the specified type and number of children,
* @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_hasTypeAndNumChildren(const ASTNode_t *node, ASTNodeType_t type, unsigned int numchildren);
/**
* Returns @c 1 (true) if the type of the node is unknown.
*
* "Unknown" nodes have the type @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}.
* Nodes with unknown types will not appear in an ASTNode_t tree returned by
* libSBML based upon valid SBML input; the only situation in which a node
* with type @sbmlconstant{AST_UNKNOWN, ASTNodeType_t} may appear is
* immediately after having create a new, untyped node using the ASTNode_t
* constructor. Callers creating nodes should endeavor to set the type to a
* valid node type as soon as possible after creating new nodes.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is of type @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isUnknown (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node's MathML @c id attribute is set.
*
* @param node the node to query.
*
* @return @c 1 (true) if it is set, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSetId (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node's MathML @c class attribute is set.
*
* @param node the node to query.
*
* @return @c 1 (true) if the attribute is set, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSetClass (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node's MathML @c style attribute is set.
*
* @param node the node to query.
*
* @return @c 1 (true) if the attribute is set, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSetStyle (const ASTNode_t *node);
/**
* Returns @c 1 (true) if this node's SBML "units" attribute is set.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @param node the node to query.
*
* @return @c 1 (true) if the attribute is set, @c 0 (false) otherwise.
*
* @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.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSetUnits (const ASTNode_t *node);
/**
* Returns @c 1 (true) if the given node or any of its children have the SBML
* "units" attribute set.
*
* @htmlinclude about-sbml-units-attrib.html
*
* @param node the node to query.
*
* @return @c 1 (true) if the attribute is set, @c 0 (false) otherwise.
*
* @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.
*
* @see ASTNode_isSetUnits()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_hasUnits (const ASTNode_t *node);
/**
* Sets the value of a given node to a character.
*
* If character is one of @c +, @c -, <code>*</code>, <code>/</code> or @c ^,
* the node type will be set accordingly. For all other characters, the node
* type will be set to @sbmlconstant{AST_UNKNOWN, ASTNodeType_t}.
*
* @param node the node to set.
* @param value the character value for the node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setCharacter (ASTNode_t *node, char value);
/**
* Sets the node to represent a named entity.
*
* As a side-effect, this ASTNode_t object's type will be reset to
* @sbmlconstant{AST_NAME, ASTNodeType_t} if (and <em>only if</em>) the @p
* node was previously an operator (i.e., ASTNode_isOperator() returns true),
* number (i.e., ASTNode_isNumber() returns true), or unknown. This allows
* names to be set for @sbmlconstant{AST_FUNCTION, ASTNodeType_t} nodes and
* the like.
*
* @param node the node to set.
* @param name the name value for the node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setName (ASTNode_t *node, const char *name);
/**
* Sets the given node to a integer and sets it type
* to @sbmlconstant{AST_INTEGER, ASTNodeType_t}.
*
* @param node the node to set.
* @param value the value to set it to.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setInteger (ASTNode_t *node, long value);
/**
* Sets the value of a given node to a rational number and sets its type to
* @sbmlconstant{AST_RATIONAL, ASTNodeType_t}.
*
* @param node the node to set.
* @param numerator the numerator value to use.
* @param denominator the denominator value to use.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setRational (ASTNode_t *node, long numerator, long denominator);
/**
* Sets the value of a given node to a real (@c double) and sets its type to
* @sbmlconstant{AST_REAL, ASTNodeType_t}.
*
* This is functionally equivalent to:
* @verbatim
ASTNode_setRealWithExponent(node, value, 0);
@endverbatim
*
* @param node the node to set.
* @param value the value to set the node to.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setReal (ASTNode_t *node, double value);
/**
* Sets the value of a given node to a real (@c double) in two parts, a
* mantissa and an exponent.
*
* As a side-effect, the @p node's type will be set to
* @sbmlconstant{AST_REAL, ASTNodeType_t}.
*
* @param node the node to set.
* @param mantissa the mantissa of this node's real-numbered value.
* @param exponent the exponent of this node's real-numbered value.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setRealWithExponent (ASTNode_t *node, double mantissa, long exponent);
/**
* Explicitly sets the type of the given ASTNode_t structure.
*
* @param node the node to set.
* @param type the new type.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @note A side-effect of doing this is that any numerical values previously
* stored in this node are reset to zero.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setType (ASTNode_t *node, ASTNodeType_t type);
/**
* Sets the MathML @c id attribute of the given node.
*
* @param node the node to set.
* @param id the identifier to use.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setId (ASTNode_t *node, const char *id);
/**
* Sets the MathML @c class of the given node.
*
* @param node the node to set.
* @param className the new value for the @c class attribute.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setClass (ASTNode_t *node, const char *className);
/**
* Sets the MathML @c style of the given node.
*
* @param node the node to set.
* @param style the new value for the @c style attribute.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setStyle (ASTNode_t *node, const char *style);
/**
* Sets the units of the given node.
*
* The units will be set @em only if the ASTNode_t structure in @p node
* represents a MathML <code><cn></code> element, i.e., represents a
* number. Callers may use ASTNode_isNumber() to inquire whether the node is
* of that type.
*
*
* @htmlinclude about-sbml-units-attrib.html
*
* @param node the node to modify.
* @param units the units to set it to.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @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.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setUnits (ASTNode_t *node, const char *units);
/**
* Swaps the children of two nodes.
*
* @param node the node to modify.
*
* @param that the other node whose children should be used to replace those
* of @p node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_swapChildren (ASTNode_t *node, ASTNode_t *that);
/**
* Unsets the MathML @c id attribute of the given node.
*
* @param node the node to modify.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_unsetId (ASTNode_t *node);
/**
* Unsets the MathML @c class attribute of the given node.
*
* @param node the node to modify.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_unsetClass (ASTNode_t *node);
/**
* Unsets the MathML @c style attribute of the given node.
*
* @param node the node to modify.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_unsetStyle (ASTNode_t *node);
/**
* Unsets the units associated with the given node.
*
* @param node the node to modify.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_unsetUnits (ASTNode_t *node);
/**
* Replaces occurrences of a given name with a new ASTNode_t structure.
*
* For example, if the formula in @p node is <code>x + y</code>, then the
* <code><bvar></code> is @c x and @c arg is an ASTNode_t structure
* representing the real value @c 3. This function substitutes @c 3 for @c x
* within the @p node ASTNode_t structure.
*
* @param node the node to modify.
* @param bvar the MathML <code><bvar></code> to use.
* @param arg the replacement node or structure.
*
* @memberof ASTNode_t
*
* @see ASTNode_replaceAndDeleteArgument()
*/
LIBSBML_EXTERN
void
ASTNode_replaceArgument(ASTNode_t* node, const char * bvar, ASTNode_t* arg);
/**
* Reduces the given node to a binary true.
*
* Example: if @p node 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 ASTNode_t structure.
*
* @param node the node to modify.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
void
ASTNode_reduceToBinary(ASTNode_t* node);
/**
* Returns the parent SBase_t structure containing the given node.
*
* @param node the node to query.
*
* @return a pointer to the structure containing the given node.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
SBase_t *
ASTNode_getParentSBMLObject(ASTNode_t* node);
/**
* Returns @c 1 (true) if the given node's parent SBML object is set.
*
* @param node the node to query.
*
* @return @c 1 (true) if the parent SBML object is set, @c 0 (false) otherwise.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSetParentSBMLObject(ASTNode_t* node);
/**
* Sets the parent SBase_t structure.
*
* @param node the node to modify.
* @param sb the parent SBase_t structure of this ASTNode_t.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setParentSBMLObject(ASTNode_t* node, SBase_t * sb);
/**
* Unsets the parent SBase_t structure.
*
* @param node the node to modify.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_unsetParentSBMLObject(ASTNode_t* node);
/**
* Adds a given XML node structure as a MathML <code><semantics></code> element
* of a given ASTNode_t structure.
*
* @copydetails doc_about_mathml_semantic_annotations
*
* @param node the node to modify.
* @param disownedAnnotation the annotation to add.
* Will become a child of the parent node.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @copydetails doc_note_mathml_semantic_annotations_uncommon
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_addSemanticsAnnotation(ASTNode_t* node, XMLNode_t * disownedAnnotation);
/**
* Returns the number of MathML semantic annotations inside the given node.
*
* @htmlinclude about-semantic-annotations.html
*
* @param node the node to query.
*
* @return a count of the semantic annotations.
*
* @see ASTNode_addSemanticsAnnotation()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
unsigned int
ASTNode_getNumSemanticsAnnotations(ASTNode_t* node);
/**
* Returns the nth MathML semantic annotation attached to the given node.
*
* @copydetails doc_about_mathml_semantic_annotations
*
* @param node the node to query.
* @param n the index of the semantic annotation to fetch.
*
* @return the nth semantic annotation on @p node , or a null pointer if the
* node has no nth annotation (which would mean that <code>n >
* ASTNode_getNumSemanticsAnnotations(node) - 1</code>).
*
* @copydetails doc_note_mathml_semantic_annotations_uncommon
*
* @see ASTNode_addSemanticsAnnotation()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
XMLNode_t *
ASTNode_getSemanticsAnnotation(ASTNode_t* node, unsigned int n);
/**
* Sets the user data of the given node.
*
* 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.
*
* @param node the node to modify.
* @param userData the new user data.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @see ASTNode_getUserData()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setUserData(ASTNode_t* node, void *userData);
/**
* Returns the user data associated with this node.
*
* @param node the node to query.
*
* @return the user data of this node, or a null pointer if no user data has
* been set.
*
* @see ASTNode_setUserData()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
void *
ASTNode_getUserData(const ASTNode_t* node);
/**
* Unsets the user data of the given node.
*
* 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.
*
* @param node the node to modify.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_FAILED, OperationReturnValues_t}
*
* @see ASTNode_getUserData()
* @see ASTNode_setUserData()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_unsetUserData(ASTNode_t* node);
/**
* Returns @c 1 (true) if the given node's user data object is set.
*
* @param node the node to query.
*
* @return @c 1 (true) if the user data object is set, @c 0 (false) otherwise.
*
* @see ASTNode_setUserData()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isSetUserData(const ASTNode_t* node);
/**
* Returns @c 1 (true) if the given node has the correct number of children for its
* type.
*
* For example, an ASTNode_t structure with type @sbmlconstant{AST_MINUS,
* ASTNodeType_t} expects 1 or 2 child nodes.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node has the appropriate number of children for its
* type, @c 0 (false) otherwise.
*
* @note This function performs a check on the top-level node only. Child
* nodes are not checked.
*
* @see ASTNode_isWellFormedASTNode()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_hasCorrectNumberArguments(ASTNode_t* node);
/**
* Returns @c 1 (true) if the given node is well-formed.
*
* @param node the node to query.
*
* @return @c 1 (true) if @p node is well-formed, @c 0 (false) otherwise.
*
* @note An ASTNode_t 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.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isWellFormedASTNode(ASTNode_t* node);
/**
* Returns the MathML @c definitionURL attribute value of the given node.
*
* @param node the node to query.
*
* @return the value of the @c definitionURL attribute in the form of a
* libSBML XMLAttributes_t structure, or a null pointer if @p node does not
* have a value for the attribute.
*
* @see ASTNode_getDefinitionURLString()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
XMLAttributes_t *
ASTNode_getDefinitionURL(ASTNode_t* node);
/**
* Returns the MathML @c definitionURL attribute value of the given node as a
* string.
*
* @param node the node to query.
*
* @return the value of the @c definitionURL attribute in the form of a
* string, or a null pointer if @p node does not have a value for the
* attribute.
*
* @see ASTNode_getDefinitionURL()
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
char *
ASTNode_getDefinitionURLString(ASTNode_t* node);
/**
* Sets the MathML @c definitionURL attribute of the given node.
*
* @param node the node to modify.
* @param defnURL the value to which the attribute should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setDefinitionURL(ASTNode_t* node, XMLAttributes_t * defnURL);
/**
* Sets the MathML @c definitionURL attribute of the given node.
*
* @param node the node to modify.
* @param defnURL a string to which the attribute should be set.
*
* @copydetails doc_returns_success_code
* @li @sbmlconstant{LIBSBML_INVALID_OBJECT, OperationReturnValues_t}
* @li @sbmlconstant{LIBSBML_OPERATION_SUCCESS, OperationReturnValues_t}
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_setDefinitionURLString(ASTNode_t* node, const char * defnURL);
/** @cond doxygenLibsbmlInternal */
/**
*
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_true(const ASTNode_t *node);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Used internally for L3FormulaFormatter to know whether to write a package
* function as 'functioname(arguments)' or not.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_isPackageInfixFunction(const ASTNode_t *node);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Used internally for L3FormulaFormatter to know whether writing a package
* function has special package-specific syntax.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_hasPackageOnlyInfixSyntax(const ASTNode_t *node);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Used internally for L3FormulaFormatter to know what the precedence is for
* a package function.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_getL3PackageInfixPrecedence(const ASTNode_t *node);
/** @endcond */
/** @cond doxygenLibsbmlInternal */
/**
* Used internally for L3FormulaFormatter to know whether writing a package
* function has special package-specific syntax.
*
* @memberof ASTNode_t
*/
LIBSBML_EXTERN
int
ASTNode_hasUnambiguousPackageInfixGrammar(const ASTNode_t *node, const ASTNode_t *child);
/** @endcond */
END_C_DECLS
LIBSBML_CPP_NAMESPACE_END
#endif /* !SWIG */
#endif /* ASTNode_h */
|