Hi,
I'm new to Drools. Could anyone please help with the following:
Can you share data between a rule's "condition" and "consequence" ?
For example:
- My "condition" calculates some square root (Math.sqrt)
- The "consequence" needs to print out the same square root
It's not efficient to call Math.sqrt twice... :
< parameter identifier="num" >
< class > Integer < / class >
< / parameter >
< java:condition >
Math.sqrt(num.intValue()) > 1000
< / java:condition >
< java:consequence >
System.out.println( Math.sqrt(num.intValue())
< / java:consequence >
Is there a way to store the result of "Math.sqrt" in some temporary variable (
so as to avoid the duplicate calculation ) ?
Please note I know about "application data", but i'd rather not use it, because
my sqrt is just a temporary value...
Thanks :)
---------------------------------
What are the most popular cars? Find out at Yahoo! Autos