<br> Brian,<br><br> Maybe you have equals() method implemented in the class? "==" will call equals() method on the objects...<br> I assume you are using 4.0.1 or later (snapshot).<br><br> []s<br> Edson
<br><br><div><span class="gmail_quote">2007/9/25, Brian Enderle <<a href="mailto:brianke@gmail.com">brianke@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;">
I have 3 Rfrnc objects that I would like to compare and return a message if<br>the firstNm, middleNm and lastNm of two objects match. I set up the Rfrnc<br>objects with the names "Brian A Enderle", "Brian B Enderle" and "Brian C
<br>Enderle" and created the following rule (with the intent of building up to<br>checking first, middle and last name).<br><br>rule "LevelTwo: Duplicate Reference check"<br> agenda-group "LevelTwo"
<br> when<br> $i : Rfrnc($firstNm : firstNm, $middleNm : middleNm, $lastNm :<br>lastNm)<br> $j : Rfrnc(this != $i, firstNm == $firstNm)<br> then<br> System.out.println
("Duplicate refernce found: " +<br>$i.getMiddleNm() + $i.getLastNm() + ":" + $j.getMiddleNm() + $j.getLastNm());<br>end<br><br>This produces the following output (which is what I would expect):<br>Duplicate refernce found: CEnderle:BEnderle
<br>Duplicate refernce found: BEnderle:CEnderle<br>Duplicate refernce found: CEnderle:AEnderle<br>Duplicate refernce found: AEnderle:CEnderle<br>Duplicate refernce found: AEnderle:BEnderle<br>Duplicate refernce found: BEnderle:AEnderle
<br><br>While doing some testing I changed "Brian B Enderle" to "Brian A Enderle" so<br>that now I have two Rfrnc objects with the name of "Brian A Enderle". When I<br>rerun the same rule from above I get the following output:
<br><br>Duplicate refernce found: CEnderle:AEnderle<br>Duplicate refernce found: AEnderle:CEnderle<br>Duplicate refernce found: AEnderle:CEnderle<br>Duplicate refernce found: CEnderle:AEnderle<br><br>What I don't understand is why do I not have any return statements
<br>of "Duplicate reference found AEnderle:AEnderle". I would expect 2 of these<br>messages, one for when the first "Brian A Enderle" object is compared to the<br>second and vice versa.<br><br>Is the "$i == this" condition checking values within the object itself? Am I
<br>missing something here as to how this rule should work?<br><br>Thanks in advance,<br>Brian Enderle<br><br>_______________________________________________<br>rules-users mailing list<br><a href="mailto:rules-users@lists.jboss.org">
rules-users@lists.jboss.org</a><br><a href="https://lists.jboss.org/mailman/listinfo/rules-users">https://lists.jboss.org/mailman/listinfo/rules-users</a><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>