What I would do in your case is to have 2+ rules. One rule calculates the value, and the other(s) rule(s) will reason over the calculated value.
Example:
rule "Calculates Memory Usage"
when
$mpw: Resource( type=="MemoryInfo", attributes.Percent == null, $phys:attributes.PhysicalUsed, $tot: attributes.TotalPhysical )
then
$mpw.setAttribute( "Percent", ((Double)$phys).doubleValue() / ((Double)$tot).doubleValue());
update( $mpw );
end
rule "High Average Usage"
when
Resource( type=="MemoryInfo", attributes.Percent > .95 )
then
// do something
end
rule "Medium Average Usage"
when
Resource( type=="MemoryInfo", attributes.Percent > .50 && <= .95 )
then
// do something
end
Hope it helps...
[]s
Edson
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com