[rules-users] Problem with class Variable

Mehdi mehdi_amini2000 at yahoo.com
Mon Nov 26 12:12:00 EST 2007


hi,

I have a class Customer.java with class variable "allTradeAmounts" and

I have two rules as follows:

rule "rule 1"
    when
        $c : Customer();
    then 
             
        $c.setAllTradeAmounts($c.getAllTradeAmounts().add(1000));   
       System.out.println("after modify: "+$c.getAllTradeAmounts());
end

rule "rule 2"
    when
        $c : Customer(allTradeAmounts < 200 );
    then
        System.out.println("AllTradeAmounts < 200 ");

end

The rule 1 works fine and changes the value of this variable.
My question is, although the rule 1 has changed the class variable and I can see the result of changed variable EACH TIME, when i insert a Customer object, why is the second rule TRUE? I have changed the value of AllTradeAmounts and I can print it in RHS and it is more than 200, but in LHS if I check with "allTradeAmounts < 200 " ,it is true.
It must be FALSE and does not fire the rule.
can someone help me? what do I do wrong in LHS.
In the same rule (rule 2) if I print the allTradeAmounts it is more than 200.
sorry it is a simple question, but I m new to drools.
Thanks and regards  
       
---------------------------------
Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try it now.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20071126/ccf7bf71/attachment.html 


More information about the rules-users mailing list