Just for the heck of it, here&#39;s two more ways for &quot;comibining&quot; those two rules. (Gee, what a vague specification!)<br><span style="color: rgb(85, 142, 213);"><br># straightforwardly doing both in one<br>rule comb1<br>
when<br>   $cm: ConditionMatrix()<br>   $docs1: ArrayList() from collect( Document( ... ) )<br>   $docs2: </span><span style="color: rgb(85, 142, 213);">ArrayList() from collect( Document( ... ) )<br>then ... end<br><br># abstraction<br>
rule comb2<br>when<br>   $cm: ConditionMatrix()<br>   $filter: Filter()<br>   $docs: ArrayList() from collect( $d: Document() eval( $filter.pass( $cm, $d ) ) )<br>then ... end<br></span><span style="color: rgb(85, 142, 213);"></span><span style="color: rgb(85, 142, 213);"><br>
-W<br><br><br></span><br><div class="gmail_quote">2011/5/25 Vincent Legendre <span dir="ltr">&lt;<a href="mailto:vincent.legendre@eurodecision.com">vincent.legendre@eurodecision.com</a>&gt;</span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


  
    
  
  <div text="#000000" bgcolor="#ffffff">
    Not sure of what you exactly ...<br>
    <br>
    If you want to combine tests, you can write this :
    <div><div class="im"><span style="color: rgb(85, 142, 213);">Rule
        “test filter”</span><br>
      <span style="color: rgb(85, 142, 213);"></span><span style="color: rgb(85, 142, 213);">When</span><br>
      <span style="color: rgb(85, 142, 213);">      $cm: 
        ConditionMatrix()</span><br>
      </div><span style="color: rgb(85, 142, 213);">      $document:  
        ArrayList() from collect ( Document (user.isPrivateName  ==
        $cm.isPrivateName, </span><span style="color: rgb(85, 142, 213);">Payment.isLegal == $cm.isLegal) )</span><span style="color: rgb(85, 142, 213);">                                                             
        </span><br>
      <span style="color: rgb(85, 142, 213);">Then</span><br>
      <span style="color: rgb(85, 142, 213);">                //do
        something</span><br>
      <span style="color: rgb(85, 142, 213);">End<br>
        <br>
      </span></div>
    If you want to make the filter more dynamic and write only one
    &quot;collect&quot; rule, I don&#39;t see any out-of-the-box method.<br>
    You can add a method in ConditionMatrix that accepts a Document and
    write this rule :<div class="im"><br>
    <span style="color: rgb(85, 142, 213);">Rule “test filter”</span><br>
    <span style="color: rgb(85, 142, 213);"></span><span style="color: rgb(85, 142, 213);">When</span><br>
    <span style="color: rgb(85, 142, 213);">      $cm: 
      ConditionMatrix()</span><br>
    </div><span style="color: rgb(85, 142, 213);">      $document:  
      ArrayList() from collect ( Document (eval($cm.accept(this))</span><span style="color: rgb(85, 142, 213);"> ) )</span><span style="color: rgb(85, 142, 213);">                                                             
    </span><br>
    <span style="color: rgb(85, 142, 213);">Then</span><br>
    <span style="color: rgb(85, 142, 213);">                //do
      something</span><br>
    <span style="color: rgb(85, 142, 213);">End</span><br>
    <br>
    Of course you have to implement the &quot;accept&quot; method in Java (and you
    can then do several sub-classes for you filters)<br>
    <br>
  </div>

<br>_______________________________________________<br>
rules-users mailing list<br>
<a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
<br></blockquote></div><br>