Re: JESS: Re: Java Date in JESS

2006-02-02 Thread ejfried
I think Florian Fischer wrote:

> I just wondered if there is a more elegant way to deal with dates.

Jess currently doesn't treat Date objects specially in any way. You
could define a few deffunctions which compared dates, and then use
those on your rule LHS (or a few Java Userfunctions.) 

-
Ernest Friedman-Hill  
Advanced Software Research  Phone: (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: Re: Java Date in JESS

2006-02-02 Thread Roger Studner
Not to dodge the answer, but I do milliseconds in all my date work.  I guess
in my mind I just didn't mind have a 'bean' object that did the work for me
to allow my rules to be ignorant of what the value field type was that was
being compared (until RHS 'pretty printing' of course)

Roger


On 2/2/06, Florian Fischer <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> Is there a convenient way to express rules on Java Date attributes in
> shadow facts?  Or is it advisable to convert all dates to integers (i.e.
> add a getter that returns the same date in milliseconds or seconds)?
>
> More specifically,  I want to fire a rule under some conditions, one of
> them being that the timestamp in the object is older than a given number
> of minutes found in another fact.  I have a shadow fact for a Java
> object that is updated with the current time every minute.
> I could just convert the dates to milliseconds and compare from there, I
> just wondered if there is a more elegant way to deal with dates.
>
> Regards,
> Florian Fischer.
>
> 
> 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]

JESS: Re: Java Date in JESS

2006-02-02 Thread Florian Fischer

Hello,

Is there a convenient way to express rules on Java Date attributes in 
shadow facts?  Or is it advisable to convert all dates to integers (i.e. 
add a getter that returns the same date in milliseconds or seconds)?


More specifically,  I want to fire a rule under some conditions, one of 
them being that the timestamp in the object is older than a given number 
of minutes found in another fact.  I have a shadow fact for a Java 
object that is updated with the current time every minute.
I could just convert the dates to milliseconds and compare from there, I 
just wondered if there is a more elegant way to deal with dates.


Regards,
Florian Fischer.


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]