Edson,
am getting the following output
[ b, a ]
[ a, b ]
only the order of the output is different. so if i check a equal to b according
to the cross product law the then part execute 2 times?
thats y i check the reference in the then part.
how to use eval to variable comparison of objects in a single line
Thanks and regs,
Basha
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Message: 3
Date: Sat, 19 May 2007 09:53:29 -0300
From: "Edson Tirelli" <[EMAIL PROTECTED]>
Subject: Re: [rules-users] [rule-users]how to create object properties
in single stmnt
To: "Rules Users List" <[email protected]>
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"
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 <[EMAIL PROTECTED]>:
>
> 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
>
>
_______________________________________________
rules-users mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/rules-users