I think Young-Jin Lee wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I am new to JESS and I got two questions when I read through Pump examples.
>
> First of all, according to the JESS manual, "dynamic" should be declared on creation
>of JavaBeans object, if the definstance facts stay up-to-date. However, there is no
>"dynamic" in the pumps.clp at all. The only possible explanation would be that
>"dynamic" feature is a default behavior. Is it true?
Yes, as stated in the documentation for "definstance" in manual
section 8.40 (6.1b1 manual.)
>
> Second, this question is about how to make a JavaBean support
>PropertyChangeListener. The Pump and Tank java classes first define
>PropertyChangeSupport data member and then implement addPropertyChangeListener() and
>removePropertyChangeListener() methods. There is no code adding the existing
>knowledge base to these JavaBeans. I guess that (definstance tank (bind ?tank (new
>Tank "MAIN"))) construct do all these works behind scenes. Is it a correct
>understanding?
>
Yes, as stated in the same place in the manual, reproduced here:
8.40. (definstance <tag> <Java object> [static | dynamic] )
Package:
ReflectFunctions
Arguments:
An atom, a Java object, and (optionally) one of the atoms static
or dynamic.
Returns:
The fact-id of the new shadow fact.
Description:
Creates a "shadow fact" representing the given Java object,
according to the named template (which should have come from
defclass.) If the atom static is not supplied as the optional third
argument, a PropertyChangeListener is installed in the given object,
so that Jess can keep the shadow fact updated if the object's
properties change.
Note that it is an error for a given Java object to be installed
in more than one definstance at a time. The second and subsequent
definstance calls for a given object will return a fact-id with value
-1.
---------------------------------------------------------
Ernest Friedman-Hill
Distributed Systems Research Phone: (925) 294-2154
Sandia National Labs FAX: (925) 294-2234
PO Box 969, MS 9012 [EMAIL PROTECTED]
Livermore, CA 94550 http://herzberg.ca.sandia.gov
--------------------------------------------------------------------
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]
--------------------------------------------------------------------