[PPL-devel] [GIT] ppl/ppl(master): Corrected Java Generator private method void set( Generator).
Enea Zaffanella
zaffanella at cs.unipr.it
Thu Apr 23 20:53:55 CEST 2009
Module: ppl/ppl
Branch: master
Commit: b1c68544454e49a25a446e3344d2657cbf15c786
URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=b1c68544454e49a25a446e3344d2657cbf15c786
Author: Enea Zaffanella <zaffanella at cs.unipr.it>
Date: Thu Apr 23 20:45:46 2009 +0200
Corrected Java Generator private method void set(Generator).
We were not correctly setting the divisor for the generator.
Also got rid of unused jni method set_grid_generator().
---
interfaces/Java/jni/ppl_java_common.cc | 15 +--------
interfaces/Java/jni/ppl_java_common.defs.hh | 7 ----
.../Java/parma_polyhedra_library/Generator.java | 35 ++++++++++---------
3 files changed, 19 insertions(+), 38 deletions(-)
diff --git a/interfaces/Java/jni/ppl_java_common.cc b/interfaces/Java/jni/ppl_java_common.cc
index f69ac06..d36da04 100644
--- a/interfaces/Java/jni/ppl_java_common.cc
+++ b/interfaces/Java/jni/ppl_java_common.cc
@@ -779,7 +779,7 @@ build_cxx_generator(JNIEnv* env, jobject j_generator) {
CHECK_RESULT_ASSERT(env, j_le_field);
jobject j_le = env->GetObjectField(j_generator, j_le_field);
jfieldID j_coeff_field
- = env->GetFieldID(generator_class, "den",
+ = env->GetFieldID(generator_class, "div",
"Lparma_polyhedra_library/Coefficient;");
CHECK_RESULT_ASSERT(env, j_coeff_field);
jobject j_coeff = env->GetObjectField(j_generator, j_coeff_field);
@@ -1064,19 +1064,6 @@ set_generator(JNIEnv* env, jobject& to_be_set, jobject gen) {
}
void
-set_grid_generator(JNIEnv* env, jobject& to_be_set, jobject gen) {
- jclass j_generator_class
- = env->FindClass("parma_polyhedra_library/Grid_Generator");
- CHECK_RESULT_ASSERT(env, j_generator_class);
- jmethodID j_coeff_set_id
- = env->GetMethodID(j_generator_class, "set",
- "(Lparma_polyhedra_library/Grid_Generator;)V");
- CHECK_RESULT_ASSERT(env, j_coeff_set_id);
- env->CallVoidMethod(to_be_set, j_coeff_set_id, gen);
- CHECK_EXCEPTION_ASSERT(env); // CHECK ME: an exception is better here?
-}
-
-void
set_coefficient(JNIEnv* env, jobject& to_be_set, jobject c) {
jclass j_coeff_class
= env->FindClass("parma_polyhedra_library/Coefficient");
diff --git a/interfaces/Java/jni/ppl_java_common.defs.hh b/interfaces/Java/jni/ppl_java_common.defs.hh
index b0854a8..6e47223 100644
--- a/interfaces/Java/jni/ppl_java_common.defs.hh
+++ b/interfaces/Java/jni/ppl_java_common.defs.hh
@@ -390,13 +390,6 @@ set_generator(JNIEnv* env, jobject& to_be_set, jobject gen);
/*! \brief
Sets Java reference \p to_be_set
- to the parma_polyhedra_library::Grid_Generator object \p g_gen.
-*/
-void
-set_grid_generator(JNIEnv* env, jobject& to_be_set, jobject g_gen);
-
-/*! \brief
- Sets Java reference \p to_be_set
to the parma_polyhedra_library::Coefficient object \p c.
*/
void
diff --git a/interfaces/Java/parma_polyhedra_library/Generator.java b/interfaces/Java/parma_polyhedra_library/Generator.java
index 19189ba..08f86fc 100644
--- a/interfaces/Java/parma_polyhedra_library/Generator.java
+++ b/interfaces/Java/parma_polyhedra_library/Generator.java
@@ -37,8 +37,8 @@ import javax.management.RuntimeErrorException;
- a closure point.
*/
public class Generator {
- //! The denominator used if the generator is a point or a clousure point.
- private Coefficient den;
+ //! The divisor (valid if the generator is a point or a closure point).
+ private Coefficient div;
//! The generator type.
private Generator_Type gt;
@@ -47,8 +47,8 @@ public class Generator {
private Linear_Expression le;
/*! \brief
- Builds a generator of type \p g_type, stealing the coefficients from
- \p e.
+ Builds a generator of type \p g_type,
+ stealing the coefficients from \p e.
*/
private Generator(Linear_Expression e, Generator_Type g_type) {
le = e.clone();
@@ -61,16 +61,16 @@ public class Generator {
Thrown if \p d is zero.
*/
public static Generator closure_point(Linear_Expression e,
- Coefficient c) {
- if (c.getBigInteger().equals(java.math.BigInteger.ZERO)) {
+ Coefficient d) {
+ if (d.getBigInteger().equals(java.math.BigInteger.ZERO)) {
Error cause = new Error("parma_polyhedra_library.Generator::"
- + "Generator(le, c):\n"
+ + "Generator(e, d):\n"
+ "the divisor can not be zero.");
throw new RuntimeErrorException(cause);
}
Generator g = new Generator(e, Generator_Type.CLOSURE_POINT);
- g.den = c;
+ g.div = d;
return g;
}
@@ -80,8 +80,8 @@ public class Generator {
Thrown if the homogeneous part of \p e represents the origin of
the vector space.
*/
- public static Generator line(Linear_Expression le) {
- return new Generator(le, Generator_Type.LINE);
+ public static Generator line(Linear_Expression e) {
+ return new Generator(e, Generator_Type.LINE);
}
//! Returns the point at \p e / \p d.
@@ -89,16 +89,16 @@ public class Generator {
\exception RuntimeErrorException
Thrown if \p d is zero.
*/
- public static Generator point(Linear_Expression le, Coefficient d) {
+ public static Generator point(Linear_Expression e, Coefficient d) {
if (d.getBigInteger().equals(java.math.BigInteger.ZERO)) {
Error cause = new Error("parma_polyhedra_library.Generator::"
- + "Generator(le, d):\n"
+ + "Generator(e, d):\n"
+ "the divisor can not be zero.");
throw new RuntimeErrorException(cause);
}
- Generator g = new Generator(le, Generator_Type.POINT);
- g.den = d;
+ Generator g = new Generator(e, Generator_Type.POINT);
+ g.div = d;
return g;
}
@@ -108,8 +108,8 @@ public class Generator {
Thrown if the homogeneous part of \p e represents the origin of
the vector space.
*/
- public static Generator ray(Linear_Expression le) {
- return new Generator(le, Generator_Type.RAY);
+ public static Generator ray(Linear_Expression e) {
+ return new Generator(e, Generator_Type.RAY);
}
//! If \p this is either a point or a closure point, returns its divisor.
@@ -120,7 +120,7 @@ public class Generator {
public Coefficient divisor() {
if (this.gt == Generator_Type.POINT
|| this.gt == Generator_Type.CLOSURE_POINT)
- return den;
+ return div;
Error cause = new Error("parma_polyhedra_library.Generator::divisor:\n"
+ "this is neither a point"
+ " nor a closure point.");
@@ -131,6 +131,7 @@ public class Generator {
private void set(Generator g) {
this.le = g.le;
this.gt = g.gt;
+ this.div = g.div;
}
//! Returns an ascii formatted internal representation of \p this.
More information about the PPL-devel
mailing list