[jboss-jira] [JBoss JIRA] Created: (JBRULES-546) Please implement "collect( ... ) from" functionality
Dirk Bergstrom (JIRA)
jira-events at jboss.com
Tue Nov 7 16:59:41 EST 2006
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: Mark Proctor
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: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list