[rules-users] Replacement for eval

Wolfgang Laun wolfgang.laun at gmail.com
Tue Nov 16 06:50:51 EST 2010


2010/11/16 Nirmal Fernando <nirmal070125 at gmail.com>:
> Hi,
>
> I have two questions.
>
> 1) Is there any other way/method in Drools to test the truth value of a
> condition other than "eval"?

The margin of this email is too small to put them all here. See the
Expert manual, subsection 4.8.3, Left Hand Side (when) Conditional Elements

> In almost all rules of my application needs to test conditions, and it takes
> ages to run using "eval".
>
> 2) Say I have a java method which returns a boolean, and I have used it
> within an "eval" function. (eg: eval(message.emptyMessageFinder()) )
> This "emptyMessageFinder()" method will return a "boolean" if there's an
> empty message. This function is containing many loops and recursive
> operations.
>
> Will I get a performance improvement if I alternate the above such that the
> "emptyMessageFinder()" method sets a boolean attribute (anyEmptyMessage)
> in the Message class to true and false, and I'm using following in my drl.
>
> when
>    m: Message()
>    m.emptyMessageFinder()
>    eval(m.anyEmptyMessage)  //can I use eval here??

A plain method call cannot be used as a CE. Consult the documentation for
all possible variants.

> ......
>
> If someone can answer these questions it would be a great help!
>
> Thank you in advance!
>
> --
> Best Regards,
> Nirmal
>
> C.S.Nirmal J. Fernando
> Department of Computer Science & Engineering,
> Faculty of Engineering,
> University of Moratuwa,
> Sri Lanka.
> Blog: http://nirmalfdo.blogspot.com/
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>




More information about the rules-users mailing list