Well, one problem is that sometimes Beans are to be registered under a
defclass that was not generated from their specific type, or the
defclass they should use was defined to use inheritance. In both
cases, the definstance statement provides the necessary association
between the defclass and the Bean.

Another problem is that when you call call addPropertyListener() on
the Bean, the Listener is not notified until the first
PropertyChangeEvent comes in. This means that Jess wouldn't contain a
fact to represent the Bean until some property changed, and if none
ever do, the Bean would never appear on the fact list. One additional
side effect of this is that undefinstance wouldn't work until after
the first property change had occurred.

Both of these together show pretty clearly that Jess needs to be told
about the Bean, rather than simply having the Bean told about Jess.

It does take a half-dozen lines of code to definstance a Bean,
however, and this can certainly interrupt the flow of your Java
code. What I would suggest would be to put these half-a-dozen lines
into a utility method, which you can then call as

  JessUtils.definstance("my-defclass", myBean, theEngine);


I think Javier Maria Torres Ramon wrote:
> Hi everyone,
> 
> I wanted to propose a minor change in JESS interface that might help
> in Java programming. As far as I know, JavaBeans are defined into the
> Rete object via the definstance command, which may be available from the
> Java part as a Funcall. I was wondering if it would be both easy and useful
> to define some object (Rete or a property of Rete) as a PropertyChangeListener
> stright ahead, so the need for definstance would be hidden from the Java
> programmer and he/she would only need to register the Rete as another Listener.
> Maybe the list of objects being stored in JESS can be watched everytime
> a Change is fired, and the Object firing the Event can be dynamically
> definstance (even though I realize this would surely bring a lower performance).I 
>would appreciate any views and opinions on this idea.
> 
> Thanx and greetings,
> 
> Javier Torres




---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [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 (use your own address!) List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to