此内容没有您所选择的语言版本。
13.28. Syntax for the Conditional Element Accumulate
- Top level accumulate syntax
accumulate( <source pattern>; <functions> [;<constraints>] )- Syntax example
rule "Raise alarm" when $s : Sensor() accumulate( Reading( sensor == $s, $temp : temperature ); $min : min( $temp ), $max : max( $temp ), $avg : average( $temp ); $min < 20, $avg > 70 ) then // raise the alarm endIn the above example, min, max and average are Accumulate Functions and will calculate the minimum, maximum and average temperature values over all the readings for each sensor.