Define a JavaBean something like
This will fire a PropertyChangeEvent once per second. You could change the sleep interval to be longer or shorter, if you like. Now, create an instance of this and add it to Jess's working memory:
(defclass time TimeBean)
(definstance time (new TimeBean))
Then rewrite your rule something like this (I invite you to write a new deffunction, just for documentation purposes, to make the time comparison expression clearer
Now every time the bean ticks, the time comparison will be done -- without your ever needing to reset the engine. Most of the pattern matching will therefore only be done when the bean is added to the engine; only the interesting time comparison will be done more than once. This should be vastly faster.
[ November 17, 2004: Message edited by: Ernest Friedman-Hill ]