[rules-users] using "contains" against a List<BigInteger>

Travis_Smith at bnz.co.nz Travis_Smith at bnz.co.nz
Wed Feb 16 01:22:30 EST 2011


Hi,

A newbie question I'm afraid. I've been unsuccessful searching the 
mailing-list archive (and google) for this.

I'm trying to simplify rule-writing for Statistical Analysts to be able to 
write rules. I'm hoping to achieve this without resort to DSLR files and a 
DSL if possible as we currently need them for nothing else

One of the situations I have is the following:
--------------------
when
$performance : Performance(
        eval(calcScore.contains(BigInteger.valueOf(6)))
)
then
[...]
--------------------

That works absolutely fine: CustAccPerf being a having several members, 
including an ArrayList<BigInteger> called calcScore

Howwever I'd like to rewrite it like:
--------------------
when

$performance : Performance( calcScore contains 6 )
then
[...]
--------------------

Given the support for BigInteger & BigDecimal type comparison, and the 
structure of the 'contains' operator, I couldn't see why this wouldn't 
work.

If someone could explain this would be excellent - for now I'm gong ahead 
with the eval, but from a non-technical usability POV the latter form 
would be far preferable: I'd prefer that the users don't have to worry 
about eval or BigInteger, and while I realize it's not possible 
(currently) to eliminate that altogether, I would like to eliminate as 
many of the (to quote) "meaningless tech stuff" questions as possible.

Alternately if some kind person wants to tell me a better way of 
structuring that rule so I can use it as a template, then that'd be 
welcome also.

Unfortunately we're dealing with a feed from a 3rd party system so 
restructuring the data is not a desirable option.

Thank you for your time,
-Trav

Travis Smith
Analyst Programmer
Development Centre
BNZ


CAUTION - This message may contain privileged and confidential information 
intended only for the use of the addressee named above. If you are not the 
intended recipient of this message you are hereby notified that any use, 
dissemination, distribution or reproduction of this message is prohibited. 
This email was sent by the Bank of New Zealand. You can contact us on 
0800 ASK BNZ (0800 275 269). Any views expressed in this message are those 
of the individual sender and may not necessarily reflect the views of Bank 
of New Zealand.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110216/75ead83b/attachment.html 


More information about the rules-users mailing list