JESS: [EXTERNAL] Iterate over a Java List in Jess
"Hunter McMillen" <[email protected]> Tue, 13 Dec 2011 20:56:14 -0500
| Newsgroups | gmane.comp.java.jess |
|---|---|
| Message-ID | <CABWUPR1X+qz_qD_pGUP-R-BHNYgOP5zKmZ_LmiYRPV5fAJX7uQ@mail.gmail.com> |
Is there anyway to iterate over a Java List object from Jess?
I have a Java object that I store in a Jess variable:
engine.getGlobalContext().setVariable("bwapi", new Value(bwapi));
one of the methods that can be called on bwapi returns a Java ArrayList,
and I would like to be able to iterate over this list to check certain
properties of its elements.
Right now I am doing this:
engine.executeCommand("(bind ?units (create$ =(?bwapi getMyUnits)))");
engine.executeCommand("foreach ?u ?units (printout t ?u crlf))");
but when the units are supposed to be printed all I get is:
=
<Java-Object:java.util.ArrayList>
Any ideas?
Thanks,
Hunter M