[PPL-devel] Accessing constraint systems from Java

Enea Zaffanella zaffanella at cs.unipr.it
Fri Jun 29 08:09:23 CEST 2012


On 06/28/2012 04:01 PM, Gianluca Amato wrote:
> Hi there!
> I am trying to write a method in Java, which takes a PPL object (let's
> say a Polyhedron, or an Octagonal_Shape), a sequence of strings as
> variables names, and generates a string representation of the object
> similar to the one we obtain with the toString() method, but with the
> given variable names instead of A, B, etc...
>
> My idea was to get a Constraint_System from the object, iterate over
> Constraints, and access the coefficients of each constraint. However,
> the Java API is much simpler then the C++ API, and there is no way, for
> example, to iterate over constraints.
>
> For the moment, I am generating a string representation with toString,
> and apply there the necessary transformations.
>
> Do you have any idea how can I circumvent in other ways the limitations
> of the API? Any plan for a better Java API?
>
> Thanks in advance,
> --gianluca
> _______________________________________________
> PPL-devel mailing list
> PPL-devel at cs.unipr.it
> http://www.cs.unipr.it/mailman/listinfo/ppl-devel
>


Hi Gianluca.

All "systems" in the Java language interface are vectors:

   public class Constraint_System extends java.util.Vector<Constraint>

hence you should be able to call inherited methods
such as isEmpty(), size(), elementAt(int), elements(), ...
(Note: I haven't actually tested it; feel free to ping us back in case 
something doesn't work as expected.)

Thank you for the valuable feedback: we realized just now that the 
current documentation is basically hiding this information.

Ciao,
Enea.



More information about the PPL-devel mailing list