Sikkandar,
In 3.0.6, if you have 2 strings in the working memory ("a" and "b"
) and
you write:
rule "cross product"
when
$s1: String()
$s2: String()
then
System.out.println("[ "+$s1+", "+$s2+" ]");
end
The result MUST be:
[ a, b ]
[ b, a ]
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.
In 4.0, the result must be:
[ a, b ]
[ b, a ]
[ a, a ]
[ b, b ]
So a fact (by default) may match multiple simultaneous patterns.
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.
[]s
Edson
2007/5/19, Sikkandar Nawabjan <Sikkandar.Nawabjan(a)ustri.com>:
Hi ,
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
for example
when
$obj1:object($code:code,$stdate:startdate);
$obj2:object(code==$code,startdate=$stdate);
then
if(obj1!=obj2)
System.out.println("Fired");
My questions are
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
2) related to this i have one more query. how to check properties within
the object itself
for example i want to do
when
$obj1:object($code:code,$stdate:startdate,$enddate:enddate > $stdate,
reasoncode == $code);
then
System.out.println("Fired");
i beleive the above throws error in 3.0.6 (nullpointer related to alpha
node)
Earlier reply is highly appreciated
Thanks and Regs,
Bassha
----------------------------------------------------------------------
Message: 1
Date: Fri, 18 May 2007 09:51:34 -0300
From: "Edson Tirelli" <tirelli(a)post.com>
Subject: Re: [rules-users] how to check reference
To: "Rules Users List" <rules-users(a)lists.jboss.org>
Message-ID:
<e6dd5ba30705180551y6562b7f6oe5ea173379ebb4c8(a)mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"
Yes, in 3.0.6 you will need eval. But also it is important to remember
that by default, in 3.0.6, an object will never match more than one
pattern.
So in the given example, ob1 and ob2 will always be different and the
check
is not needed.
In 4.0, things are a bit different, as by default a single object may
match more than one pattern at once and we introduced the "this" keyword
to
check for object identity.
[]s
Edson
2007/5/18, Chris Woodrow <woodrow.chris(a)gmail.com>:
>
> Hi,
> You can use eval();
>
> when
> $obj1:object();
> $obj2:object();
> eval ($obj1!=$obj2);
> then
> System.out.println("Fired");
>
> Hope this helps
> Chris
_______________________________________________
rules-users mailing list
rules-users(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users
--
Edson Tirelli
Software Engineer - JBoss Rules Core Developer
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @
www.jboss.com