<html><body bgcolor="#FFFFFF"><div>If you use bean property conventions for naming your methods you can use a regular condition element. for instance, you could rename emptyMessageFinder() to isMessageFound() or getMessageFound() and your condition would look like this:</div><div><br></div><div>when</div><div> m : Message(messageFound == true)</div><div>then</div><div>...</div><div>end</div><div><br></div><div>And when you do this the rete is used, birds sing in the trees, and world peace will be declared.<br><br>GreG</div><div><br>On Nov 16, 2010, at 5:37, Nirmal Fernando <<a href="mailto:nirmal070125@gmail.com">nirmal070125@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div>Hi,<br><br>I have two questions.<br><br>1) Is there any other way/method in Drools to test the truth value of a condition other than "eval"? <br>In almost all rules of my application needs to test conditions, and it takes ages to run
using "eval". <br>
<br>2) Say I have a java method which returns a boolean, and I have used it within an "eval" function. (eg: eval(message.emptyMessageFinder()) )<br>This "emptyMessageFinder()" method will return a "boolean" if there's an empty message. This function is containing many loops and recursive operations.<br>
<br>Will I get a performance improvement if I alternate the above such that the "emptyMessageFinder()" method sets a boolean attribute (anyEmptyMessage)<br>in the Message class to true and false, and I'm using following in my drl.<br>
<br>when <br> m: Message()<br> m.emptyMessageFinder()<br> eval(m.anyEmptyMessage) //can I use eval here??<br>......<br><br>If someone can answer these questions it would be a great help!<br><br>Thank you in advance!<br>
<br>-- <br>Best Regards,<br>Nirmal<br><br>C.S.Nirmal J. Fernando<br>Department of Computer Science & Engineering,<br>Faculty of Engineering,<br>University of Moratuwa,<br>Sri Lanka.<div><br></div><div>Blog: <a href="http://nirmalfdo.blogspot.com/" target="_blank"><a href="http://nirmalfdo.blogspot.com/">http://nirmalfdo.blogspot.com/</a></a></div>
<br>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rules-users mailing list</span><br><span><a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a></span><br></div></blockquote><br>
</body></html>