<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt">Hi,<br><br>In lots of rules in the drools planner examples the accumulate function is used in this way:<br><br>rule "requiredCpuPowerTotal"<br> when<br> $computer : CloudComputer($cpuPower : cpuPower)<br> $requiredCpuPowerTotal : Number(intValue > $cpuPower) from accumulate(<br> CloudProcess(<br> computer == $computer,<br> $requiredCpuPower : requiredCpuPower),<br>
sum($requiredCpuPower)<br> )<br> then<br> insertLogical(new IntConstraintOccurrence("requiredCpuPowerTotal", ConstraintType.NEGATIVE_HARD,<br> $requiredCpuPowerTotal.intValue() - $cpuPower,<br> $computer));<br>end<br><br>(example from cloudBalancing).<br><br>Though, documentation says (http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/#d0e6921) one should this syntax:<br><span style="font-family: Courier New,courier,monaco,monospace,sans-serif;"><br><result pattern> from accumulate( <source
pattern>,<br> init( <init code> ),<br> action( <action code> ),<br> reverse( <reverse code> ),<br> result( <result expression> )
)</span><br><br>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" ?<br><br>Thanks<br><br><br><div>-----------------<br>http://www.codessentials.com - Your essential software, for free!<br>Follow us at http://twitter.com/#!/Codessentials</div></div></body></html>