[jboss-jira] [JBoss JIRA] Closed: (JBRULES-546) Please implement "collect( ... ) from" functionality

Mark Proctor (JIRA) jira-events at lists.jboss.org
Thu Apr 12 09:39:58 EDT 2007


     [ http://jira.jboss.com/jira/browse/JBRULES-546?page=all ]

Mark Proctor closed JBRULES-546.
--------------------------------

    Resolution: Out of Date

'collect' is done and part of the M1 release and also in trunk. We also did 'accumulate'.

> 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: 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