I think Gilman, John C wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I have created a DimmerSwitch bean as defined in Jess in action. I have added the
> firePropertyChange method to the setBrightness method. I then executed the
> following code:
>
> engine.defclass("dimmer","DimmerSwitch",null);
> engine.definstance("dimmer",dimmer,true,engine.getGlobalContext());
> engine.executeCommand("(bind ?ds dimmer)");
Here you've set the value of the variable ?ds to the symbol 'dimmer',
which is certainly not what you want. If you want to refer, in Jess
code, to the object contained in the Java variable "dimmer", you have
to make it available, somehow, to Jess. One way is by using
store/fetch, as described in section 18.1.2 on pages 308-309. It would
look something like
engine.store("MYDIMMER", dimmer);
engine.executeCommand("(bind ?ds (fetch MYDIMMER))");
Another way would be to use the methods of jess.Context directly; for
example, you could replace both lines above with
engine.getGlobalContext().setVariable("ds", new Value(dimmer));
---------------------------------------------------------
Ernest Friedman-Hill
Science and Engineering PSEs 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]
--------------------------------------------------------------------