<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The requiredCpuPowerTotal is just a short-hand way of reusing
existing functions, such as sum, count, max, ....<br>
It shouldn't be slower, nor faster: it's just an overloading and
reuse of out-of-the-box functions.<br>
<br>
<div class="moz-cite-prefix">Op 22-01-13 10:04, Michiel Vermandel
schreef:<br>
</div>
<blockquote
cite="mid:1358845492.40441.YahooMailNeo@web161302.mail.bf1.yahoo.com"
type="cite">
<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
(<a class="moz-txt-link-freetext" href="http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/#d0e6921">http://docs.jboss.org/drools/release/5.5.0.Final/drools-expert-docs/html_single/#d0e6921</a>)
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>
<a class="moz-txt-link-freetext" href="http://www.codessentials.com">http://www.codessentials.com</a> - Your essential software, for
free!<br>
Follow us at <a class="moz-txt-link-freetext" href="http://twitter.com/#!/Codessentials">http://twitter.com/#!/Codessentials</a></div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
rules-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a>
</pre>
</blockquote>
<br>
</body>
</html>