<br><br><div class="gmail_quote">On 4 January 2011 11:15, Gabor Szokoli <span dir="ltr">&lt;<a href="mailto:szocske@gmail.com">szocske@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br>
<br>
Purely for educational purposes I am trying to figure out how this<br>
will work when multiple Sale instances share the same &quot;type&quot; string.<br>
<br>
It seems to me that under the default &quot;identity&quot; assertion mode of the<br>
Working Memory, as many SaleType instances would be maintained as<br>
there are unexpired Sale events. In the degenerate case of all n Sale<br>
instances sharing the same type string, rules that bind a SaleType<br>
variable on their LHS should fire n times more than expected.<br></blockquote><div><br>This is n - 1 times :-)<br> <br>The fix is simple:<br><br>when<br>
     Sale( $type : type )<br>     not SaleType( type == $type )<br>then<br>
     insertLogical( new SaleType( $type ) );<br><br>-W<br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Am I missing something?<br>
<br>
On the other hand &quot;declare&quot; creates a constructor with parameters? Neat!<br>
<br>
On Mon, Jan 3, 2011 at 4:28 PM, Edson Tirelli &lt;<a href="mailto:ed.tirelli@gmail.com">ed.tirelli@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; declare SaleType<br>
&gt;    type : String<br>
&gt; end<br>
&gt;<br>
&gt; rule &quot;register types&quot;<br>
&gt; when<br>
&gt;     Sale( $type : type )<br>
&gt; then<br>
&gt;     insertLogical( new SaleType( $type ) );<br>
&gt; end<br>
&gt;<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" target="_blank">https://lists.jboss.org/mailman/listinfo/rules-users</a><br>
</blockquote></div><br>