<br> Sikkandar,<br><br> In 3.0.6, if you have 2 strings in the working memory ("a" and "b" ) and you write:<br><br>rule "cross product"<br>when<br> $s1: String()<br> $s2: String()<br>
then<br> System.out.println("[ "+$s1+", "+$s2+" ]");<br>end<br><br> The result MUST be:<br><br>[ a, b ]<br>[ b, a ]<br><br> If it is not that, then we have a bug, but our integration tests that test this specific situation are working fine. Plz let us know if it is different for you.
<br> In 4.0, the result must be:<br><br>[ a, b ]<br>
[ b, a ]<br>[ a, a ]<br>[ b, b ]<br><br> So a fact (by default) may match multiple simultaneous patterns.<br> <br> Regarding your second question, comparing properties of the same object is also something we added for
4.0. In 3.0.x you need eval() too.<br><br> []s<br> Edson<br><br><div><span class="gmail_quote">2007/5/19, Sikkandar Nawabjan <<a href="mailto:Sikkandar.Nawabjan@ustri.com">Sikkandar.Nawabjan@ustri.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>
<div><font color="#000000" face="Arial" size="2">Hi
,</font></div>
<div><font face="Arial" size="2">The very reason i used to compare two object
reference is that i got then executed multiple time when i do duplicate check
between object properties. so i beleive the pattern match happen more than a
time</font></div>
<div><font face="Arial" size="2">for example</font></div>
<div><font face="Arial" size="2"> when<br>
$obj1:object($code:code,$stdate:startdate);<br>
$obj2:object(code==$code,startdate=$stdate);<br> then</font></div>
<div><font face="Arial" size="2">if(obj1!=obj2)<br>
System.out.println("Fired");</font></div>
<p><font face="Arial" size="2">My questions are </font></p>
<p><font face="Arial" size="2">1) In 3.0.6 is there any other way to avoid this
multiple check other than using eval(which affects performance i beleive). i
can't use this operator in 3.0.6</font></p>
<p><font face="Arial" size="2">2) related to this i have one more query. how to
check properties within the object itself</font></p>
<p><font face="Arial" size="2">for example i want to do</font></p>
<div><font face="Arial" size="2"> when<br>
$obj1:object($code:code,$stdate:startdate,$enddate:enddate > $stdate,
reasoncode == $code);<br> then</font></div>
<div><font face="Arial" size="2">
System.out.println("Fired");</font></div>
<div><font face="Arial" size="2">i beleive the above throws error in 3.0.6
(nullpointer related to alpha node)</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Earlier reply is highly appreciated</font></div>
<div><font face="Arial" size="2"></font> </div>
<div><font face="Arial" size="2">Thanks and Regs,</font></div>
<div><font face="Arial" size="2">Bassha</font></div>
<p><font face="Arial" size="2"></font> </p>
<p><font face="Arial" size="2"></font> </p>
<div><br></div>
<div><font color="#000000" face="Arial" size="2"></font> </div>
<div><font color="#000000" face="Arial" size="2"></font> </div>
<div><font color="#000000" face="Arial" size="2"></font> </div>
<div><font color="#000000" face="Arial" size="2"></font> </div>
<div><font color="#000000" face="Arial" size="2"></font> </div>
<div><font color="#000000" face="Arial" size="2"></font> </div>
<div><font color="#000000" face="Arial" size="2">----------------------------------------------------------------------<br><br>Message:
1<br>Date: Fri, 18 May 2007 09:51:34 -0300<br>From: "Edson Tirelli"
<<a href="mailto:tirelli@post.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">tirelli@post.com</a>><br>Subject: Re: [rules-users] how to check
reference<br>To: "Rules Users List"
<<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>Message-ID:<br>
<<a href="mailto:e6dd5ba30705180551y6562b7f6oe5ea173379ebb4c8@mail.gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">e6dd5ba30705180551y6562b7f6oe5ea173379ebb4c8@mail.gmail.com</a>><br>
Content-Type:
text/plain; charset="iso-8859-1"<br><br> Yes, in 3.0.6 you will need
eval. But also it is important to remember<br>that by default, in 3.0.6, an
object will never match more than one pattern.<br>So in the given example, ob1
and ob2 will always be different and the check<br>is not needed.<br>
In 4.0, things are a bit different, as by default a single object may<br>match
more than one pattern at once and we introduced the "this" keyword to<br>check
for object identity.<br><br> []s<br>
Edson<br><br><br>2007/5/18, Chris Woodrow
<<a href="mailto:woodrow.chris@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">woodrow.chris@gmail.com</a>>:<br>><br>> Hi,<br>> You can use
eval();<br>><br>> when<br>>
$obj1:object();<br>>
$obj2:object();<br>> eval ($obj1!=$obj2);<br>>
then<br>>
System.out.println("Fired");<br>><br>> Hope this helps<br>>
Chris<br></font></div></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>