<br> Looks like bugs. The first one is probably in drools code, while the second one is on mvel.<br><br> Can you please open a jira for them?<br><br> Thanks,<br> Edson<br><br><div><span class="gmail_quote">2008/3/1, Andrey Grin <<a href="mailto:andrey.grin@gmail.com">andrey.grin@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;">
Hi,<br><br>I have two issues with float/double constants. In both cases dialect is set to MVEL<br><br>Issue 1<br><br>If
I use a comparison operator with the Double value it doesn't seem to
work correctly w/o brackets in the right part of the expression:<br>
<br>Example:<br>I have a condition like:<br>NumberVariable( owner == $a, name == "PTI", value > 0.5)<br><br>In the class NumberVariable the method getValue() is declared as follows:<br>
public Number getValue();<br><br>In
the working memory I have an instance with name == "PTI" and value ==
0.9633716684527102 ( actual type of the value is Double).<br><br>And the rule consequence is not executed.<br>
<br>If I change it and add brackets around the constant everything works correctly:<br><br>NumberVariable( owner == $a, name == "PTI", value > (0.5) )<br><br>There is similar example in drools documentation (w/o brackets):<br>
<pre>Cheese( type == "stilton", price < 10, age == "mature" )</pre>I
assume that in this example the property has a primitive type and in my
case autoboxing is involved, but why brackets are necessary in my case?<br>
<br><br>Issue 2<br><br>I have a rule:<br><br>rule "Determine min PRI for for PROD2" ruleflow-group "budget_calculated_variables<div>_appl"<br> when<br> $a: RetailApplication( )<br>
StringVariable(name=="prodid", value matches CONST.PROD2) <br>
then<br> insert(new NumberVariable("minPTI", 0.6, $a));<br>end<br><br>Initially I had only one constructor for NumberVariable:<br><br>public NumberVariable(String pName, Number pValue, Object pOwner)<br>
<br>But MVEL couldn't find this constructor when "then" part was executed (runtime exception).<br>The problem was solved when I added another constructor:<br><br>public NumberVariable(String pName, float pValue, Object pOwner)<br>
<br>Java compiler accepts identical code when only first constructor is there:<br><br>NumberVariable nv = new NumberVariable("minPTI", 0.6, null);<br><br>Drools version: 4.04, Java version: 1.6<br><br>Thanks,<br>
<span class="sg">
<font color="#888888">
Andrey.</font></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> JBoss Drools Core Development<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>