Thanks for the replies!<br><br>I observed that the action of a rule not get executed straight after that rule activated.<br><br>Say my rules are following:<br><br>rule "Hello World"<br> when<br> then<br> System.out.println( "hello world" ); <br>
end<br><br>rule "GoodBye"<br> when<br> Message( status == Message.GOODBYE, myMessage : message )<br> then<br> System.out.println("good bye");<br>end<br><br>If I have set up my Message class such that it will fire the "GoodBye" rule, my output is:<br>
<br>good bye<br>hello world<br><br>What I wanna know whether this is the expected behaviour? (Since normally I expect the action of that particular rule to be executed straight after it's fired.)<br><br>Am I missing something here?<br>
<br>Thanks.<br><br><br><div class="gmail_quote">2010/11/16 Greg Barton <span dir="ltr"><<a href="mailto:greg_barton@yahoo.com">greg_barton@yahoo.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div 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>
<font color="#888888"><br>GreG</font></div><div class="im"><div><br>On Nov 16, 2010, at 5:37, Nirmal Fernando <<a href="mailto:nirmal070125@gmail.com" target="_blank">nirmal070125@gmail.com</a>> wrote:<br><br></div>
<div></div></div><blockquote type="cite"><div><div class="im">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></div>
<div class="im">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></div><div class="im">......<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><a href="http://nirmalfdo.blogspot.com/" target="_blank">http://nirmalfdo.blogspot.com/</a></div>
<br>
</div></div></blockquote><div class="im"><blockquote type="cite"><div><span>_______________________________________________</span><br><span>rules-users mailing list</span><br><span><a href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a></span><br>
<span><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a></span><br></div></blockquote><br>
</div></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><br clear="all"><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">http://nirmalfdo.blogspot.com/</a></div><br>