<br> Ronald,<br><br> Take a look at the class and it will be easy to understand:<br><br><a href="http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/BigDecimalFactory.java">
http://anonsvn.labs.jboss.com/labs/jbossrules/trunk/drools-core/src/main/java/org/drools/base/evaluators/BigDecimalFactory.java</a><br><br> != for big decimals is translated to<br><br>return ! val1.equals( val2 );<br><br>
In both cases, it is delegating to the object equals() method, that in case of BigDecimal, compare values, not references ( identity ).<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/7/9, Ronald R. DiFrango <
<a href="mailto:ron.difrango@gmail.com">ron.difrango@gmail.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On a similiar note what if you do:
<br><br>BigDecimal != 0<div><span class="e" id="q_113ac1fcb84c79b0_1"><br><br><div><span class="gmail_quote">On 7/9/07, <b class="gmail_sendername">Ronald R. DiFrango</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ron.difrango@gmail.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Thanks Edson!<br><br>Does the equals methods compare the underlying values or the object references?
<div><span><br><br><div><span class="gmail_quote">On 7/9/07, <b class="gmail_sendername">Edson Tirelli</b> <<a href="mailto:tirelli@post.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
tirelli@post.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Ronald,<br><br> Yes, this is one way (I would say probably the preferred way) of doing it.
<br> For BigDecimals, drools will use equals() method.<br><br> Look at the BigDecimalFactory class for details.<br><br> []s
<br> Edson<br><br><div><span class="gmail_quote">2007/7/9, Ronald R. DiFrango <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">ron.difrango@gmail.com</a>
>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><span>
OK, I think I found it and here is what the rule could look like:<span><br><br>rule "Repayment Code Requires Approval"<br> salience 60<br> <br> when<br> repaymentCode : RepaymentCode( code == "MD", matchApprv == "Y" )
<br></span> mdOutput : ModelDiscrepancyOutput( $amt1 : sumRTVQty, sumCmAndRnr == $amt1)<span><br> then <br> System.out.println("Repayment Code Requires Approval");<br> processMDAdjustments(
drools.getWorkingMemory
().getQueryResults( "MD Adjustments" ), StatusConstants.APPROVAL);<br> System.out.println("mdOutput: " + mdOutput);<br>end<br><br></span>Now my question is, how does Drools handle these objects and the comparison because the underlying objects are BigDecimal?
<div><span><br><br><div><span class="gmail_quote">On 7/9/07, <b class="gmail_sendername">Ronald R. DiFrango</b> <<a href="mailto:ron.difrango@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
ron.difrango@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
All,<br><br>I have the following rule:<br><br>rule "Repayment Code Requires Approval"<br> salience 60<br> <br> when<br> repaymentCode : RepaymentCode( code == "MD", matchApprv == "Y" )
<br> mdOutput : ModelDiscrepancyOutput( $amt1 : sumRTVQty, $amt2 : sumCmAndRnr)<br> eval($amt1.doubleValue() == $amt2.doubleValue())<br> then <br> System.out.println("Repayment Code Requires Approval");
<br> processMDAdjustments(drools.getWorkingMemory().getQueryResults( "MD Adjustments" ), StatusConstants.APPROVAL);<br> System.out.println("mdOutput: " + mdOutput);<br>end<br><br>If I remember correctly, there was going to be an update to the rules language that would allow me to eliminate the eval. Is this true and if so what is the syntax that accomplishes this?
<br><br><span name="st">Ron</span><br>
</blockquote></div><br>
</span></div><br></span></div>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
rules-users@lists.jboss.org
</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div>
<br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
www.jboss.com</a>
<br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">rules-users@lists.jboss.org
</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div><br>
</span></div></blockquote></div><br>
</span></div><br>_______________________________________________<br>rules-users mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org
</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="https://lists.jboss.org/mailman/listinfo/rules-users" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br><br></blockquote></div>
<br><br clear="all"><br>-- <br> Edson Tirelli<br> Software Engineer - JBoss Rules Core Developer<br> Office: +55 11 3529-6000<br> Mobile: +55 11 9287-5646<br> JBoss, a division of Red Hat @ <a href="http://www.jboss.com">
www.jboss.com</a>