[rules-users] form of accumulate in examples is depricated?
Michiel Vermandel
mvermand at yahoo.com
Tue Jan 22 04:04:52 EST 2013
Hi,
In lots of rules in the drools planner examples the accumulate function is used in this way:
rule "requiredCpuPowerTotal"
when
$computer : CloudComputer($cpuPower : cpuPower)
$requiredCpuPowerTotal : Number(intValue > $cpuPower) from accumulate(
CloudProcess(
computer == $computer,
$requiredCpuPower : requiredCpuPower),
sum($requiredCpuPower)
)
then
insertLogical(new IntConstraintOccurrence("requiredCpuPowerTotal", ConstraintType.NEGATIVE_HARD,
$requiredCpuPowerTotal.intValue() - $cpuPower,
$computer));
end
(example from cloudBalancing).
Though, documentation says (http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/#d0e6921) one should this syntax:
<result pattern> from accumulate( <source pattern>,
init( <init code> ),
action( <action code> ),
reverse( <reverse code> ),
result( <result expression> ) )
Does this mean that the axemples could be optimized and that I should go for that syntaxt as well rather than using the syntax like rule "requiredCpuPowerTotal" ?
Thanks
-----------------
http://www.codessentials.com - Your essential software, for free!
Follow us at http://twitter.com/#!/Codessentials
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20130122/820a9014/attachment-0001.html
More information about the rules-users
mailing list