I am not sure I understand your problem. The rule clearly should NOT match facts with value 0, as it will raise division by zero error all the time. So, the solution, in my mind is:<div><br></div><div>rule &quot;r1&quot;<br>
    when<br>        p : CTestObj( value != 0 )<br>    then<br>        p.setValue( 1 / p.getValue() );<br>end<br><br></div><div>   If you need to give a different treatment to objects with value == 0, just add another rule for them.</div>
<div><br></div><div>   []s</div><div>   Edson</div><div><br></div><div><br><div class="gmail_quote">2010/8/31 tom ska <span dir="ltr">&lt;<a href="mailto:tiberium.linux@gmail.com">tiberium.linux@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br>I have a class and rule:<br><br>class CTestObj<br>{<br>        private double value;<br><br>        void setValue(double v) {<br>
                this.value = v;<br>        }<br><br>        double getValue() {<br>
                return this.value;<br>        }<br>}<br><br>rule &quot;r1&quot;<br>    when<br>        p : CTestObj<br>    then<br>        p.setValue( 1 / p.getValue() );<br>end<br><br>As you can see, in this rule, there is risk, to put into stateFulSession object with value set 0. I can&#39;t validate this, because, this problem has a variation where I put into stateFulSession object with set no 0, but the rule will modify it...<br>

So - I can&#39;t validate this = fact with value 0 is correct.<br><br>But I process with stateFulSession many, many facts... For example 1000. And, after 900 facts it occurs, that fact number 901 has value set on 0. In effect I get an exception:  org.drools.runtime.rule.ConsequenceException: java.lang.ArithmeticException: / by zero. And ksession stops processing facts. But, 900 facts are processed! I don&#39;t want to process them second time.<br>

And this is my question:<br><br>How can I know, which fact is first no-processed fact? Which one stoped fireAllRules method?<br>Beacuse I don&#39;t want to process them another time.<br><br>Greetings :)<br><font color="#888888">tom.<br>
<br><br>
<br><br>
</font><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>
<br></blockquote></div><br><br clear="all"><br>-- <br>  Edson Tirelli<br>  JBoss Drools Core Development<br>  JBoss by Red Hat @ <a href="http://www.jboss.com">www.jboss.com</a><br>
</div>