Ah, okay. I was just wondering what to do. I worked around this by
transforming the code to:
// HSH Mod - do not clear event mask after sending clear event.
// To ensure that CLEAR handlers are called, we use JessEvent.CLEAR
// as the proxy for no events. If there are no handlers for CLEAR
// then no harm is done as this is a low frequency event.
setEventMask(JessEvent.CLEAR);
broadcastEvent(JessEvent.CLEAR, this, null);
I'm not sure how the event handlers will ever work if clear() is called with
the code the other way... With the above fix, things should still work fine
with the slight addition of a possibly unneeded check to handle any non
listeners when clear() is called again.
On 9/28/07 10:47 AM, "Ernest Friedman-Hill" <[EMAIL PROTECTED]> wrote:
>
> On Sep 28, 2007, at 12:32 PM, Hal Hildebrand wrote:
>
>> Can anyone answer as to whether this is a bug, or that I have to
>> modify my
>> code in some way as to set the event mask such that my handler is
>> called
>> after clear().
>>
>> Just wondering what I should be doing.
>
>
> In the past we've called it a low-priority bug, but we never decided
> if it's a documentation bug or a code bug. One workaround could be to
> subclass jess.Rete and override clear() to store and restore the
> event mask (there's a Rete.listJessListeners() method you could use
> to restore the event listeners, too).
>
>
>>
>>
>> On 9/26/07 3:08 PM, "Hal Hildebrand" <[EMAIL PROTECTED]>
>> wrote:
>>
>>> In the doc, it says to use the JessEvent.CLEAR to re-set up your
>>> event mask
>>> on the engine (section 10.11 in the 7.0p1 manual).
>>>
>>> "One added wrinkle: note how the handler for JessEvent.CLEAR sets
>>> the event
>>> mask. When (clear) is called, the event mask is typically reset to
>>> the
>>> default. When event handlers are called, they have the opportunity
>>> to alter
>>> the mask to re-install themselves. Alternatively, they can call
>>> removeJessListener() to unregister themselves."
>>>
>>> The example shown is:
>>>
>>> case JessEvent.CLEAR:
>>> Rete engine = (Rete) je.getSource();
>>> int mask = engine.getEventMask();
>>> mask |= defaultMask;
>>> engine.setEventMask(mask);
>>> // MyGUI.clearDisplay(
>>> break;
>>>
>>> What I found out is in the Rete.clear() method:
>>>
>>> broadcastEvent(JessEvent.CLEAR, this, null);
>>> setEventMask(0);
>>>
>>> So, whatever handlers are doing when handling CLEAR, the event
>>> mask is going
>>> to be zero'd out after they set it.
>>>
>>> Is this a bug, or is there another mechanism that I can use to
>>> reset the
>>> event mask when the Rete is clear'd?
>>>
>>>
>>> --------------------------------------------------------------------
>>> 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 owner-jess-
>>> [EMAIL PROTECTED]
>>> --------------------------------------------------------------------
>>>
>>
>>
>> --------------------------------------------------------------------
>> 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 owner-jess-
>> [EMAIL PROTECTED]
>> --------------------------------------------------------------------
>
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Advanced Software Research Phone: (925) 294-2154
> Sandia National Labs FAX: (925) 294-2234
> PO Box 969, MS 9012 [EMAIL PROTECTED]
> Livermore, CA 94550 http://www.jessrules.com
>
> --------------------------------------------------------------------
> 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]
> --------------------------------------------------------------------
>
--------------------------------------------------------------------
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]
--------------------------------------------------------------------