Hi Miroslav,

I don't see this happening (nor do I see how it could.) Maybe there is
something strange about how your PropertyChangeListener stuff is being
done? Remember that the correct way is for the notification to contain
both the old and new values, and for the property to contain the new
value when the notification is sent:

  public void setIndex(int  v)
  {
    int tmp = m_index;
    m_index = v;

    pcs.firePropertyChange("index", new Integer(tmp),
                           new Integer(m_index));    
  }

Note that if you send 'null' for the proeprty name, Jess will have to
read all of the beans properties, and if perhaps your setter methods
aren't really changing the Bean's values, this would explain your
observation. 

If you still think there's a bug here, you could send me (not on the
list) a -complete- example (including all Jess and Java code) that
displays this problem.


I think [EMAIL PROTECTED] wrote:
> 
> 
> 
> Hi Ernest,
> Here is the latest Jess misbehaviour I found. It is also
> related to Java Bean properties, specifically to "modify" function.
> I use simplified example:
> 
> 
> ---------------------------------------------
> 
> (defclass fact example.JavaBean)
> (definstance fact (new example.JavaBean))
> 
> (defrule r1
>   ?f1 <- (groups $?g price ?p)
>   ?f2 <- (fact)
>   =>
>   (retract ?f1)
>   (modify ?f2 (groups $?g) (price ?p)))
> 
> (defrule r2
>   ?f1 <- (index ?i)
>   ?f2 <- (fact)
>   (not (groups $?))
>   =>
>   (retract ?f1)
>   (modify ?f2 (index ?i)))
> 
> (assert (groups 1 2 price 12.34))
> (assert (index 1))
> 
> Initial fact list:
> 
> (fact (groups ) (index 0) (price 0.0))
> (groups 1 2 price 12.34)
> (index 1)
> 
> Note:
> I use zero length array initialization for multislot
> "groups".
> 
> 
> After firing rule r1 (modifies "groups" and "price"):
> 
> (index 1)
> (fact (groups 1 2) (index 0) (price 12.34))
> 
> After firing rule r2 (modifies "index"):
> 
> (fact (groups ) (index 1) (price 0.0))
> 
> ----------------------------------------------------
> 
> It seems that "modify" function has a side effect of setting
> certain already modified slots/multislots back to their
> initial values. These slot/multislots are the ones not listed
> as parameters to "modify".
> 
> I tried to go back to Jess 4.3 but the effect is the same as
> in Jess 5.0a3.
> 
> Thanks in advance.
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9214                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to