[rules-users] checking for complex conditions
Edson Tirelli
tirelli at post.com
Tue Mar 4 14:26:53 EST 2008
Jai,
You can try:
rule "Foo check with inline eval"
when
Foo( eval( a - (b + c) > 0 ) )
then
<do actions>
end
Or, what is better IMO:
rule "Foo check with return value predicate"
when
Foo( a > ( b + c ) )
then
<do actions>
end
Hope it helps.
[]s
Edson
2008/3/4, Jai Vasanth <jaivasanth at gmail.com>:
>
> Hi,
>
>
> Suppose I have a class Foo with integers a, b and c ( methods getA
> getB and getC respectively ) and I Want to check if an object of Foo
> satisfies
>
> a - (b + c) > 0
>
> Is this the best way I go about doing this ?
>
> rule "Foo check"
> when
> Foo( varA : a , varB:b, varC:c )
> eval( varA - (varB + varC) > 0 )
> then
> <do actions>
> end
>
>
>
> Writing this as
>
> rule "Foo check"
> when
> Foo( a - (b + c) > 0 )
> then
> <do actions>
> end
>
> doesnt seem to work. Its not able to find the variables (a, b and c ) from
> the getA getB and get C methods.
>
> Thanks
>
> Jai
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>
--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20080304/ecfd6a39/attachment.html
More information about the rules-users
mailing list