Hi ALL,<div><br></div><div>We are using drools 4.0.7 for one of our projects. We encountered some issues which I thought are strange.</div><div><br></div><div>1. When using FORALL on an entity for which we haven't asserted any of the instances in the working memory the rule always fires. I thought this rule should be evaluted to true only if all the asserted instances satisfy the condition and if we don't insert any of the instances in the working memory it should no fire the rule. Is this the expected behaviour or am I wrong?</div>
<div><br></div><div> ex: rule "rule1"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> when</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>forall (</div><div><span class="Apple-tab-span" style="white-space:pre">                </span> Vehicle( model == "bmw" )</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>)</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> then</div><div> System.out.println("in forall");end</div>
<div><br></div><div>2. When using 'contains' operator on array or collection of strings its working fine. But when we use it for an array of primitive type double it gives a classcastexception . Is auto boxing not supported? May be this is fine as it mentioned in the documentation that it works only on Objects. I tried using the array of Double objects, here it doesn't throw an excpetion but the rule wasn't firing. The behaviour was same even if I use a collection of Double objects. Is this a bug or am I missing something?</div>
<div><br></div><div> ex: </div><div><span class="Apple-style-span" style="font-weight: bold;">using Array</span></div><div><br></div><div> rule "OrderArray"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> when</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span> Order(valueArray contains 0)</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> then</div><div> System.out.println("OrderArray");<br>
</div><div>end.</div><div><br></div><div><span class="Apple-style-span" style="font-weight: bold;">using Collection</span></div><div><span class="Apple-style-span" style="font-weight: bold;"><br></span></div><div><span class="Apple-style-span" style="font-weight: bold;"><br>
</span></div><div><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal; "><div> rule "OrderList"</div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span> when</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space: pre; ">                </span> Order(valueList contains 0)</div><div><br></div><div><span class="Apple-tab-span" style="white-space: pre; ">        </span> then</div><div> System.out.println("OrderList");<br>
</div><div>end.</div><div><br></div><div>May be for collections I can write it as below </div><div><br></div><div><br></div><div><div>rule "OrderList"</div><div><span class="Apple-tab-span" style="white-space:pre">        </span> when</div>
<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                </span>$order : Order( $val:valueList)</div><div> Double(doubleValue ==0) from $val</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">        </span> then</div>
<div> System.out.println("OrderList");<br></div><div>end. but this working but not intuitive as these rules were maintained later by a business user it will be easy for him if we contains and also if we can directly use array instead of collections it would be a great as current BOM uses arrays everywhere.</div>
<div><br></div><div>Thanks,</div><div>sudhir.</div></div></span></span></div><div><br></div><div><br></div><div><br></div><div><br></div>