[rules-users] forall not delivering as expected

Wolfgang Laun wolfgang.laun at gmail.com
Sun Sep 12 13:45:38 EDT 2010


Given classes
   class Triangle { int a, b, c;... }
   class Quadrangle { int a, b, c, d;... }
with appropriate getters (but no hashCode or equals) and these facts
   Triangle( 3, 3, 3 )
   Triangle( 3, 3, 3 )  // a duplicate, intentional
   Quadrangle ( 3, 4, 5, 6 );
the rule
   rule "all equilaterals have a 'fitting' quadrangle"
   when
      forall( Triangle( $a: a, b == $a, c == $a )
         Quadrangle( a == $a || b == $a || c == $a || d == $a ) )
   then // ...
   end
works as expected - it fires.

But the rule
   rule "all equilaterals have a duplicate"
   when
      forall( $t: Triangle( $a: a, b == $a, c == $a )
         Triangle( this != $t, a == $a, b == $a , c == $a ) )
   then // ...
   end
does not fire, not even when I omit this != $t. Why?

Do I have a white spot in my grey cells? Please tint my taint...

-W
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20100912/cfc7cdc9/attachment.html 


More information about the rules-users mailing list