<div>Mark,</div>
<div> </div>
<div>We might not be using 4.0 so soon. The business is still to make a decision on that. In these scenarios what is way out to effectively code such kind of a scenarios. </div>
<div> </div>
<div>If i make all my class attributes to be objects ( Double), then in the rule conditions i cannot use something like </div>
<div> </div>
<div>1. attrib * 1.5, because it fails saying * cannot be applied to Double and double</div>
<div>2. attrib.doubleValue() * 1.5 isnt working. Complains that doubleValue() is not defined in java.lang.Object. attrib has been declared as Double in my object. </div>
<div>3. I havent tried a full analysis, but calling a function which does this calculation cant be called from the other half of the predicate. If say attrib2 > multiply(attrib1.doubleValue(), 1.5). It complains of not being able to resolve "multiply".
</div>
<div> </div>
<div>I have specifically observed difficulty to work things for the part coming after a > or a< etc. THe work around which i tried is </div>
<div>emi: EMIObject ( businessProfit1 > (businessProfit2 * 1.5) ) - This wont work</div>
<div>i have another variable in EMIObject, whic is declared double bp = businessProfit2 * 1.5;</div>
<div>and then </div>
<div>emi: EMIObject ( businessProfit1 > bp ). This works, but i am forced to move some logic to the business object which should not be the case.</div>
<div> </div>
<div>Let me know if there is a better way! Or am i missing any basics over here?</div>
<div> </div>
<div>Any inputs are very useful.</div>
<div> </div>
<div>Thanks</div>
<div>Natraj<br><br> </div>
<div><span class="gmail_quote">On 7/18/07, <b class="gmail_sendername">Mark Proctor</b> <<a href="mailto:mproctor@codehaus.org">mproctor@codehaus.org</a>> wrote:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div text="#000000" bgcolor="#ffffff">I believe all your requests are in 4.0, give that a try. For 2.0.6 you'll have to unwrap<br>> (bpl.doubleValue() * 1.5 )<br><br>Mark<br>Natraj Gudla wrote:
<blockquote type="cite">
<div><span class="e" id="q_113d91d6c9d2b9c4_1">
<div>Hi All,</div>
<div> </div>
<div>I am using Drools 3.0.6 and unable to perform some simple form of multiplication. I want to compare an object field with another field multiplied by a factor.</div>
<div> </div>
<div><b><font color="#960000" size="2">
<p align="left">rule</p></font></b><font size="2"></font><font color="#008000" size="2">"<strong>Calculate</strong> Business profit,1"<br></font><font color="#960000" size="2"><strong>when<br><br></strong></font>
<font size="2"><strong>EMIAgainstProperty</strong> ( bp1 : businessProfit1 )<br>emi : <strong>EMIAgainstProperty</strong> ( businessProfit2 > <strong>(bp1*1.5)</strong> ) </font><b><font color="#960000" size="2">then<br>
</font></b><font size="2">emi.setBusinessProfit((emi.getBusinessProfit1()+emi.getBusinessProfit2())/2);<strong><br></strong></font><b><font color="#960000" size="2">end</font></b>
<p align="left"><font color="#960000" size="2"><font color="#330000">I get an error on creation of the package that * is undefined for Double and double. I understand this is because Drools does an auto box on primitive type variables. But is there a work around to do simpler comparisons like this, especially on the right hand side of the condition. some thing like [ variable * constantValue ].
</font></font></p>
<p align="left"><font color="#960000" size="2"><font color="#330000">Also, i am forced to do a declaration for businessProfit1, and use in the comparison below. I am not able to compare two fields of the same object directly.
</font></font></p>
<p align="left"><font color="#960000" size="2"><font color="#330000">some thing like businessProfit2 > businessProfit1 does not work, why is this so? Any one has faced these problems earlier?</font></font></p>
<p align="left"><font color="#960000" size="2"><font color="#330000">Thanks<br></font></font><font color="#960000" size="2"><font color="#330000">Natraj </font></font></p></div></span></div><pre><hr width="90%" size="4">
<span class="q">
_______________________________________________
rules-users mailing list
<a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:rules-users@lists.jboss.org" target="_blank">rules-users@lists.jboss.org</a>
<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>
</span></pre></blockquote><br> </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>