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
|
/* PPL Java interface: domain-independent functions.
Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
Copyright (C) 2010-2016 BUGSENG srl (http://bugseng.com)
This file is part of the Parma Polyhedra Library (PPL).
The PPL is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The PPL is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
For the most up-to-date information see the Parma Polyhedra Library
site: http://bugseng.com/products/ppl/ . */
#include "ppl_java_common_defs.hh"
#include "parma_polyhedra_library_Artificial_Parameter.h"
#include "parma_polyhedra_library_Artificial_Parameter_Sequence.h"
#include "parma_polyhedra_library_Bounded_Integer_Type_Overflow.h"
#include "parma_polyhedra_library_Bounded_Integer_Type_Representation.h"
#include "parma_polyhedra_library_Bounded_Integer_Type_Width.h"
#include "parma_polyhedra_library_By_Reference.h"
#include "parma_polyhedra_library_Coefficient.h"
#include "parma_polyhedra_library_Complexity_Class.h"
#include "parma_polyhedra_library_Congruence.h"
#include "parma_polyhedra_library_Congruence_System.h"
#include "parma_polyhedra_library_Constraint.h"
#include "parma_polyhedra_library_Constraint_System.h"
#include "parma_polyhedra_library_Degenerate_Element.h"
#include "parma_polyhedra_library_Generator.h"
#include "parma_polyhedra_library_Generator_System.h"
#include "parma_polyhedra_library_Generator_Type.h"
#include "parma_polyhedra_library_Grid_Generator.h"
#include "parma_polyhedra_library_Grid_Generator_System.h"
#include "parma_polyhedra_library_Grid_Generator_Type.h"
#include "parma_polyhedra_library_IO.h"
#include "parma_polyhedra_library_Linear_Expression.h"
#include "parma_polyhedra_library_Linear_Expression_Coefficient.h"
#include "parma_polyhedra_library_Linear_Expression_Difference.h"
#include "parma_polyhedra_library_Linear_Expression_Sum.h"
#include "parma_polyhedra_library_Linear_Expression_Times.h"
#include "parma_polyhedra_library_Linear_Expression_Unary_Minus.h"
#include "parma_polyhedra_library_Linear_Expression_Variable.h"
#include "parma_polyhedra_library_MIP_Problem.h"
#include "parma_polyhedra_library_MIP_Problem_Status.h"
#include "parma_polyhedra_library_Optimization_Mode.h"
#include "parma_polyhedra_library_Pair.h"
#include "parma_polyhedra_library_Parma_Polyhedra_Library.h"
#include "parma_polyhedra_library_Partial_Function.h"
#include "parma_polyhedra_library_PIP_Problem.h"
#include "parma_polyhedra_library_PIP_Problem_Status.h"
#include "parma_polyhedra_library_PIP_Decision_Node.h"
#include "parma_polyhedra_library_PIP_Solution_Node.h"
#include "parma_polyhedra_library_PIP_Tree_Node.h"
#include "parma_polyhedra_library_Poly_Con_Relation.h"
#include "parma_polyhedra_library_Poly_Gen_Relation.h"
#include "parma_polyhedra_library_PPL_Object.h"
#include "parma_polyhedra_library_Relation_Symbol.h"
#include "parma_polyhedra_library_Variable.h"
#include "parma_polyhedra_library_Variables_Set.h"
using namespace Parma_Polyhedra_Library;
using namespace Parma_Polyhedra_Library::Interfaces::Java;
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_initialize_1library
(JNIEnv* env, jclass /* ppl_class */) {
initialize();
cached_classes.init_cache(env);
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_finalize_1library
(JNIEnv* env, jclass /* ppl_class */) {
cached_classes.clear_cache(env);
finalize();
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_By_1Reference_initIDs
(JNIEnv* env, jclass j_by_ref_class) {
jfieldID fID;
fID = env->GetFieldID(j_by_ref_class, "obj", "Ljava/lang/Object;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.By_Reference_obj_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_by_ref_class, "<init>", "(Ljava/lang/Object;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.By_Reference_init_ID = mID;
}
JNIEXPORT jint JNICALL
Java_parma_1polyhedra_1library_Coefficient_bits(JNIEnv*, jclass) {
return PPL_COEFFICIENT_BITS;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Coefficient_initIDs
(JNIEnv* env, jclass j_coeff_class) {
jfieldID fID;
fID = env->GetFieldID(j_coeff_class, "value", "Ljava/math/BigInteger;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Coefficient_value_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_coeff_class, "<init>", "(Ljava/lang/String;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Coefficient_init_from_String_ID = mID;
mID = env->GetMethodID(j_coeff_class, "toString", "()Ljava/lang/String;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Coefficient_toString_ID = mID;
// Boolean.
mID = env->GetStaticMethodID(cached_classes.Boolean, "valueOf",
"(Z)Ljava/lang/Boolean;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Boolean_valueOf_ID = mID;
// Integer.
mID = env->GetStaticMethodID(cached_classes.Integer, "valueOf",
"(I)Ljava/lang/Integer;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Integer_valueOf_ID = mID;
mID = env->GetMethodID(cached_classes.Integer, "intValue", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Integer_intValue_ID = mID;
// Long.
mID = env->GetStaticMethodID(cached_classes.Long, "valueOf",
"(J)Ljava/lang/Long;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Long_valueOf_ID = mID;
mID = env->GetMethodID(cached_classes.Long, "longValue", "()J");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Long_longValue_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Complexity_1Class_initIDs
(JNIEnv* env, jclass j_complexity_class) {
jmethodID mID = env->GetMethodID(j_complexity_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Complexity_Class_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Congruence_initIDs
(JNIEnv* env, jclass j_congruence_class) {
jfieldID fID;
fID = env->GetFieldID(j_congruence_class, "mod",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Congruence_mod_ID = fID;
fID = env->GetFieldID(j_congruence_class, "lhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Congruence_lhs_ID = fID;
fID = env->GetFieldID(j_congruence_class, "rhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Congruence_rhs_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_congruence_class, "<init>",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Coefficient;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Congruence_init_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Congruence_1System_initIDs
(JNIEnv* env, jclass j_con_sys_class) {
jmethodID mID;
mID = env->GetMethodID(j_con_sys_class, "<init>", "()V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Congruence_System_init_ID = mID;
mID = env->GetMethodID(j_con_sys_class, "add", "(Ljava/lang/Object;)Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Congruence_System_add_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Constraint_initIDs
(JNIEnv* env, jclass j_constraint_class) {
jfieldID fID;
fID = env->GetFieldID(j_constraint_class, "lhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Constraint_lhs_ID = fID;
fID = env->GetFieldID(j_constraint_class, "rhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Constraint_rhs_ID = fID;
fID = env->GetFieldID(j_constraint_class, "kind",
"Lparma_polyhedra_library/Relation_Symbol;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Constraint_kind_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_constraint_class, "<init>",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Relation_Symbol;"
"Lparma_polyhedra_library/Linear_Expression;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Constraint_init_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Constraint_1System_initIDs
(JNIEnv* env, jclass j_con_sys_class) {
jmethodID mID;
mID = env->GetMethodID(j_con_sys_class, "<init>", "()V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Constraint_System_init_ID = mID;
mID = env->GetMethodID(j_con_sys_class, "add", "(Ljava/lang/Object;)Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Constraint_System_add_ID = mID;
// NOTE: initialize the iterator method IDs common to all *_System classes.
mID = env->GetMethodID(j_con_sys_class, "iterator",
"()Ljava/util/Iterator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.System_iterator_ID = mID;
mID = env->GetMethodID(cached_classes.Iterator, "hasNext", "()Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.System_Iterator_has_next_ID = mID;
assert(cached_classes.Iterator != NULL);
mID = env->GetMethodID(cached_classes.Iterator, "next",
"()Ljava/lang/Object;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.System_Iterator_next_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Degenerate_1Element_initIDs
(JNIEnv* env, jclass j_degenerate_class) {
jmethodID mID = env->GetMethodID(j_degenerate_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Degenerate_Element_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Generator_initIDs
(JNIEnv* env, jclass j_generator_class) {
jfieldID fID;
fID = env->GetFieldID(j_generator_class, "gt",
"Lparma_polyhedra_library/Generator_Type;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Generator_gt_ID = fID;
fID = env->GetFieldID(j_generator_class, "le",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Generator_le_ID = fID;
fID = env->GetFieldID(j_generator_class, "div",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Generator_div_ID = fID;
jmethodID mID;
mID = env->GetStaticMethodID(j_generator_class, "line",
"(Lparma_polyhedra_library/Linear_Expression;)"
"Lparma_polyhedra_library/Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_line_ID = mID;
mID = env->GetStaticMethodID(j_generator_class, "ray",
"(Lparma_polyhedra_library/Linear_Expression;)"
"Lparma_polyhedra_library/Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_ray_ID = mID;
mID = env->GetStaticMethodID(j_generator_class, "point",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Coefficient;)"
"Lparma_polyhedra_library/Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_point_ID = mID;
mID = env->GetStaticMethodID(j_generator_class, "closure_point",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Coefficient;)"
"Lparma_polyhedra_library/Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_closure_point_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Generator_1System_initIDs
(JNIEnv* env, jclass j_gen_sys_class) {
jmethodID mID;
mID = env->GetMethodID(j_gen_sys_class, "<init>", "()V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_System_init_ID = mID;
mID = env->GetMethodID(j_gen_sys_class, "add", "(Ljava/lang/Object;)Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_System_add_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Generator_1Type_initIDs
(JNIEnv* env, jclass j_gen_type_class) {
jmethodID mID;
mID = env->GetMethodID(j_gen_type_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Generator_Type_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_initIDs
(JNIEnv* env, jclass j_grid_generator_class) {
jfieldID fID;
fID = env->GetFieldID(j_grid_generator_class, "gt",
"Lparma_polyhedra_library/Grid_Generator_Type;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Grid_Generator_gt_ID = fID;
fID = env->GetFieldID(j_grid_generator_class, "le",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Grid_Generator_le_ID = fID;
fID = env->GetFieldID(j_grid_generator_class, "div",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Grid_Generator_div_ID = fID;
jmethodID mID;
mID = env->GetStaticMethodID(j_grid_generator_class, "grid_line",
"(Lparma_polyhedra_library/Linear_Expression;)"
"Lparma_polyhedra_library/Grid_Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Grid_Generator_grid_line_ID = mID;
mID = env->GetStaticMethodID(j_grid_generator_class, "parameter",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Coefficient;)"
"Lparma_polyhedra_library/Grid_Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Grid_Generator_parameter_ID = mID;
mID = env->GetStaticMethodID(j_grid_generator_class, "grid_point",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Coefficient;)"
"Lparma_polyhedra_library/Grid_Generator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Grid_Generator_grid_point_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_1System_initIDs
(JNIEnv* env, jclass j_gen_sys_class) {
jmethodID mID;
mID = env->GetMethodID(j_gen_sys_class, "<init>", "()V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Grid_Generator_System_init_ID = mID;
mID = env->GetMethodID(j_gen_sys_class, "add", "(Ljava/lang/Object;)Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Grid_Generator_System_add_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_1Type_initIDs
(JNIEnv* env, jclass j_grid_gen_type_class) {
jmethodID mID;
mID = env->GetMethodID(j_grid_gen_type_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Grid_Generator_Type_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_initIDs
(JNIEnv* env, jclass j_le_class) {
jmethodID mID;
mID = env->GetMethodID(j_le_class, "sum",
"(Lparma_polyhedra_library/Linear_Expression;)"
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Linear_Expression_sum_ID = mID;
mID = env->GetMethodID(j_le_class, "times",
"(Lparma_polyhedra_library/Coefficient;)"
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Linear_Expression_times_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_1Coefficient_initIDs
(JNIEnv* env, jclass j_le_coeff_class) {
jfieldID fID;
fID = env->GetFieldID(j_le_coeff_class, "coeff",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Coefficient_coeff_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_le_coeff_class, "<init>",
"(Lparma_polyhedra_library/Coefficient;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Linear_Expression_Coefficient_init_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_1Difference_initIDs
(JNIEnv* env, jclass j_le_diff_class) {
jfieldID fID;
fID = env->GetFieldID(j_le_diff_class, "lhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Difference_lhs_ID = fID;
fID = env->GetFieldID(j_le_diff_class, "rhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Difference_rhs_ID = fID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_1Sum_initIDs
(JNIEnv* env, jclass j_le_sum_class) {
jfieldID fID;
fID = env->GetFieldID(j_le_sum_class, "lhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Sum_lhs_ID = fID;
fID = env->GetFieldID(j_le_sum_class, "rhs",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Sum_rhs_ID = fID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_1Times_initIDs
(JNIEnv* env, jclass j_le_times_class) {
jfieldID fID;
fID = env->GetFieldID(j_le_times_class, "coeff",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Times_coeff_ID = fID;
fID = env->GetFieldID(j_le_times_class, "lin_expr",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Times_lin_expr_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_le_times_class, "<init>",
"(Lparma_polyhedra_library/Coefficient;"
"Lparma_polyhedra_library/Variable;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Linear_Expression_Times_init_from_coeff_var_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_1Unary_1Minus_initIDs
(JNIEnv* env, jclass j_le_uminus_class) {
jfieldID fID;
fID = env->GetFieldID(j_le_uminus_class, "arg",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Linear_Expression_Unary_Minus_arg_ID = fID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_1Variable_initIDs
(JNIEnv* env, jclass j_le_var_class) {
jmethodID mID;
mID = env->GetMethodID(j_le_var_class, "<init>",
"(Lparma_polyhedra_library/Variable;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Linear_Expression_Variable_init_ID = mID;
mID = env->GetMethodID(j_le_var_class, "var_id", "()J");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Linear_Expression_Variable_var_id_ID = mID;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_is_1zero
(JNIEnv* env, jobject j_this) {
try {
return build_cxx_linear_expression(env, j_this).is_zero();
}
CATCH_ALL
return false;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_all_1homogeneous_1terms_1are_1zero
(JNIEnv* env, jobject j_this) {
try {
return build_cxx_linear_expression(env, j_this).all_homogeneous_terms_are_zero();
}
CATCH_ALL
return false;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_1Status_initIDs
(JNIEnv* env, jclass j_mip_status_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_mip_status_class, "UNFEASIBLE_MIP_PROBLEM",
"Lparma_polyhedra_library/MIP_Problem_Status;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.MIP_Problem_Status_UNFEASIBLE_MIP_PROBLEM_ID = fID;
fID = env->GetStaticFieldID(j_mip_status_class, "UNBOUNDED_MIP_PROBLEM",
"Lparma_polyhedra_library/MIP_Problem_Status;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.MIP_Problem_Status_UNBOUNDED_MIP_PROBLEM_ID = fID;
fID = env->GetStaticFieldID(j_mip_status_class, "OPTIMIZED_MIP_PROBLEM",
"Lparma_polyhedra_library/MIP_Problem_Status;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.MIP_Problem_Status_OPTIMIZED_MIP_PROBLEM_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_mip_status_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.MIP_Problem_Status_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_1Status_initIDs
(JNIEnv* env, jclass j_mip_status_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_mip_status_class, "UNFEASIBLE_PIP_PROBLEM",
"Lparma_polyhedra_library/PIP_Problem_Status;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.PIP_Problem_Status_UNFEASIBLE_PIP_PROBLEM_ID = fID;
fID = env->GetStaticFieldID(j_mip_status_class, "OPTIMIZED_PIP_PROBLEM",
"Lparma_polyhedra_library/PIP_Problem_Status;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.PIP_Problem_Status_OPTIMIZED_PIP_PROBLEM_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_mip_status_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.PIP_Problem_Status_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Optimization_1Mode_initIDs
(JNIEnv* env, jclass j_opt_mode_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_opt_mode_class, "MAXIMIZATION",
"Lparma_polyhedra_library/Optimization_Mode;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Optimization_Mode_MAXIMIZATION_ID = fID;
fID = env->GetStaticFieldID(j_opt_mode_class, "MINIMIZATION",
"Lparma_polyhedra_library/Optimization_Mode;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Optimization_Mode_MINIMIZATION_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_opt_mode_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Optimization_Mode_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Pair_initIDs
(JNIEnv* env, jclass j_pair_class) {
jfieldID fID;
fID = env->GetFieldID(j_pair_class, "first", "Ljava/lang/Object;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Pair_first_ID = fID;
fID = env->GetFieldID(j_pair_class, "second", "Ljava/lang/Object;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Pair_second_ID = fID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Poly_1Con_1Relation_initIDs
(JNIEnv* env, jclass j_poly_con_relation_class) {
jmethodID mID;
mID = env->GetMethodID(j_poly_con_relation_class, "<init>", "(I)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Poly_Con_Relation_init_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Poly_1Gen_1Relation_initIDs
(JNIEnv* env, jclass j_poly_gen_relation_class) {
jmethodID mID;
mID = env->GetMethodID(j_poly_gen_relation_class, "<init>", "(I)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Poly_Gen_Relation_init_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PPL_1Object_initIDs
(JNIEnv* env, jclass j_ppl_object_class) {
jfieldID fID = env->GetFieldID(j_ppl_object_class, "ptr", "J");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.PPL_Object_ptr_ID = fID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Relation_1Symbol_initIDs
(JNIEnv* env, jclass j_rel_sym_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_rel_sym_class, "EQUAL",
"Lparma_polyhedra_library/Relation_Symbol;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Relation_Symbol_EQUAL_ID = fID;
fID = env->GetStaticFieldID(j_rel_sym_class, "GREATER_THAN",
"Lparma_polyhedra_library/Relation_Symbol;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Relation_Symbol_GREATER_THAN_ID = fID;
fID = env->GetStaticFieldID(j_rel_sym_class, "GREATER_OR_EQUAL",
"Lparma_polyhedra_library/Relation_Symbol;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Relation_Symbol_GREATER_OR_EQUAL_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_rel_sym_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Relation_Symbol_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Bounded_1Integer_1Type_1Overflow_initIDs
(JNIEnv* env, jclass j_bounded_overflow_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_bounded_overflow_class, "OVERFLOW_WRAPS",
"Lparma_polyhedra_library/Bounded_Integer_Type_Overflow;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Overflow_OVERFLOW_WRAPS_ID = fID;
fID = env->GetStaticFieldID(j_bounded_overflow_class, "OVERFLOW_UNDEFINED",
"Lparma_polyhedra_library/Bounded_Integer_Type_Overflow;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Overflow_OVERFLOW_UNDEFINED_ID = fID;
fID = env->GetStaticFieldID(j_bounded_overflow_class, "OVERFLOW_IMPOSSIBLE",
"Lparma_polyhedra_library/Bounded_Integer_Type_Overflow;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Overflow_OVERFLOW_IMPOSSIBLE_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_bounded_overflow_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Bounded_Integer_Type_Overflow_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Bounded_1Integer_1Type_1Representation_initIDs
(JNIEnv* env, jclass j_bounded_rep_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_bounded_rep_class, "UNSIGNED",
"Lparma_polyhedra_library/Bounded_Integer_Type_Representation;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Representation_UNSIGNED_ID = fID;
fID = env->GetStaticFieldID(j_bounded_rep_class, "SIGNED_2_COMPLEMENT",
"Lparma_polyhedra_library/Bounded_Integer_Type_Representation;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Representation_SIGNED_2_COMPLEMENT_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_bounded_rep_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Bounded_Integer_Type_Representation_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Bounded_1Integer_1Type_1Width_initIDs
(JNIEnv* env, jclass j_bounded_width_class) {
jfieldID fID;
fID = env->GetStaticFieldID(j_bounded_width_class, "BITS_8",
"Lparma_polyhedra_library/Bounded_Integer_Type_Width;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Width_BITS_8_ID = fID;
fID = env->GetStaticFieldID(j_bounded_width_class, "BITS_16",
"Lparma_polyhedra_library/Bounded_Integer_Type_Width;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Width_BITS_16_ID = fID;
fID = env->GetStaticFieldID(j_bounded_width_class, "BITS_32",
"Lparma_polyhedra_library/Bounded_Integer_Type_Width;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Width_BITS_32_ID = fID;
fID = env->GetStaticFieldID(j_bounded_width_class, "BITS_64",
"Lparma_polyhedra_library/Bounded_Integer_Type_Width;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Width_BITS_64_ID = fID;
fID = env->GetStaticFieldID(j_bounded_width_class, "BITS_128",
"Lparma_polyhedra_library/Bounded_Integer_Type_Width;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Bounded_Integer_Type_Width_BITS_128_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_bounded_width_class, "ordinal", "()I");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Bounded_Integer_Type_Width_ordinal_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Variable_initIDs
(JNIEnv* env, jclass j_variable_class) {
jfieldID fID = env->GetFieldID(j_variable_class, "varid", "J");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Variable_varid_ID = fID;
fID = env->GetStaticFieldID(j_variable_class, "stringifier",
"Lparma_polyhedra_library/Variable_Stringifier;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Variable_stringifier_ID = fID;
jmethodID mID = env->GetMethodID(j_variable_class, "<init>", "(J)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variable_init_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Variables_1Set_initIDs
(JNIEnv* env, jclass j_vset_class) {
jmethodID mID;
mID = env->GetMethodID(j_vset_class, "<init>", "()V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variables_Set_init_ID = mID;
mID = env->GetMethodID(j_vset_class, "add", "(Ljava/lang/Object;)Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variables_Set_add_ID = mID;
mID = env->GetMethodID(j_vset_class, "iterator", "()Ljava/util/Iterator;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variables_Set_iterator_ID = mID;
// Iterator on Variables_Set.
jclass j_vset_iter_class = env->FindClass("java/util/Iterator");
CHECK_RESULT_ASSERT(env, j_vset_iter_class);
mID = env->GetMethodID(j_vset_iter_class, "hasNext", "()Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variables_Set_Iterator_has_next_ID = mID;
mID = env->GetMethodID(j_vset_iter_class, "next", "()Ljava/lang/Object;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variables_Set_Iterator_next_ID = mID;
}
JNIEXPORT jint JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_version_1major
(JNIEnv *, jclass) {
return version_major();
}
JNIEXPORT jint JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_version_1minor
(JNIEnv *, jclass) {
return version_minor();
}
JNIEXPORT jint JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_version_1revision
(JNIEnv *, jclass) {
return version_revision();
}
JNIEXPORT jint JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_version_1beta
(JNIEnv *, jclass) {
return version_beta();
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_version
(JNIEnv* env, jclass) {
#if defined(__sun) || defined(__sun__)
// Some versions of Solaris declare a version() function that causes
// the following function call to be ambiguous.
return env->NewStringUTF(Parma_Polyhedra_Library::version());
#else // !(defined(__sun) || defined(__sun__))
return env->NewStringUTF(version());
#endif // !(defined(__sun) || defined(__sun__))
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_banner
(JNIEnv* env, jclass) {
return env->NewStringUTF(banner());
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_set_1rounding_1for_1PPL
(JNIEnv* env, jclass) {
try {
set_rounding_for_PPL();
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_restore_1pre_1PPL_1rounding
(JNIEnv* env, jclass) {
try {
restore_pre_PPL_rounding();
}
CATCH_ALL;
}
JNIEXPORT jint JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_irrational_1precision
(JNIEnv* env , jclass) {
try {
return irrational_precision();
}
CATCH_ALL;
return 0;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_set_1irrational_1precision
(JNIEnv* env , jclass, jint p) {
try {
unsigned cxx_p = jtype_to_unsigned<unsigned>(p);
set_irrational_precision(cxx_p);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_set_1timeout
(JNIEnv* env, jclass, jint csecs) {
try {
// In case a timeout was already set.
reset_timeout();
assert(csecs > 0);
unsigned cxx_csecs = jtype_to_unsigned<unsigned>(csecs);
assert(cxx_csecs > 0);
static timeout_exception e;
using Parma_Polyhedra_Library::Watchdog;
p_timeout_object
= new Watchdog(cxx_csecs, abandon_expensive_computations, e);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_reset_1timeout
(JNIEnv* env, jclass) {
try {
reset_timeout();
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_set_1deterministic_1timeout
(JNIEnv* env, jclass, jint unscaled_weight, jint scale) {
try {
// In case a timeout was already set.
reset_deterministic_timeout();
// Note: let `unscaled_weight == 0' result in an exception.
assert(unscaled_weight >= 0 && scale >= 0);
unsigned long cxx_unscaled_weight
= jtype_to_unsigned<unsigned long>(unscaled_weight);
unsigned cxx_scale = jtype_to_unsigned<unsigned>(scale);
static deterministic_timeout_exception e;
typedef Parma_Polyhedra_Library::Weightwatch_Traits Traits;
p_deterministic_timeout_object
= new Weightwatch(Traits::compute_delta(cxx_unscaled_weight, cxx_scale),
abandon_expensive_computations, e);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Parma_1Polyhedra_1Library_reset_1deterministic_1timeout
(JNIEnv* env, jclass) {
try {
reset_deterministic_timeout();
}
CATCH_ALL;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_max_1space_1dimension
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return mip->max_space_dimension();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_space_1dimension
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return mip->space_dimension();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_integer_1space_1dimensions
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return build_java_variables_set(env, mip->integer_space_dimensions());
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_objective_1function
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
PPL_DIRTY_TEMP_COEFFICIENT(inhomogeneous_term);
inhomogeneous_term = mip->objective_function().inhomogeneous_term();
jobject j_coeff_inhomogeneous_term
= build_java_coeff(env, inhomogeneous_term);
jobject j_le_coeff
= env->NewObject(cached_classes.Linear_Expression_Coefficient,
cached_FMIDs.Linear_Expression_Coefficient_init_ID,
j_coeff_inhomogeneous_term);
CHECK_RESULT_RETURN(env, j_le_coeff, 0);
jobject j_le = build_linear_expression(env, mip->objective_function());
return env->CallObjectMethod(j_le,
cached_FMIDs.Linear_Expression_sum_ID,
j_le_coeff);
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_optimization_1mode
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return build_java_optimization_mode(env, mip->optimization_mode());
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_get_1control_1parameter
(JNIEnv* env , jobject j_this_mip_problem,
jobject j_cpn) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
MIP_Problem::Control_Parameter_Name cpn
= build_cxx_control_parameter_name(env, j_cpn);
return
build_java_control_parameter_value(env,
mip->get_control_parameter(cpn));
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_set_1control_1parameter
(JNIEnv* env , jobject j_this_mip_problem,
jobject j_cpv) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
MIP_Problem::Control_Parameter_Value cpv
= build_cxx_control_parameter_value(env, j_cpv);
mip->set_control_parameter(cpv);
}
CATCH_ALL;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_constraints
(JNIEnv* env, jobject j_this_mip_problem) {
try {
jobject j_cs = env->NewObject(cached_classes.Constraint_System,
cached_FMIDs.Constraint_System_init_ID);
CHECK_RESULT_RETURN(env, j_cs, 0);
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
for (MIP_Problem::const_iterator cs_it = mip->constraints_begin(),
cs_end = mip->constraints_end(); cs_it != cs_end; ++cs_it) {
jobject j_constraint = build_java_constraint(env, *cs_it);
env->CallBooleanMethod(j_cs,
cached_FMIDs.Constraint_System_add_ID,
j_constraint);
CHECK_EXCEPTION_RETURN(env, 0);
}
return j_cs;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_clear
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
mip->clear();
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_add_1space_1dimensions_1and_1embed
(JNIEnv* env , jobject j_this_mip_problem, jlong j_dim) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(j_dim);
mip->add_space_dimensions_and_embed(ppl_dim);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_add_1to_1integer_1space_1dimensions
(JNIEnv* env , jobject j_this_mip_problem, jobject j_vset) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Variables_Set v_set = build_cxx_variables_set(env, j_vset);
mip->add_to_integer_space_dimensions(v_set);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_add_1constraint
(JNIEnv* env , jobject j_this_mip_problem, jobject j_c) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Constraint c = build_cxx_constraint(env, j_c);
mip->add_constraint(c);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_add_1constraints
(JNIEnv* env , jobject j_this_mip_problem, jobject j_cs) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Constraint_System cs = build_cxx_constraint_system(env, j_cs);
mip->add_constraints(cs);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_set_1objective_1function
(JNIEnv* env , jobject j_this_mip_problem, jobject j_le) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Linear_Expression le = build_cxx_linear_expression(env, j_le);
mip->set_objective_function(le);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_set_1optimization_1mode
(JNIEnv* env , jobject j_this_mip_problem, jobject j_opt_mode) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Optimization_Mode opt_mode = build_cxx_optimization_mode(env, j_opt_mode);
mip->set_optimization_mode(opt_mode);
}
CATCH_ALL;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_is_1satisfiable
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return mip->is_satisfiable();
}
CATCH_ALL;
return false;
}
JNIEXPORT jobject JNICALL Java_parma_1polyhedra_1library_MIP_1Problem_solve
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return build_java_mip_status(env, mip->solve());
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_evaluate_1objective_1function
(JNIEnv* env, jobject j_this_mip_problem, jobject j_gen,
jobject j_coeff_num, jobject j_coeff_den) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Generator g = build_cxx_generator(env, j_gen);
PPL_DIRTY_TEMP_COEFFICIENT(num);
PPL_DIRTY_TEMP_COEFFICIENT(den);
mip->evaluate_objective_function(g, num, den);
set_coefficient(env, j_coeff_num, build_java_coeff(env, num));
set_coefficient(env, j_coeff_den, build_java_coeff(env, den));
}
CATCH_ALL;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_feasible_1point
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Generator g = mip->feasible_point();
return build_java_generator(env, g);
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_optimizing_1point
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
Generator g = mip->optimizing_point();
return build_java_generator(env, g);
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_optimal_1value
(JNIEnv* env, jobject j_this_mip_problem,
jobject j_coeff_num, jobject j_coeff_den) {
try {
PPL_DIRTY_TEMP_COEFFICIENT(coeff_num);
PPL_DIRTY_TEMP_COEFFICIENT(coeff_den);
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
mip->optimal_value(coeff_num, coeff_den);
set_coefficient(env, j_coeff_num, build_java_coeff(env, coeff_num));
set_coefficient(env, j_coeff_den, build_java_coeff(env, coeff_den));
}
CATCH_ALL;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_OK
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return mip->OK();
}
CATCH_ALL;
return false;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_build_1cpp_1object__J
(JNIEnv* env, jobject j_this_mip_problem, jlong j_dim) {
try {
dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(j_dim);
MIP_Problem* mip_ptr = new MIP_Problem(ppl_dim);
set_ptr(env, j_this_mip_problem, mip_ptr);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_build_1cpp_1object__JLparma_1polyhedra_1library_Constraint_1System_2Lparma_1polyhedra_1library_Linear_1Expression_2Lparma_1polyhedra_1library_Optimization_1Mode_2
(JNIEnv* env , jobject j_this_mip_problem, jlong j_dim, jobject j_cs,
jobject j_le, jobject j_opt_mode) {
try {
dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(j_dim);
Constraint_System cs = build_cxx_constraint_system(env, j_cs);
Linear_Expression le = build_cxx_linear_expression(env, j_le);
Optimization_Mode opt_mode = build_cxx_optimization_mode(env, j_opt_mode);
MIP_Problem* mip_ptr = new MIP_Problem(ppl_dim, cs, le, opt_mode);
set_ptr(env, j_this_mip_problem, mip_ptr);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_build_1cpp_1object__Lparma_1polyhedra_1library_MIP_1Problem_2
(JNIEnv* env, jobject j_this, jobject j_y)
{
MIP_Problem* y_ptr = reinterpret_cast<MIP_Problem*>(get_ptr(env, j_y));
MIP_Problem* this_ptr = new MIP_Problem(*y_ptr);
set_ptr(env, j_this, this_ptr);
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_free
(JNIEnv* env, jobject j_this) {
MIP_Problem* mip = reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this)) {
delete mip;
void* null_ptr = 0;
set_ptr(env, j_this, null_ptr);
}
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_finalize
(JNIEnv* env, jobject j_this) {
MIP_Problem* mip = reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this))
delete mip;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_total_1memory_1in_1bytes
(JNIEnv* env , jobject j_this_mip_problem) {
try {
MIP_Problem* mip
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this_mip_problem));
return mip->total_memory_in_bytes();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_toString
(JNIEnv* env, jobject j_this) {
MIP_Problem* this_ptr
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this));
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
s << *this_ptr;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_MIP_1Problem_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
MIP_Problem* this_ptr
= reinterpret_cast<MIP_Problem*>(get_ptr(env, j_this));
std::ostringstream s;
this_ptr->ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Variable_toString
(JNIEnv* env, jobject j_this) {
using namespace Parma_Polyhedra_Library::IO_Operators;
Variable ppl_var = build_cxx_variable(env, j_this);
std::ostringstream s;
s << ppl_var;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Variable_setStringifier
(JNIEnv* env, jclass j_variable_class, jobject j_stringifier) {
// Store j_stringifier in the corresponding static field.
env->SetStaticObjectField(j_variable_class,
cached_FMIDs.Variable_stringifier_ID,
j_stringifier);
if (j_stringifier == NULL) {
// No stringifier object: reset cache values.
cached_classes.Variable_Stringifier = NULL;
cached_FMIDs.Variable_Stringifier_stringify_ID = NULL;
// Reset default C++ output function.
Variable::set_output_function(&Variable::default_output_function);
}
else {
// Update cache with values computed for concrete class.
jclass vs_class = env->GetObjectClass(j_stringifier);
CHECK_RESULT_ASSERT(env, vs_class);
cached_classes.Variable_Stringifier = vs_class;
jmethodID mID = env->GetMethodID(vs_class, "stringify",
"(J)Ljava/lang/String;");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Variable_Stringifier_stringify_ID = mID;
// Set C++ output function to the Java wrapper.
Variable::set_output_function(&Java_Variable_output_function);
}
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_toString
(JNIEnv* env, jobject j_this) {
using namespace Parma_Polyhedra_Library::IO_Operators;
Linear_Expression ppl_le = build_cxx_linear_expression(env, j_this);
std::ostringstream s;
s << ppl_le;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Linear_1Expression_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Linear_Expression le = build_cxx_linear_expression(env, j_this);
le.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Generator_toString
(JNIEnv* env, jobject g) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Generator ppl_g = build_cxx_generator(env, g);
s << ppl_g;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Generator_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Generator g = build_cxx_generator(env, j_this);
g.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Constraint_toString
(JNIEnv* env, jobject c) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Constraint ppl_c = build_cxx_constraint(env, c);
s << ppl_c;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Constraint_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Constraint c = build_cxx_constraint(env, j_this);
c.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_toString
(JNIEnv* env, jobject g) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Grid_Generator ppl_g = build_cxx_grid_generator(env, g);
s << ppl_g;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Grid_Generator g = build_cxx_grid_generator(env, j_this);
g.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Congruence_toString
(JNIEnv* env, jobject g) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Congruence ppl_g = build_cxx_congruence(env, g);
s << ppl_g;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Congruence_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Congruence c = build_cxx_congruence(env, j_this);
c.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_1System_toString
(JNIEnv* env, jobject ggs) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Grid_Generator_System ppl_ggs = build_cxx_grid_generator_system(env, ggs);
s << ppl_ggs;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Grid_1Generator_1System_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Grid_Generator_System gs = build_cxx_grid_generator_system(env, j_this);
gs.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Generator_1System_toString
(JNIEnv* env, jobject gs) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Generator_System ppl_gs = build_cxx_generator_system(env, gs);
s << ppl_gs;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Generator_1System_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Generator_System gs = build_cxx_generator_system(env, j_this);
gs.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Constraint_1System_toString
(JNIEnv* env, jobject cs) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Constraint_System ppl_cs = build_cxx_constraint_system(env, cs);
s << ppl_cs;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Constraint_1System_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Constraint_System cs = build_cxx_constraint_system(env, j_this);
cs.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Congruence_1System_toString
(JNIEnv* env, jobject cgs) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
Congruence_System ppl_cgs = build_cxx_congruence_system(env, cgs);
s << ppl_cgs;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Congruence_1System_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
Congruence_System cs = build_cxx_congruence_system(env, j_this);
cs.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_IO_wrap_1string
(JNIEnv* env, jclass, jstring str, jint indent_depth,
jint preferred_first_line_length, jint preferred_line_length) {
try {
unsigned ind = jtype_to_unsigned<unsigned int>(indent_depth);
unsigned pfll = jtype_to_unsigned<unsigned int>
(preferred_first_line_length);
unsigned pll = jtype_to_unsigned<unsigned int>(preferred_line_length);
const char* chars = env->GetStringUTFChars(str, 0);
CHECK_RESULT_RETURN(env, chars, 0);
using namespace Parma_Polyhedra_Library::IO_Operators;
std::string s = wrap_string(chars, ind, pfll, pll);
env->ReleaseStringUTFChars(str, chars);
return env->NewStringUTF(s.c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_build_1cpp_1object__J
(JNIEnv* env, jobject j_this_pip_problem, jlong j_dim) {
try {
dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(j_dim);
PIP_Problem* pip_ptr = new PIP_Problem(ppl_dim);
set_ptr(env, j_this_pip_problem, pip_ptr);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_build_1cpp_1object__JLparma_1polyhedra_1library_Constraint_1System_2Lparma_1polyhedra_1library_Variables_1Set_2
(JNIEnv* env , jobject j_this_pip_problem, jlong j_dim,
jobject j_cs, jobject j_vars) {
try {
dimension_type p_dim = jtype_to_unsigned<dimension_type>(j_dim);
Constraint_System p_cs = build_cxx_constraint_system(env, j_cs);
Variables_Set p_vars = build_cxx_variables_set(env, j_vars);
PIP_Problem* pip_ptr = new PIP_Problem(p_dim, p_cs.begin(),
p_cs.end(), p_vars);
set_ptr(env, j_this_pip_problem, pip_ptr);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_build_1cpp_1object__Lparma_1polyhedra_1library_PIP_1Problem_2
(JNIEnv* env, jobject j_this, jobject j_y)
{
PIP_Problem* y_ptr = reinterpret_cast<PIP_Problem*>(get_ptr(env, j_y));
PIP_Problem* this_ptr = new PIP_Problem(*y_ptr);
set_ptr(env, j_this, this_ptr);
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_OK
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->OK();
}
CATCH_ALL;
return false;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_total_1memory_1in_1bytes
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->total_memory_in_bytes();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_external_1memory_1in_1bytes
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->external_memory_in_bytes();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_toString
(JNIEnv* env, jobject j_this) {
PIP_Problem* this_ptr
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this));
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
s << *this_ptr;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
PIP_Problem* this_ptr
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this));
std::ostringstream s;
this_ptr->ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_free
(JNIEnv* env, jobject j_this) {
PIP_Problem* pip = reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this)) {
delete pip;
void* null_ptr = 0;
set_ptr(env, j_this, null_ptr);
}
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1_problem_finalize
(JNIEnv* env, jobject j_this) {
PIP_Problem* pip = reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this))
delete pip;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_max_1space_1dimension
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->max_space_dimension();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_space_1dimension
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->space_dimension();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_get_1big_1parameter_1dimension
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->get_big_parameter_dimension();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_parameter_1space_1dimensions
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return build_java_variables_set(env, pip->parameter_space_dimensions());
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_set_1big_1parameter_1dimension
(JNIEnv* env , jobject j_this_pip_problem, jlong j_dim) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
dimension_type ppl_dim = jtype_to_unsigned<dimension_type>(j_dim);
pip->set_big_parameter_dimension(ppl_dim);
}
CATCH_ALL;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_number_1of_1parameter_1space_1dimensions
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->parameter_space_dimensions().size();
}
CATCH_ALL;
return 0;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_add_1space_1dimensions_1and_1embed
(JNIEnv* env , jobject j_this_pip_problem, jlong j_dim_vars, jlong j_dim_pars) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
dimension_type ppl_dim_vars = jtype_to_unsigned<dimension_type>(j_dim_vars);
dimension_type ppl_dim_pars = jtype_to_unsigned<dimension_type>(j_dim_pars);
pip->add_space_dimensions_and_embed(ppl_dim_vars, ppl_dim_pars);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_add_1to_1parameter_1space_1dimensions
(JNIEnv* env , jobject j_this_pip_problem, jobject j_vars) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
Variables_Set ppl_vars = build_cxx_variables_set(env, j_vars);
pip->add_to_parameter_space_dimensions(ppl_vars);
}
CATCH_ALL;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_number_1of_1constraints
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->constraints_end() - pip->constraints_begin();
}
CATCH_ALL;
return 0;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_add_1constraint
(JNIEnv* env , jobject j_this_pip_problem, jobject j_c) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
Constraint c = build_cxx_constraint(env, j_c);
pip->add_constraint(c);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_add_1constraints
(JNIEnv* env , jobject j_this_pip_problem, jobject j_cs) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
Constraint_System cs = build_cxx_constraint_system(env, j_cs);
pip->add_constraints(cs);
}
CATCH_ALL;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_is_1satisfiable
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return pip->is_satisfiable();
}
CATCH_ALL;
return false;
}
JNIEXPORT jobject JNICALL Java_parma_1polyhedra_1library_PIP_1Problem_solve
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
return build_java_pip_status(env, pip->solve());
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL Java_parma_1polyhedra_1library_PIP_1Problem_solution
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
const PIP_Tree_Node* solution = pip->solution();
jclass j_class_s = env->FindClass("parma_polyhedra_library/PIP_Tree_Node");
CHECK_RESULT_ASSERT(env, j_class_s);
jmethodID j_ctr_id_s = env->GetMethodID(j_class_s, "<init>", "()V");
CHECK_RESULT_ASSERT(env, j_ctr_id_s);
jobject j_obj_s = env->NewObject(j_class_s, j_ctr_id_s);
CHECK_RESULT_RETURN(env, j_obj_s, 0);
set_ptr(env, j_obj_s, solution);
return j_obj_s;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_optimizing_1solution
(JNIEnv* env , jobject j_this_pip_problem) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
const PIP_Tree_Node* solution = pip->optimizing_solution();
jclass j_class_s = env->FindClass("parma_polyhedra_library/PIP_Tree_Node");
CHECK_RESULT_ASSERT(env, j_class_s);
jmethodID j_ctr_id_s = env->GetMethodID(j_class_s, "<init>", "()V");
CHECK_RESULT_ASSERT(env, j_ctr_id_s);
jobject j_obj_s = env->NewObject(j_class_s, j_ctr_id_s);
CHECK_RESULT_RETURN(env, j_obj_s, 0);
set_ptr(env, j_obj_s, solution);
return j_obj_s;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_get_1pip_1problem_1control_1parameter
(JNIEnv* env , jobject j_this_pip_problem,
jobject j_cpn) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
PIP_Problem::Control_Parameter_Name ppl_cpn
= build_cxx_pip_problem_control_parameter_name(env, j_cpn);
return
build_java_pip_problem_control_parameter_value
(env, pip->get_control_parameter(ppl_cpn));
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_constraint_1at_1index
(JNIEnv* env, jobject j_this_pip_problem, jlong j_index) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
dimension_type p_index = jtype_to_unsigned<dimension_type>(j_index);
return build_java_constraint(env, *(pip->constraints_begin() + p_index));
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_constraints
(JNIEnv* env, jobject j_this_pip_problem) {
try {
jobject j_cs = env->NewObject(cached_classes.Constraint_System,
cached_FMIDs.Constraint_System_init_ID);
CHECK_RESULT_RETURN(env, j_cs, 0);
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
for (PIP_Problem::const_iterator cs_it = pip->constraints_begin(),
cs_end = pip->constraints_end(); cs_it != cs_end; ++cs_it) {
jobject j_constraint = build_java_constraint(env, *cs_it);
env->CallBooleanMethod(j_cs,
cached_FMIDs.Constraint_System_add_ID,
j_constraint);
CHECK_EXCEPTION_RETURN(env, 0);
}
return j_cs;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Problem_set_1pip_1problem_1control_1parameter
(JNIEnv* env, jobject j_this_pip_problem, jobject j_cpv) {
try {
PIP_Problem* pip
= reinterpret_cast<PIP_Problem*>(get_ptr(env, j_this_pip_problem));
PIP_Problem::Control_Parameter_Value ppl_cpv
= build_cxx_pip_problem_control_parameter_value(env, j_cpv);
pip->set_control_parameter(ppl_cpv);
}
CATCH_ALL;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_OK
(JNIEnv* env, jobject j_this_pip_tree) {
try {
PIP_Tree_Node* pip
= reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this_pip_tree));
return pip->OK();
}
CATCH_ALL;
return false;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_free
(JNIEnv* env, jobject j_this) {
PIP_Tree_Node* pip = reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this)) {
delete pip;
void* null_ptr = 0;
set_ptr(env, j_this, null_ptr);
}
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_finalize
(JNIEnv* env, jobject j_this) {
PIP_Tree_Node* pip = reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this))
delete pip;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_constraints
(JNIEnv* env, jobject j_this_pip_node) {
try {
jobject j_cs = env->NewObject(cached_classes.Constraint_System,
cached_FMIDs.Constraint_System_init_ID);
CHECK_RESULT_RETURN(env, j_cs, 0);
PIP_Tree_Node* pip
= reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this_pip_node));
return build_java_constraint_system(env, pip->constraints());
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_as_1solution
(JNIEnv* env, jobject j_this) {
try {
PIP_Tree_Node* pip = reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this));
const PIP_Solution_Node* solution = pip->as_solution();
if (solution == 0) {
jobject null = 0;
return null;
}
// Here we have a solution node.
jclass j_class_s
= env->FindClass("parma_polyhedra_library/PIP_Solution_Node");
CHECK_RESULT_ASSERT(env, j_class_s);
jmethodID j_ctr_id_s = env->GetMethodID(j_class_s, "<init>", "()V");
CHECK_RESULT_ASSERT(env, j_ctr_id_s);
jobject j_obj_s = env->NewObject(j_class_s, j_ctr_id_s);
CHECK_RESULT_RETURN(env, j_obj_s, 0);
set_ptr(env, j_obj_s, solution);
return j_obj_s;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_as_1decision
(JNIEnv* env, jobject j_this) {
try {
PIP_Tree_Node* pip = reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this));
const PIP_Decision_Node* decision = pip->as_decision();
if (decision == 0) {
jobject null = 0;
return null;
}
// Here we have a decision node.
jclass j_class_d
= env->FindClass("parma_polyhedra_library/PIP_Decision_Node");
CHECK_RESULT_ASSERT(env, j_class_d);
jmethodID j_ctr_id_d = env->GetMethodID(j_class_d, "<init>", "()V");
CHECK_RESULT_ASSERT(env, j_ctr_id_d);
jobject j_obj_d = env->NewObject(j_class_d, j_ctr_id_d);
CHECK_RESULT_RETURN(env, j_obj_d, 0);
set_ptr(env, j_obj_d, decision);
return j_obj_d;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_number_1of_1artificials
(JNIEnv* env , jobject j_this) {
try {
PIP_Tree_Node* pip = reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this));
return pip->art_parameter_count();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_artificials
(JNIEnv* env, jobject j_this_pip_node) {
try {
jobject j_arts
= env->NewObject(cached_classes.Artificial_Parameter_Sequence,
cached_FMIDs.Artificial_Parameter_Sequence_init_ID);
CHECK_RESULT_RETURN(env, j_arts, 0);
const PIP_Tree_Node* pip_node
= reinterpret_cast<const PIP_Tree_Node*>(get_ptr(env, j_this_pip_node));
for (PIP_Tree_Node::Artificial_Parameter_Sequence::const_iterator
i = pip_node->art_parameter_begin(),
i_end = pip_node->art_parameter_end(); i != i_end; ++i) {
jobject j_art = build_java_artificial_parameter(env, *i);
env->CallBooleanMethod(j_arts,
cached_FMIDs.Artificial_Parameter_Sequence_add_ID,
j_art);
CHECK_EXCEPTION_RETURN(env, 0);
}
return j_arts;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_PIP_1Tree_1Node_toString
(JNIEnv* env, jobject j_this) {
PIP_Tree_Node* this_ptr
= reinterpret_cast<PIP_Tree_Node*>(get_ptr(env, j_this));
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
s << *this_ptr;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Decision_1Node_child_1node
(JNIEnv* env, jobject j_this, jboolean j_branch) {
try {
PIP_Decision_Node* dec_node
= reinterpret_cast<PIP_Decision_Node*>(get_ptr(env, j_this));
const PIP_Tree_Node* child = dec_node->child_node(j_branch);
if (child == 0) {
jobject null = 0;
return null;
}
jclass j_class_s = env->FindClass("parma_polyhedra_library/PIP_Tree_Node");
CHECK_RESULT_ASSERT(env, j_class_s);
jmethodID j_ctr_id_s = env->GetMethodID(j_class_s, "<init>", "()V");
CHECK_RESULT_ASSERT(env, j_ctr_id_s);
jobject j_obj_s = env->NewObject(j_class_s, j_ctr_id_s);
CHECK_RESULT_RETURN(env, j_obj_s, 0);
set_ptr(env, j_obj_s, child);
return j_obj_s;
}
CATCH_ALL;
jobject null = 0;
return null;
}
JNIEXPORT jobject JNICALL
Java_parma_1polyhedra_1library_PIP_1Solution_1Node_parametric_1values
(JNIEnv* env, jobject j_this, jobject j_var) {
PIP_Solution_Node* pip
= reinterpret_cast<PIP_Solution_Node*>(get_ptr(env, j_this));
Variable v = build_cxx_variable(env, j_var);
return build_linear_expression(env, pip->parametric_values(v));
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Artificial_1Parameter_initIDs
(JNIEnv* env, jclass j_artificial_parameter_class) {
jfieldID fID;
fID = env->GetFieldID(j_artificial_parameter_class, "le",
"Lparma_polyhedra_library/Linear_Expression;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Artificial_Parameter_le_ID = fID;
fID = env->GetFieldID(j_artificial_parameter_class, "den",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, fID);
cached_FMIDs.Artificial_Parameter_den_ID = fID;
jmethodID mID;
mID = env->GetMethodID(j_artificial_parameter_class, "<init>",
"(Lparma_polyhedra_library/Linear_Expression;"
"Lparma_polyhedra_library/Coefficient;)V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Artificial_Parameter_init_ID = mID;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Artificial_1Parameter_ascii_1dump
(JNIEnv* env, jobject j_this) {
try {
std::ostringstream s;
PIP_Tree_Node::Artificial_Parameter art
= build_cxx_artificial_parameter(env, j_this);
art.ascii_dump(s);
return env->NewStringUTF(s.str().c_str());
}
CATCH_ALL;
return 0;
}
JNIEXPORT jstring JNICALL
Java_parma_1polyhedra_1library_Artificial_1Parameter_toString
(JNIEnv* env, jobject j_this) {
using namespace Parma_Polyhedra_Library::IO_Operators;
std::ostringstream s;
PIP_Tree_Node::Artificial_Parameter ppl_art
= build_cxx_artificial_parameter(env, j_this);
s << ppl_art;
return env->NewStringUTF(s.str().c_str());
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Artificial_1Parameter_1Sequence_initIDs
(JNIEnv* env, jclass j_aps_class) {
jmethodID mID;
mID = env->GetMethodID(j_aps_class, "<init>", "()V");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Artificial_Parameter_Sequence_init_ID = mID;
mID = env->GetMethodID(j_aps_class, "add", "(Ljava/lang/Object;)Z");
CHECK_RESULT_ASSERT(env, mID);
cached_FMIDs.Artificial_Parameter_Sequence_add_ID = mID;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_build_1cpp_1object
(JNIEnv* env, jobject j_this_pfunc) {
try {
Partial_Function* pfunc_ptr = new Partial_Function;
set_ptr(env, j_this_pfunc, pfunc_ptr);
}
CATCH_ALL;
}
JNIEXPORT jboolean JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_has_1empty_1codomain
(JNIEnv* env , jobject j_this_pfunc) {
try {
Partial_Function* pfunc
= reinterpret_cast<Partial_Function*>(get_ptr(env, j_this_pfunc));
return pfunc->has_empty_codomain();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_max_1in_1codomain
(JNIEnv* env , jobject j_this_pfunc) {
try {
Partial_Function* pfunc
= reinterpret_cast<Partial_Function*>(get_ptr(env, j_this_pfunc));
return pfunc->max_in_codomain();
}
CATCH_ALL;
return 0;
}
JNIEXPORT jlong JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_maps
(JNIEnv* env, jobject j_this_pfunc, jlong j_i) {
Partial_Function* pfunc
= reinterpret_cast<Partial_Function*>(get_ptr(env, j_this_pfunc));
dimension_type i = jtype_to_unsigned<dimension_type>(j_i);
dimension_type j;
if (pfunc->maps(i, j))
return j;
else
return -1;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_insert
(JNIEnv* env , jobject j_this_pfunc, jlong i, jlong j) {
try {
Partial_Function* pfunc
= reinterpret_cast<Partial_Function*>(get_ptr(env, j_this_pfunc));
pfunc->insert(i, j);
}
CATCH_ALL;
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_free
(JNIEnv* env, jobject j_this) {
Partial_Function* pfunc
= reinterpret_cast<Partial_Function*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this)) {
delete pfunc;
void* null_ptr = 0;
set_ptr(env, j_this, null_ptr);
}
}
JNIEXPORT void JNICALL
Java_parma_1polyhedra_1library_Partial_1Function_finalize
(JNIEnv* env, jobject j_this) {
Partial_Function* pfunc
= reinterpret_cast<Partial_Function*>(get_ptr(env, j_this));
if (!is_java_marked(env, j_this))
delete pfunc;
}
|