Hi,
Let's say I have this class wich instances will be added to a Rete engine :

public class A {
    public int getI() {        return i;    }
    public List<B> getBs() {        return Collections.unmodifiableList(bs);    
}
    private int i;    private List<B> bs;
    A(int i) {        this.i = i;        this.bs = new ArrayList<B>(bs);        
bs.add(1);        bs.add(2);        bs.add(3);    }
    public void change(int p) {        bs.add(new B(p));    }
}
And the following .clp file :
(defclass A xxx.yyy.zzz.A)
(defrule rule1  (A (i ?i) (bs ?bs))=>  (printout t "i:" ?i crlf)  )
(reset)
and the following test code :

 Rete r = new Rete(); try {       r.batch(".../TestJess.clp");       A a = new 
A(5);
       r.add(a);       r.run();
       a.change();
       r.updateObject(a);       r.run();     } catch (JessException e) {        
  e.printStackTrace();     }
The rule will fire twice, once with i=5 and once with i=6. However, if I 
comment the line where i is modified in the changemethod, the rule will only 
fire once, because even if the list is "modified", the value of bs is unchanged.

If the desired behavior is to have the rule firing twice, is there a way to 
have it ?
In fact, I know that I can add the list itself in the engine and match it in 
the LHS, but I would prefer to avoid that.

Thanks.



                                          
_________________________________________________________________
Accès direct à Messenger depuis votre téléphone 
http://go.microsoft.com/?linkid=9712962

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [email protected]'
in the BODY of a message to [email protected], NOT to the list
(use your own address!) List problems? Notify [email protected].
--------------------------------------------------------------------

Reply via email to