Hi,
To check the length of a Box object use:
when
$box : Box(length == 10)
then
...
There are two ways to iterate over your list depending the version you are
using. Assuming BoxList has a property boxes returning a collection. In
3.0.5 you can use:
when
BoxList($b : boxes)
then
for(Iterator it = $b.iterator();it.hasNext();) {
assert( it.next());
}
end
On trunk you can use the from keyword to combine the iteration and the rule
when
$list : BoxList()
$box : Box(length == 10) from $list.getBoxes()
then
...
cheers
Steve
On 2/19/07, Diwakar <raja_diwakar(a)yahoo.co.in> wrote:
I am a beginner.
I have an ArrayList object - Say BoxList Object containing 10 Box objects
.
I need to check if the length of the bos is 10cm on each box object.
How do I write this as rule condition.
Is there any way to write the rule for iterating the BoxList to check the
length of each box
Can you please help?
--
View this message in context:
http://www.nabble.com/Handling-ArrayList-objects-in-rule-conditions-tf325...
Sent from the drools - user mailing list archive at
Nabble.com.
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Steven Williams
Supervising Consultant
Object Consulting
Office: 8615 4500 Mob: 0439 898 668 Fax: 8615 4501
stevenw(a)objectconsulting.com.au
www.objectconsulting.com.au
consulting | development | training | support
our experience makes the difference