Hello,
I have asserted one ArrayList<Cylinder> into my working memory
and I am using the 'from' clause to iterate over the items of the list and
fire the rule accordingly.
i.e.:
rule "Firing Pressure Less Than Min"
agenda-group "cylinder"
salience 22
when
$cylinders: ArrayList()
$cylinder : Cylinder(pressureValue < Pressure.MIN_VALUE) from $cylinders
then
System.out.println("The FP of Cyl xxx is Lower than Min Possible.");
end
I would like to make the following questions:
a) Is it possible to get the index of the item in the list for which the rule fired;
Lets say that I would like to do that without adding extra fields in the Cylinder class.
b) If i had a second ArrayList<Cylinder> in my working memory would I be able to
iterate over
the two lists simultaneously and compare values for corresponding items in the LHS;
c) Can I use the 'from accumulate' clause over an ArrayList instead of individual
objects
asserted into the working memory;
My apologies for the multiple questions in one mail.
Thank you in advance for any help,
Katerina