My problem boils down to finding matching entries in parallel arrays.<br><br>Here is a rule that succesfully does just that:<br><br>rule "Find matching entry in parallel arrays"<br> when<br> $first : ArrayList( )
<br> $second : ArrayList( this != $first )<br> $i : Integer( this < $first.size )<br> eval( $first.get($i) == $second.get($i) )<br> then<br> System.out.println ( "Found match at index " + $i + "!" );
<br>end<br><br><br>To execute this rule, I must insert (assert) the two ArrayList facts as well as at least as many Integer facts as there are items in the ArrayLists.<br><br>What I don't like about this rule is that<br>
<br> (1) I have to assert the Integers<br> (2) I can't support arbitrarily-sized lists in my rules (without asserting that many Integer facts)<br><br>So -- Is there a better way? <br><br>What if a future version of Drools supported implicit Number facts that allowed for these kinds of indexing rules?
<br><br>Aaron<br><br><br><br><br>