28 namespace Interfaces {
33 Java_Class_Cache cached_classes;
34 Java_FMID_Cache cached_FMIDs;
88 env->DeleteGlobalRef(field);
90 jclass jni_class = env->FindClass(name);
92 field = (jclass) env->NewGlobalRef(jni_class);
100 env->GetJavaVM(&
jvm);
108 "parma_polyhedra_library/Artificial_Parameter");
110 "parma_polyhedra_library/Artificial_Parameter_Sequence");
122 "parma_polyhedra_library/Grid_Generator_Type");
124 "parma_polyhedra_library/Constraint_System");
126 "parma_polyhedra_library/Congruence_System");
128 "parma_polyhedra_library/Generator_System");
130 "parma_polyhedra_library/Grid_Generator_System");
132 "parma_polyhedra_library/Linear_Expression");
134 "parma_polyhedra_library/Linear_Expression_Coefficient");
136 "parma_polyhedra_library/Linear_Expression_Difference");
138 "parma_polyhedra_library/Linear_Expression_Sum");
140 "parma_polyhedra_library/Linear_Expression_Times");
142 "parma_polyhedra_library/Linear_Expression_Unary_Minus");
144 "parma_polyhedra_library/Linear_Expression_Variable");
146 "parma_polyhedra_library/MIP_Problem_Status");
148 "parma_polyhedra_library/Optimization_Mode");
151 "parma_polyhedra_library/PIP_Problem_Control_Parameter_Name");
153 "parma_polyhedra_library/PIP_Problem_Control_Parameter_Value");
155 "parma_polyhedra_library/PIP_Problem_Status");
157 "parma_polyhedra_library/Poly_Con_Relation");
159 "parma_polyhedra_library/Poly_Gen_Relation");
172 env->DeleteGlobalRef(field);
226 handle_exception(JNIEnv* env,
const std::overflow_error& e) {
228 = env->FindClass(
"parma_polyhedra_library/Overflow_Error_Exception");
230 jint ret = env->ThrowNew(newExcCls, e.what());
235 handle_exception(JNIEnv* env,
const std::invalid_argument& e) {
237 = env->FindClass(
"parma_polyhedra_library/Invalid_Argument_Exception");
239 jint ret = env->ThrowNew(newExcCls, e.what());
244 handle_exception(JNIEnv* env,
const std::logic_error& e) {
246 = env->FindClass(
"parma_polyhedra_library/Logic_Error_Exception");
248 jint ret = env->ThrowNew(newExcCls, e.what());
253 handle_exception(JNIEnv* env,
const std::length_error& e) {
255 = env->FindClass(
"parma_polyhedra_library/Length_Error_Exception");
257 jint ret = env->ThrowNew(newExcCls, e.what());
262 handle_exception(JNIEnv* env,
const std::domain_error& e) {
264 = env->FindClass(
"parma_polyhedra_library/Domain_Error_Exception");
266 jint ret = env->ThrowNew(newExcCls, e.what());
271 handle_exception(JNIEnv* env,
const std::bad_alloc&) {
273 = env->FindClass(
"java/lang/RuntimeException");
275 jint ret = env->ThrowNew(newExcCls,
"Out of memory");
280 handle_exception(JNIEnv* env,
const std::exception& e) {
281 jclass newExcCls = env->FindClass(
"java/lang/RuntimeException");
283 jint ret = env->ThrowNew(newExcCls, e.what());
288 handle_exception(JNIEnv* env,
const timeout_exception&) {
291 = env->FindClass(
"parma_polyhedra_library/Timeout_Exception");
293 jint ret = env->ThrowNew(newExcCls,
"PPL timeout expired");
298 handle_exception(JNIEnv* env,
const deterministic_timeout_exception&) {
299 reset_deterministic_timeout();
301 = env->FindClass(
"parma_polyhedra_library/Timeout_Exception");
303 jint ret = env->ThrowNew(newExcCls,
"PPL deterministic timeout expired");
308 handle_exception(JNIEnv* env) {
309 jclass newExcCls = env->FindClass(
"java/lang/RuntimeException");
311 jint ret = env->ThrowNew(newExcCls,
"PPL bug: unknown exception raised");
317 Weightwatch* p_deterministic_timeout_object = 0;
321 if (p_timeout_object) {
322 delete p_timeout_object;
323 p_timeout_object = 0;
329 reset_deterministic_timeout() {
330 if (p_deterministic_timeout_object) {
331 delete p_deterministic_timeout_object;
332 p_deterministic_timeout_object = 0;
338 build_java_poly_gen_relation(JNIEnv* env, Poly_Gen_Relation& r) {
346 jobject ret = env->NewObject(cached_classes.Poly_Gen_Relation,
347 cached_FMIDs.Poly_Gen_Relation_init_ID,
354 build_java_poly_con_relation(JNIEnv* env, Poly_Con_Relation& r) {
374 jobject ret = env->NewObject(cached_classes.Poly_Con_Relation,
375 cached_FMIDs.Poly_Con_Relation_init_ID,
383 build_cxx_congruence(JNIEnv* env, jobject j_congruence) {
385 = env->GetObjectField(j_congruence, cached_FMIDs.Congruence_mod_ID);
387 = env->GetObjectField(j_congruence, cached_FMIDs.Congruence_lhs_ID);
389 = env->GetObjectField(j_congruence, cached_FMIDs.Congruence_rhs_ID);
391 ppl_modulus = build_cxx_coeff(env, j_mod);
392 Linear_Expression lhs = build_cxx_linear_expression(env, j_lhs);
393 Linear_Expression rhs = build_cxx_linear_expression(env, j_rhs);
394 return (lhs %= rhs) / ppl_modulus;
397 PIP_Tree_Node::Artificial_Parameter
398 build_cxx_artificial_parameter(JNIEnv* env, jobject j_artificial_parameter) {
400 = env->GetObjectField(j_artificial_parameter,
401 cached_FMIDs.Artificial_Parameter_le_ID);
403 = env->GetObjectField(j_artificial_parameter,
404 cached_FMIDs.Artificial_Parameter_den_ID);
406 ppl_den = build_cxx_coeff(env, j_den);
407 Linear_Expression
le = build_cxx_linear_expression(env, j_le);
408 PIP_Tree_Node::Artificial_Parameter art_param(le, ppl_den);
413 bool_to_j_boolean_class(JNIEnv* env,
const bool value) {
414 jobject ret = env->CallStaticObjectMethod(cached_classes.Boolean,
415 cached_FMIDs.Boolean_valueOf_ID,
416 static_cast<jboolean>(value));
422 j_long_to_j_long_class(JNIEnv* env, jlong jlong_value) {
423 jobject ret = env->CallStaticObjectMethod(cached_classes.Long,
424 cached_FMIDs.Long_valueOf_ID,
431 j_long_class_to_j_long(JNIEnv* env, jobject j_long) {
432 jlong ret = env->CallLongMethod(j_long, cached_FMIDs.Long_longValue_ID);
438 j_int_to_j_integer(JNIEnv* env, jint jint_value) {
439 jobject ret = env->CallStaticObjectMethod(cached_classes.Integer,
440 cached_FMIDs.Integer_valueOf_ID,
447 j_integer_to_j_int(JNIEnv* env, jobject j_integer) {
448 jint ret = env->CallIntMethod(j_integer, cached_FMIDs.Integer_intValue_ID);
454 build_cxx_variables_set(JNIEnv* env, jobject j_v_set) {
457 = env->CallObjectMethod(j_v_set, cached_FMIDs.Variables_Set_iterator_ID);
460 jmethodID has_next_ID = cached_FMIDs.Variables_Set_Iterator_has_next_ID;
461 jmethodID next_ID = cached_FMIDs.Variables_Set_Iterator_next_ID;
465 jboolean has_next_value = env->CallBooleanMethod(j_iter, has_next_ID);
466 while (has_next_value) {
467 j_variable = env->CallObjectMethod(j_iter, next_ID);
469 v_set.insert(build_cxx_variable(env, j_variable));
470 has_next_value = env->CallBooleanMethod(j_iter, has_next_ID);
477 build_java_variables_set(JNIEnv* env,
const Variables_Set& v_set) {
478 jobject j_vs = env->NewObject(cached_classes.Variables_Set,
479 cached_FMIDs.Variables_Set_init_ID);
481 for (Variables_Set::const_iterator v_begin = v_set.begin(),
482 v_end = v_set.end(); v_begin != v_end; ++v_begin) {
483 Variable var(*v_begin);
484 jobject j_variable = build_java_variable(env, var);
485 env->CallBooleanMethod(j_vs,
486 cached_FMIDs.Variables_Set_add_ID,
494 build_cxx_bounded_overflow(JNIEnv* env, jobject j_bounded_overflow) {
495 jint bounded_overflow
496 = env->CallIntMethod(j_bounded_overflow, cached_FMIDs.Bounded_Integer_Type_Overflow_ordinal_ID);
498 switch (bounded_overflow) {
511 build_cxx_bounded_rep(JNIEnv* env, jobject j_bounded_rep) {
513 = env->CallIntMethod(j_bounded_rep, cached_FMIDs.Bounded_Integer_Type_Representation_ordinal_ID);
515 switch (bounded_rep) {
526 build_cxx_bounded_width(JNIEnv* env, jobject j_bounded_width) {
528 = env->CallIntMethod(j_bounded_width, cached_FMIDs.Bounded_Integer_Type_Width_ordinal_ID);
530 switch (bounded_width) {
547 build_cxx_relsym(JNIEnv* env, jobject j_relsym) {
549 = env->CallIntMethod(j_relsym, cached_FMIDs.Relation_Symbol_ordinal_ID);
570 build_cxx_optimization_mode(JNIEnv* env, jobject j_opt_mode) {
572 = env->CallIntMethod(j_opt_mode, cached_FMIDs.Optimization_Mode_ordinal_ID);
587 switch (mip_status) {
589 fID = cached_FMIDs.MIP_Problem_Status_UNFEASIBLE_MIP_PROBLEM_ID;
592 fID = cached_FMIDs.MIP_Problem_Status_UNBOUNDED_MIP_PROBLEM_ID;
595 fID = cached_FMIDs.MIP_Problem_Status_OPTIMIZED_MIP_PROBLEM_ID;
600 return env->GetStaticObjectField(cached_classes.MIP_Problem_Status, fID);
606 switch (pip_status) {
608 fID = cached_FMIDs.PIP_Problem_Status_UNFEASIBLE_PIP_PROBLEM_ID;
611 fID = cached_FMIDs.PIP_Problem_Status_OPTIMIZED_PIP_PROBLEM_ID;
616 return env->GetStaticObjectField(cached_classes.PIP_Problem_Status, fID);
624 fID = cached_FMIDs.Optimization_Mode_MINIMIZATION_ID;
627 fID = cached_FMIDs.Optimization_Mode_MAXIMIZATION_ID;
632 return env->GetStaticObjectField(cached_classes.Optimization_Mode, fID);
636 build_cxx_control_parameter_name(JNIEnv* env, jobject j_cp_name) {
637 jclass cp_name_class = env->GetObjectClass(j_cp_name);
639 jmethodID cp_name_ordinal_id
640 = env->GetMethodID(cp_name_class,
"ordinal",
"()I");
642 jint cp_name = env->CallIntMethod(j_cp_name, cp_name_ordinal_id);
651 build_java_control_parameter_name
653 jclass j_cp_name_class
654 = env->FindClass(
"parma_polyhedra_library/Control_Parameter_Name");
656 jfieldID cp_name_pricing_get_id
657 = env->GetStaticFieldID(j_cp_name_class,
"PRICING",
658 "Lparma_polyhedra_library/Control_Parameter_Name;");
661 return env->GetStaticObjectField(j_cp_name_class,
662 cp_name_pricing_get_id);
668 build_cxx_control_parameter_value(JNIEnv* env, jobject j_cp_value) {
669 jclass cp_value_class = env->GetObjectClass(j_cp_value);
671 jmethodID cp_value_ordinal_id
672 = env->GetMethodID(cp_value_class,
"ordinal",
"()I");
674 jint cp_value = env->CallIntMethod(j_cp_value, cp_value_ordinal_id);
689 build_java_control_parameter_value
691 jclass j_cp_value_class
692 = env->FindClass(
"parma_polyhedra_library/Control_Parameter_Value");
694 const char* field_name;
697 field_name =
"PRICING_STEEPEST_EDGE_FLOAT";
700 field_name =
"PRICING_STEEPEST_EDGE_EXACT";
703 field_name =
"PRICING_TEXTBOOK";
708 jfieldID fID = env->GetStaticFieldID(j_cp_value_class, field_name,
709 "Lparma_polyhedra_library/Control_Parameter_Value;");
711 return env->GetStaticObjectField(j_cp_value_class, fID);
715 build_cxx_pip_problem_control_parameter_name(JNIEnv* env, jobject j_cp_name) {
716 jclass cp_name_class = env->GetObjectClass(j_cp_name);
718 jmethodID cp_name_ordinal_id
719 = env->GetMethodID(cp_name_class,
"ordinal",
"()I");
721 jint cp_name = env->CallIntMethod(j_cp_name, cp_name_ordinal_id);
734 build_java_pip_problem_control_parameter_name
736 jclass j_cp_name_class
737 = env->FindClass(
"parma_polyhedra_library/PIP_Problem_Control_Parameter_Name");
739 jfieldID cp_name_cutting_strategy_get_id
740 = env->GetStaticFieldID(j_cp_name_class,
"CUTTING_STRATEGY",
741 "Lparma_polyhedra_library/PIP_Problem_Control_Parameter_Name;");
743 jfieldID cp_name_pivot_row_strategy_get_id
744 = env->GetStaticFieldID(j_cp_name_class,
"PIVOT_ROW_STRATEGY",
745 "Lparma_polyhedra_library/PIP_Problem_Control_Parameter_Name;");
749 return env->GetStaticObjectField(j_cp_name_class,
750 cp_name_cutting_strategy_get_id);
752 return env->GetStaticObjectField(j_cp_name_class,
753 cp_name_pivot_row_strategy_get_id);
760 build_cxx_pip_problem_control_parameter_value(JNIEnv* env, jobject j_cp_value) {
761 jclass cp_value_class = env->GetObjectClass(j_cp_value);
763 jmethodID cp_value_ordinal_id
764 = env->GetMethodID(cp_value_class,
"ordinal",
"()I");
766 jint cp_value = env->CallIntMethod(j_cp_value, cp_value_ordinal_id);
785 build_java_pip_problem_control_parameter_value
787 jclass j_cp_value_class
788 = env->FindClass(
"parma_polyhedra_library/PIP_Problem_Control_Parameter_Value");
790 const char* field_name;
793 field_name =
"CUTTING_STRATEGY_FIRST";
796 field_name =
"CUTTING_STRATEGY_DEEPEST";
799 field_name =
"CUTTING_STRATEGY_ALL";
802 field_name =
"PIVOT_ROW_STRATEGY_FIRST";
805 field_name =
"PIVOT_ROW_STRATEGY_MAX_COLUMN";
810 jfieldID fID = env->GetStaticFieldID(j_cp_value_class, field_name,
811 "Lparma_polyhedra_library/PIP_Problem_Control_Parameter_Value;");
813 return env->GetStaticObjectField(j_cp_value_class, fID);
817 build_cxx_constraint(JNIEnv* env, jobject j_constraint) {
819 = env->GetObjectField(j_constraint, cached_FMIDs.Constraint_lhs_ID);
821 = env->GetObjectField(j_constraint, cached_FMIDs.Constraint_rhs_ID);
823 = env->GetObjectField(j_constraint, cached_FMIDs.Constraint_kind_ID);
824 Linear_Expression first_le = build_cxx_linear_expression(env, lhs_value);
825 Linear_Expression second_le = build_cxx_linear_expression(env, rhs_value);
827 = env->CallIntMethod(kind, cached_FMIDs.Relation_Symbol_ordinal_ID);
831 return Constraint(first_le < second_le);
833 return Constraint(first_le <= second_le);
835 return Constraint(first_le == second_le);
837 return Constraint(first_le >= second_le);
839 return Constraint(first_le > second_le);
846 build_cxx_linear_expression(JNIEnv* env, jobject j_le) {
848 jclass current_class = env->GetObjectClass(j_le);
850 if (env->IsAssignableFrom(current_class,
851 cached_classes.Linear_Expression_Variable)) {
852 jmethodID mID = cached_FMIDs.Linear_Expression_Variable_var_id_ID;
853 jlong var_id = env->CallLongMethod(j_le, mID);
854 return Linear_Expression(Variable(var_id));
857 if (env->IsAssignableFrom(current_class,
858 cached_classes.Linear_Expression_Coefficient)) {
859 fID = cached_FMIDs.Linear_Expression_Coefficient_coeff_ID;
860 jobject ppl_coeff = env->GetObjectField(j_le, fID);
861 return Linear_Expression(build_cxx_coeff(env, ppl_coeff));
864 if (env->IsAssignableFrom(current_class,
865 cached_classes.Linear_Expression_Sum)) {
866 fID = cached_FMIDs.Linear_Expression_Sum_lhs_ID;
867 jobject l_value = env->GetObjectField(j_le, fID);
868 fID = cached_FMIDs.Linear_Expression_Sum_rhs_ID;
869 jobject r_value = env->GetObjectField(j_le, fID);
870 return build_cxx_linear_expression(env, l_value)
871 + build_cxx_linear_expression(env, r_value);
874 if (env->IsAssignableFrom(current_class,
875 cached_classes.Linear_Expression_Times)) {
876 fID = cached_FMIDs.Linear_Expression_Times_coeff_ID;
877 jobject coeff_value = env->GetObjectField(j_le, fID);
878 fID = cached_FMIDs.Linear_Expression_Times_lin_expr_ID;
879 jobject le_value = env->GetObjectField(j_le, fID);
880 return build_cxx_coeff(env, coeff_value)
881 * build_cxx_linear_expression(env, le_value);
884 if (env->IsAssignableFrom(current_class,
885 cached_classes.Linear_Expression_Difference)) {
886 fID = cached_FMIDs.Linear_Expression_Difference_lhs_ID;
887 jobject l_value = env->GetObjectField(j_le,fID);
888 fID = cached_FMIDs.Linear_Expression_Difference_rhs_ID;
889 jobject r_value = env->GetObjectField(j_le, fID);
890 return build_cxx_linear_expression(env, l_value)
891 - build_cxx_linear_expression(env, r_value);
894 if (env->IsAssignableFrom(current_class,
895 cached_classes.Linear_Expression_Unary_Minus)) {
896 fID = cached_FMIDs.Linear_Expression_Unary_Minus_arg_ID;
897 jobject le_value = env->GetObjectField(j_le, fID);
898 return -build_cxx_linear_expression(env, le_value);
905 build_cxx_generator(JNIEnv* env, jobject j_generator) {
907 = env->GetObjectField(j_generator, cached_FMIDs.Generator_le_ID);
908 jobject generator_type
909 = env->GetObjectField(j_generator, cached_FMIDs.Generator_gt_ID);
910 jint generator_type_ordinal
911 = env->CallIntMethod(generator_type,
912 cached_FMIDs.Generator_Type_ordinal_ID);
914 switch (generator_type_ordinal) {
916 return line(build_cxx_linear_expression(env, j_le));
918 return ray(build_cxx_linear_expression(env, j_le));
922 = env->GetObjectField(j_generator, cached_FMIDs.Generator_div_ID);
923 return point(build_cxx_linear_expression(env, j_le),
924 build_cxx_coeff(env, j_div));
929 = env->GetObjectField(j_generator, cached_FMIDs.Generator_div_ID);
930 return closure_point(build_cxx_linear_expression(env, j_le),
931 build_cxx_coeff(env, j_div));
939 build_cxx_grid_generator(JNIEnv* env, jobject j_grid_generator) {
941 = env->GetObjectField(j_grid_generator, cached_FMIDs.Grid_Generator_le_ID);
942 jobject grid_generator_type
943 = env->GetObjectField(j_grid_generator, cached_FMIDs.Grid_Generator_gt_ID);
944 jint grid_generator_type_ordinal
945 = env->CallIntMethod(grid_generator_type,
946 cached_FMIDs.Grid_Generator_Type_ordinal_ID);
948 switch (grid_generator_type_ordinal) {
950 return grid_line(build_cxx_linear_expression(env, j_le));
953 jobject j_div = env->GetObjectField(j_grid_generator,
954 cached_FMIDs.Grid_Generator_div_ID);
955 return parameter(build_cxx_linear_expression(env, j_le),
956 build_cxx_coeff(env, j_div));
960 jobject j_div = env->GetObjectField(j_grid_generator,
961 cached_FMIDs.Grid_Generator_div_ID);
962 return grid_point(build_cxx_linear_expression(env, j_le),
963 build_cxx_coeff(env, j_div));
971 build_java_linear_expression_coefficient(JNIEnv* env,
const Coefficient& c) {
972 jobject j_coeff = build_java_coeff(env, c);
974 = env->NewObject(cached_classes.Linear_Expression_Coefficient,
975 cached_FMIDs.Linear_Expression_Coefficient_init_ID,
982 set_generator(JNIEnv* env, jobject dst, jobject src) {
983 jobject src_gt = env->GetObjectField(src, cached_FMIDs.Generator_gt_ID);
984 env->SetObjectField(dst, cached_FMIDs.Generator_gt_ID, src_gt);
985 jobject src_le = env->GetObjectField(src, cached_FMIDs.Generator_le_ID);
986 env->SetObjectField(dst, cached_FMIDs.Generator_le_ID, src_le);
987 jobject src_div = env->GetObjectField(src, cached_FMIDs.Generator_div_ID);
988 env->SetObjectField(dst, cached_FMIDs.Generator_div_ID, src_div);
992 set_pair_element(JNIEnv* env, jobject dst_pair,
int arg, jobject src) {
995 env->SetObjectField(dst_pair, cached_FMIDs.Pair_first_ID, src);
998 env->SetObjectField(dst_pair, cached_FMIDs.Pair_second_ID, src);
1006 get_pair_element(JNIEnv* env,
int arg, jobject j_pair) {
1009 return env->GetObjectField(j_pair, cached_FMIDs.Pair_first_ID);
1011 return env->GetObjectField(j_pair, cached_FMIDs.Pair_second_ID);
1018 build_java_constraint(JNIEnv* env,
const Constraint& c) {
1019 jobject lhs = build_linear_expression(env, c);
1021 = build_java_linear_expression_coefficient(env, -c.inhomogeneous_term());
1025 fID = cached_FMIDs.Relation_Symbol_EQUAL_ID;
1028 fID = cached_FMIDs.Relation_Symbol_GREATER_OR_EQUAL_ID;
1031 fID = cached_FMIDs.Relation_Symbol_GREATER_THAN_ID;
1037 = env->GetStaticObjectField(cached_classes.Relation_Symbol, fID);
1038 jobject ret = env->NewObject(cached_classes.Constraint,
1039 cached_FMIDs.Constraint_init_ID,
1040 lhs, relation, rhs);
1046 build_java_congruence(JNIEnv* env,
const Congruence& cg) {
1047 jobject j_mod = build_java_coeff(env, cg.modulus());
1048 jobject j_lhs = build_linear_expression(env, cg);
1050 = build_java_linear_expression_coefficient(env, -cg.inhomogeneous_term());
1051 jobject ret = env->NewObject(cached_classes.Congruence,
1052 cached_FMIDs.Congruence_init_ID,
1053 j_lhs, j_rhs, j_mod);
1059 build_java_generator(JNIEnv* env,
const Generator& g) {
1060 jobject j_g_le = build_linear_expression(env, g);
1064 ret = env->CallStaticObjectMethod(cached_classes.Generator,
1065 cached_FMIDs.Generator_line_ID,
1069 ret = env->CallStaticObjectMethod(cached_classes.Generator,
1070 cached_FMIDs.Generator_ray_ID,
1076 jobject j_div = build_java_coeff(env, divisor);
1077 ret = env->CallStaticObjectMethod(cached_classes.Generator,
1078 cached_FMIDs.Generator_point_ID,
1085 jobject j_div = build_java_coeff(env, divisor);
1086 ret = env->CallStaticObjectMethod(cached_classes.Generator,
1087 cached_FMIDs.Generator_closure_point_ID,
1099 build_java_grid_generator(JNIEnv* env,
const Grid_Generator& g) {
1100 jobject j_g_le = build_linear_expression(env, g);
1104 ret = env->CallStaticObjectMethod(cached_classes.Grid_Generator,
1105 cached_FMIDs.Grid_Generator_grid_line_ID,
1111 jobject j_div = build_java_coeff(env, divisor);
1112 ret = env->CallStaticObjectMethod(cached_classes.Grid_Generator,
1113 cached_FMIDs.Grid_Generator_parameter_ID,
1120 jobject j_div = build_java_coeff(env, divisor);
1121 ret = env->CallStaticObjectMethod(cached_classes.Grid_Generator,
1122 cached_FMIDs.Grid_Generator_grid_point_ID,
1134 build_java_constraint_system(JNIEnv* env,
const Constraint_System& cs) {
1135 jobject j_cs = env->NewObject(cached_classes.Constraint_System,
1136 cached_FMIDs.Constraint_System_init_ID);
1139 v_end = cs.end(); v_begin != v_end; ++v_begin) {
1140 jobject j_constraint = build_java_constraint(env, *v_begin);
1141 env->CallBooleanMethod(j_cs,
1142 cached_FMIDs.Constraint_System_add_ID,
1150 build_java_generator_system(JNIEnv* env,
const Generator_System& gs) {
1151 jobject j_gs = env->NewObject(cached_classes.Generator_System,
1152 cached_FMIDs.Generator_System_init_ID);
1155 v_end = gs.end(); v_begin != v_end; ++v_begin) {
1156 jobject j_generator = build_java_generator(env, *v_begin);
1157 env->CallBooleanMethod(j_gs,
1158 cached_FMIDs.Generator_System_add_ID,
1166 build_java_grid_generator_system(JNIEnv* env,
1167 const Grid_Generator_System& gs) {
1168 jobject j_gs = env->NewObject(cached_classes.Grid_Generator_System,
1169 cached_FMIDs.Grid_Generator_System_init_ID);
1171 for (Grid_Generator_System::const_iterator v_begin = gs.begin(),
1172 v_end = gs.end(); v_begin != v_end; ++v_begin) {
1173 jobject j_generator = build_java_grid_generator(env, *v_begin);
1174 env->CallBooleanMethod(j_gs,
1175 cached_FMIDs.Grid_Generator_System_add_ID,
1183 build_java_congruence_system(JNIEnv* env,
const Congruence_System& cgs) {
1184 jobject j_cgs = env->NewObject(cached_classes.Congruence_System,
1185 cached_FMIDs.Congruence_System_init_ID);
1187 for (Congruence_System::const_iterator v_begin = cgs.begin(),
1188 v_end = cgs.end(); v_begin != v_end; ++v_begin) {
1189 jobject j_congruence = build_java_congruence(env,*v_begin);
1190 env->CallBooleanMethod(j_cgs,
1191 cached_FMIDs.Congruence_System_add_ID,
1199 build_java_artificial_parameter
1200 (JNIEnv* env,
const PIP_Tree_Node::Artificial_Parameter& art) {
1201 jobject j_le = build_linear_expression(env, art);
1202 jobject j_den = build_java_coeff(env, art.denominator());
1203 jobject ret = env->NewObject(cached_classes.Artificial_Parameter,
1204 cached_FMIDs.Artificial_Parameter_init_ID,
1211 Java_Variable_output_function(std::ostream& s, Variable v) {
1213 JavaVM* jvm = cached_classes.jvm;
1215 jvm->AttachCurrentThread((
void **)&env, NULL);
1218 jclass var_class = cached_classes.Variable;
1219 jfieldID fID = cached_FMIDs.Variable_stringifier_ID;
1220 jobject stringifier = env->GetStaticObjectField(var_class, fID);
1223 jmethodID mID = cached_FMIDs.Variable_Stringifier_stringify_ID;
1228 jclass dyn_class = env->GetObjectClass(stringifier);
1229 jmethodID dyn_mID = env->GetMethodID(dyn_class,
"stringify",
1230 "(J)Ljava/lang/String;");
1233 #endif // #ifndef NDEBUG
1234 jlong j_var_id = v.id();
1236 = (jstring) env->CallObjectMethod(stringifier, mID, j_var_id);
1239 const char* nativeString = env->GetStringUTFChars(bi_string, 0);
1242 env->ReleaseStringUTFChars(bi_string, nativeString);
static Poly_Con_Relation is_disjoint()
static Poly_Gen_Relation subsumes()
jclass Artificial_Parameter
#define CHECK_RESULT_ASSERT(env, cond)
#define CHECK_RESULT_THROW(env, cond)
#define PPL_DIRTY_TEMP_COEFFICIENT(id)
jclass Variable_Stringifier
#define PPL_JAVA_UNEXPECTED
#define CHECK_EXCEPTION_THROW(env)
static Poly_Con_Relation is_included()
jclass Grid_Generator_Type
jclass Linear_Expression_Coefficient
static Poly_Con_Relation saturates()
Java_Class_Cache()
Default constructor.
Bounded_Integer_Type_Overflow
Bounded_Integer_Type_Width
PIVOT_ROW_STRATEGY_MAX_COLUMN
jclass Artificial_Parameter_Sequence
PPL_COEFFICIENT_TYPE Coefficient
#define CHECK_RESULT_ABORT(env, cond)
void clear_cache(JNIEnv *env)
Resets all fields to NULL.
jclass Linear_Expression_Sum
Generator_System_const_iterator const_iterator
jclass Linear_Expression_Variable
jclass Linear_Expression_Difference
jclass Linear_Expression_Times
PRICING_STEEPEST_EDGE_FLOAT
jclass PIP_Problem_Control_Parameter_Value
#define CHECK_EXCEPTION_ASSERT(env)
jclass PIP_Problem_Control_Parameter_Name
jclass Linear_Expression_Unary_Minus
PRICING_STEEPEST_EDGE_EXACT
void init_cache(JNIEnv *env)
Initializes all cache fields.
const Throwable *volatile abandon_expensive_computations
static Poly_Con_Relation nothing()
static Poly_Con_Relation strictly_intersects()
static Poly_Gen_Relation nothing()
bool le(Boundary_Type type1, const T1 &x1, const Info1 &info1, Boundary_Type type2, const T2 &x2, const Info2 &info2)
Bounded_Integer_Type_Representation
Constraint_System_const_iterator const_iterator