<div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:10pt"><div><span>thank you.</span></div><div><br></div><div style="font-family: arial, helvetica, sans-serif; font-size: 10pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><font face="Arial" size="2"><hr size="1"><b><span style="font-weight:bold;">From:</span></b> Wolfgang Laun-2 [via Drools] &lt;<a href="/user/SendEmail.jtp?type=node&node=3243377&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;<br><b><span style="font-weight: bold;">To:</span></b> wendy &lt;<a href="/user/SendEmail.jtp?type=node&node=3243377&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;<br><b><span style="font-weight: bold;">Sent:</span></b> Wednesday, August 10, 2011 1:31 PM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [rules-users] Collect with same value<br></font><br><div id="yiv1605529294">

        rule "get big shapes by color"<br>when<br>&nbsp; $map: Map()<br>&nbsp;&nbsp;&nbsp; from accumulate ( $shape: Shapes( $color: color, size &gt; 5 ),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; init( Map m = new HashMap(); ),<br>&nbsp; &nbsp; &nbsp; action( List list = m.get( $color );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( list == null ) list = new ArrayList();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; list.add( shape ); ),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; result( m ) )<br>then<br>&nbsp;&nbsp; // process $map to get all lists of same color<br>end<br><br>Untested.<br><br>-W<br>
<br><div class="yiv1605529294gmail_quote">On 10 August 2011 17:20, wendy <span dir="ltr">&lt;<a rel="nofollow" target="_top" link="external">[hidden email]</a>&gt;</span> wrote:<br><blockquote style="border-left:2px solid #CCCCCC;padding:0 1em;" class="yiv1605529294gmail_quote">
Hi,<br>
 &nbsp;I'm trying to write the following rule but am having some trouble.<br>
<br>
 &nbsp;We have a object say Shape and which has attributes size and color. &nbsp;I<br>
want to get a list of all shapes with the same color that have size &gt; 5.<br>
How can I make sure the color is the same for all objects in the collect<br>
without having different rules for 'red', 'green'...?<br>
<br>
Thank you,<br>
Wendy<br>
<font color="#888888"><br>
<br>
--<br>
View this message in context: <a rel="nofollow" target="_blank" href="http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.html" link="external">http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3242904.html</a><br>

Sent from the Drools: User forum mailing list archive at Nabble.com.<br>
_______________________________________________<br>
rules-users mailing list<br>
<a rel="nofollow" target="_top" link="external">[hidden email]</a><br>
<a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</font></blockquote></div><br>
<br>_______________________________________________
<br>rules-users mailing list
<br><a rel="nofollow" target="_top" link="external">[hidden email]</a>
<br><a rel="nofollow" target="_blank" href="https://lists.jboss.org/mailman/listinfo/rules-users" link="external">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
        
        <br>
        <br>
        <hr color="#cccccc" noshade="noshade" size="1">
        <div style="color:#444;font:12px tahoma, geneva, helvetica, arial, sans-serif;">
                <div style="font-weight:bold;">If you reply to this email, your message will be added to the discussion below:</div>
                <a rel="nofollow" target="_blank" href="http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3243337.html" link="external">http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3243337.html</a>
        </div>
        <div style="color:#666;font:11px tahoma, geneva, helvetica, arial, sans-serif;margin-top:.4em;">
                
                To unsubscribe from Collect with same value, <a rel="nofollow" target="_blank" href="" link="external">click here</a>.
        </div></div><br><br></div></div></div>
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://drools.46999.n3.nabble.com/Collect-with-same-value-tp3242904p3243377.html">Re: [rules-users] Collect with same value</a><br/>
Sent from the <a href="http://drools.46999.n3.nabble.com/Drools-User-forum-f47000.html">Drools: User forum mailing list archive</a> at Nabble.com.<br/>