Re: JESS: Handling Time

2003-08-15 Thread ejfried
I think Judson, Ross wrote:
 It's a little frustrating working with time in Jess.  You can store a
 time as a java.util.Date, but then you can't compare it with , ,
 etc...if you work with it as a long, then you can't call + and other
 math functions; they change the number into INTEGER.  If you work with
 time as ms/1000, then you lose a lot of accuracy.
 
 Any suggestions on how best to handle time?
 
 I have a few specific ones:
 
 1. Extend , , etc. to work with Comparable objects.

I like this idea very much. 

 2. Instead of printing ExternalAddress and so forth when printing out
 fact lists, use an extra slot descriptor to indicate that toString()
 should be called on the object in the fact slot, and that used as the
 text to represent the object.
 3. Extend + and other math functions to work with LONG values.


Yes, LONG should be a first-class type. This has been promised for
several releases now!



-
Ernest Friedman-Hill  
Distributed Systems ResearchPhone: (925) 294-2154
Sandia National LabsFAX:   (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]




RE: JESS: Handling Time

2003-08-15 Thread James Owen
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Instead of using java.util.Date, you might try java.util.Calendar. 
Calendar allows after(), before() or equals(), all of which return a
boolean.  Calendar also has returns Date getTime() and
setTime(Date) if those are already in your code somewhere.   Just a
thought. :-)

SDG
jco

- -Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Judson, Ross
Sent: Thursday, August 14, 2003 12:13 PM
To: [EMAIL PROTECTED]
Subject: JESS: Handling Time


It's a little frustrating working with time in Jess.  You can store a
time as a java.util.Date, but then you can't compare it with , ,
etc...if you work with it as a long, then you can't call + and other
math functions; they change the number into INTEGER.  If you work
with time as ms/1000, then you lose a lot of accuracy.

Any suggestions on how best to handle time?

I have a few specific ones:

1. Extend , , etc. to work with Comparable objects.
2. Instead of printing ExternalAddress and so forth when printing out
fact lists, use an extra slot descriptor to indicate that toString()
should be called on the object in the fact slot, and that used as the
text to represent the object. 3. Extend + and other math functions to
work with LONG values.

RJ

- 
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]
- 

-BEGIN PGP SIGNATURE-
Version: PGPfreeware 6.5.8 for non-commercial use http://www.pgp.com

iQA/AwUBPz0Gd9xsw6qfZxRLEQLZ4wCfTI/sPGW9tcqKE7F7TsWYYF+d3CIAmwcV
3xDdHIvsC4+LSJeZpFlNpHDx
=0ULf
-END PGP SIGNATURE-


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]




Re: JESS: handling time

2003-01-27 Thread Richard Kasperowski
Judson, Ross wrote:

There are a few obvious ways to do simple things with time (expiring
facts, etc)...but I am wondering if there are some best practices in
this regard.  Constructing time-oriented caches of facts, waiting for a
certain amount of time to elapse...

Would anyone care to comment?


Here's what we're doing.  Each fact in our expert system is a 
definstance from a Java bean.  Every bean has at least these two 
properties: serialNumber and timeStamp.  In the Java app. that uses 
Jess, we keep a list of active beans.  We periodically scan the list for 
old beans--the ones that have a timeStamp that is too old.  For each 
bean that is too old, we find its related fact by its serialNumber and 
retract the fact, and remove it from the list of active beans.  Thus the 
beans that are too old are both eligable for garbage collection, and 
their related facts are removed from the expert system.

--
Richard Kasperowski
Tel: 617-576-1552, Fax: 617-576-2441
mailto:[EMAIL PROTECTED]
http://www.altisimo.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]