Details
-
Bug
-
Resolution: Done
-
Major
-
3.1-m1
-
None
-
None
Description
If you have two rules:
rule "A"
when
$a : ArrayList( size:size == 2 ) from collect (Car())
then
System.out.println("A: size = " + size);
end
rule "B"
when
$b : ArrayList( size:size == 3 ) from collect (Car())
then
System.out.println("B: size = " + size);
end
And you put two Cars in working memory, both A and B will be fired. Since there are two cars in working memory, only rule A should be fired.
If you change the order of the rules, or make rule A match size == 3 and rule B match size == 2, no rules will be fired instead.
The only workaround found is to add some criteria for the Car, in ONE of the rules. If rule A for example is:
rule "A"
when
$a : ArrayList( size:size == 2 ) from collect (Car(color == "RED"))
then
System.out.println("A: size = " + size);
end
Then only rule A will be fired. If the same criteria is also added in rule B, both rules will be fired again.