<br><br><div class="gmail_quote">On 11 August 2011 13:06, wendy <span dir="ltr">&lt;<a href="mailto:w.mungovan@yahoo.com">w.mungovan@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I&#39;m still not sure I can make my rule work like that.  Sorry, my real problem<br>
is a little more complicated then I initially described.<br>
<br>
We are trying to detect if some set of conditions stay within a set of<br>
ranges over a period of time.  So still using the example below.  The color<br>
is really the key for the shape and the size can change over time.  For<br>
example, we would want to know if any shape&#39;s size was larger than 5 for 20<br>
min.<br>
<br>
I see how you are making a map that would have a list of all the shapes of<br>
the same color.  So $map[&#39;BLUE&#39;] would return all shapes<br>
<br>
and $shape: Shapes( $color: color, size &gt; 5 ) could change to $shape:<br>
Shapes( $color: color, size &gt; 5 ) over window:time(20m) to only get Shape<br>
sizes for the last 20 min.<br></blockquote><div><br>Yes.<br> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
now this would be a map where the key would be the color and the value would<br>
be the min size over a 20 min window.<br>
<br>
//untested<br>
$map: Map()<br>
    from accumulate ( $shape: Shapes( $color: color) over window:time(20m),<br>
      init( Map m = new HashMap(); ),<br>
      action( Number min = m.get( $color );<br>
                 if( min == null ) m.put($shape.size);<br>
                 else if (min &gt; $shape.size) m.put($shape.size);),<br>
      result( m ) )<br>
<br>
and then I would need to iterate through the map and find all the ones whose<br>
min size &gt; 5?<br>
<font color="#888888"><br></font></blockquote><div>I don&#39;t see why you would need a map with mininum size per color. If you restrict <br></div><div>   accumulate ( $shape: Shapes( $color: color, size &gt; 5 )<br>you won&#39;t get any list in the map where there is a shape with size &lt;= 5. By investigating the map I proposed you can still find the minimum sizes &gt; 5 - these are the minimum sizes in each list.<br>
<br>-W<br><br><br></div></div>