<br><font size=2 face="sans-serif">Thank you Wolfgang, that works brilliantly.</font>
<br>
<br><font size=2 face="sans-serif">I appreciate your thoughts on Parameters
and will be doing something along that line as that looks cleaner again
- I hadn't gotten up to eliminating magic numbers yet.</font>
<br>
<br><font size=2 face="sans-serif">Regards,</font>
<br><font size=2 face="sans-serif">-Trav<br>
<br>
</font><font size=1 face="Arial"><b>Travis Smith</b><br>
Analyst Programmer<br>
Development Centre<br>
BNZ<br>
<br>
DDI: +644 4746356 (Or Ext 76356)</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td>
<br><font size=1 color=#800080 face="Arial"><b>Wolfgang Laun &lt;wolfgang.laun@gmail.com&gt;</b></font>
<br><font size=1 color=#800080 face="sans-serif">Sent by: </font><font size=1 color=#800080 face="sans-serif">rules-users-bounces@lists.jboss.org</font>
<p><font size=1 face="sans-serif">17/02/2011 05:44 a.m.</font>
<br><font size=1 face="sans-serif">Please respond to<br>
Rules Users List &lt;rules-users@lists.jboss.org&gt;</font>
<td>
<td>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif">Rules Users List &lt;rules-users@lists.jboss.org&gt;</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">Re: [rules-users] using &quot;contains&quot;
against a List&lt;BigInteger&gt;</font></table>
<br></table>
<br>
<br>
<br>
<br><tt><font size=2>It's Java, after all...<br>
<br>
The &quot;contains&quot; operator requires a Collection (or array) and
an<br>
Object. A plain numeric literal won't result in a BigInteger without<br>
you providing a hint.<br>
<br>
You can write<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$performance : Performance( calcScore contains
(BigInteger.valueOf(6)) )<br>
or<br>
 &nbsp; &nbsp;dialect &quot;mvel&quot;<br>
 &nbsp; &nbsp;when<br>
 &nbsp; &nbsp; &nbsp; &nbsp;$performance : Performance( calcScore contains
(6I) ) &nbsp; # capital &quot;i&quot;<br>
<br>
All of these (and your eval) use magic numbers, so my preferred way of<br>
dealing with this would be s.th. like this, using a singleton<br>
Parameter fact for this and other values:<br>
<br>
 &nbsp; when<br>
 &nbsp; &nbsp; &nbsp; Parameter( $bis: bigIntSix )<br>
 &nbsp; &nbsp; &nbsp; $performance : Performance( calcScore contains $bis
)<br>
<br>
-W<br>
<br>
<br>
2011/2/16 &nbsp;&lt;Travis_Smith@bnz.co.nz&gt;:<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; A newbie question I'm afraid. I've been unsuccessful searching the<br>
&gt; mailing-list archive (and google) for this.<br>
&gt;<br>
&gt; I'm trying to simplify rule-writing for Statistical Analysts to be
able to<br>
&gt; write rules. I'm hoping to achieve this without resort to DSLR files
and a<br>
&gt; DSL if possible as we currently need them for nothing else<br>
&gt;<br>
&gt; One of the situations I have is the following:<br>
&gt; --------------------<br>
&gt; when<br>
&gt; $performance : Performance(<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; eval(calcScore.contains(BigInteger.valueOf(6)))<br>
&gt; )<br>
&gt; then<br>
&gt; [...]<br>
&gt; --------------------<br>
&gt;<br>
&gt; That works absolutely fine: CustAccPerf being a having several members,<br>
&gt; including an ArrayList&lt;BigInteger&gt; called calcScore<br>
&gt;<br>
&gt; Howwever I'd like to rewrite it like:<br>
&gt; --------------------<br>
&gt; when<br>
&gt;<br>
&gt; $performance : Performance( calcScore contains 6 )<br>
&gt; then<br>
&gt; [...]<br>
&gt; --------------------<br>
&gt;<br>
&gt; Given the support for BigInteger &amp; BigDecimal type comparison,
and the<br>
&gt; structure of the 'contains' operator, I couldn't see why this wouldn't
work.<br>
&gt;<br>
&gt; If someone could explain this would be excellent - for now I'm gong
ahead<br>
&gt; with the eval, but from a non-technical usability POV the latter form
would<br>
&gt; be far preferable: I'd prefer that the users don't have to worry about
eval<br>
&gt; or BigInteger, and while I realize it's not possible (currently) to<br>
&gt; eliminate that altogether, I would like to eliminate as many of the
(to<br>
&gt; quote) &quot;meaningless tech stuff&quot; questions as possible.<br>
&gt;<br>
&gt; Alternately if some kind person wants to tell me a better way of structuring<br>
&gt; that rule so I can use it as a template, then that'd be welcome also.<br>
&gt;<br>
&gt; Unfortunately we're dealing with a feed from a 3rd party system so<br>
&gt; restructuring the data is not a desirable option.<br>
&gt;<br>
&gt; Thank you for your time,<br>
&gt; -Trav<br>
&gt;<br>
&gt; Travis Smith<br>
&gt; Analyst Programmer<br>
&gt; Development Centre<br>
&gt; BNZ<br>
&gt;<br>
&gt; CAUTION - This message may contain privileged and confidential information<br>
&gt; intended only for the use of the addressee named above. If you are
not the<br>
&gt; intended recipient of this message you are hereby notified that any
use,<br>
&gt; dissemination, distribution or reproduction of this message is prohibited.<br>
&gt; This email was sent by the Bank of New Zealand. You can contact us
on<br>
&gt; 0800 ASK BNZ (0800 275 269). Any views expressed in this message are
those<br>
&gt; of the individual sender and may not necessarily reflect the views
of Bank<br>
&gt; of New Zealand.<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; rules-users mailing list<br>
&gt; rules-users@lists.jboss.org<br>
&gt; https://lists.jboss.org/mailman/listinfo/rules-users<br>
&gt;<br>
&gt;<br>
<br>
_______________________________________________<br>
rules-users mailing list<br>
rules-users@lists.jboss.org<br>
https://lists.jboss.org/mailman/listinfo/rules-users<br>
</font></tt>
<br><pre>
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.
</pre>