Assuming you want to deal with one PeopleMatch at a time:
when
$match : PeopleMatch( $people: people )
$match: Number( intValue < 0 )
from accumulate( $task : Task(handler memberOf $people), ...
I have some misgivings due to "intValue<0" and Matcher not being
assignment-compatible with java.lang.Number, but that's for you to
resolve.
-W
On 19/02/2013, Michiel Vermandel <mvermand(a)yahoo.com> wrote:
Hi,
I am kind of stuck in writing a rule :
I have PeopleMatch facts in working memory.
Each PeopleMatch has a number of persons: PeopleMatch().getPeople =
List<Person>
I have planning-entities (Tasks) which have a planning-variable Person.
Now I would like to create a rule to loop over the PeopleMatch objects,
gather all Tasks for the people of this match and do some calculation with
all tasks.
This is what I have for the moment:
rule "matchPeopleTasks"
when
$match : PeopleMatch()
$people : List() from $match .people
$match: Number( intValue < 0 )
from accumulate( $task : Task(handler == $people),
init( Matcher matcher =
$match.getMatcher()),
action( matcher.addTask( $task ); ),
reverse( matcher.removeTask( $task ); ),
result( matcher.getMatch() ) );
then
...
end
The problem area is of course the "accumulate( $task : ProjectTask(handler
== $people),"
How do I select all tasks in the accumulate function, based on a list of
people?
Thanks,
Michiel
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at
http://twitter.com/#!/Codessentials