]
Edson Tirelli reassigned JBRULES-546:
-------------------------------------
Assignee: Edson Tirelli (was: Mark Proctor)
Please implement "collect( ... ) from" functionality
----------------------------------------------------
Key: JBRULES-546
URL:
http://jira.jboss.com/jira/browse/JBRULES-546
Project: JBoss Rules
Issue Type: Feature Request
Security Level: Public(Everyone can see)
Reporter: Dirk Bergstrom
Assigned To: Edson Tirelli
I need to count the number of sub-objects that meet various criteria. As an example,
suppose I have several hundred Town objects, each of which has a list of perhaps a few
hundred Person objects. I need to write rules like:
"Find all the towns that have more than three disabled people with incomes over
$100K."
"For each town with more than 1000 residents that has more than 50 poor children
under the age of 8, add a teacher for every 25 children."
I'm shaky on JBR syntax, but I think those would translate to something like:
rule "disabled"
when
ArrayList(size > 50) from collect( Person( disabled == "yes", income
> 100000 ) from town.getPersons() )
then
//do stuff
end
rule "teachers"
when
town : Town( population > 1000 )
count : Arraylist from collect( Person( disabled == "yes", income >
100000 ) from town.getPersons() )
count( size > 50 )
then
town.addTeachers(count.size() / 25)
end
(I'm not really working with towns and people, but it makes for easily understood
examples)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: