There was some discussion a while back about Jess supporting Java long type.
It doesn't appear that anything ever came of it.  Can we expect this to
happen, and if so when?
When I did some tests, it looks like Java longs get turned into floating
point numbers.
For example the -60067621520002 shows up as -6.0067621520002E13.

The rules do fire, but conversion between Jess and Java is not seemless--
is it an int or a long or a float?--especially this is important if the long
represents a date.
A test file and results are shown below (I don't have to include any Java
here--
the result is that same with just Jess code and deftemplate).



;;; test file ;;;;;;;;;;;;;;;;;;;
(deftemplate thing (slot date))

a rule using a number that is a long in Java -60067621520002
(defrule _NewRule2
        (thing (date ?d))
        (test (eq ?d -60067621520002))
        =>
)

;; 2147483647 is the current value of Java's max integer.
(defrule _NewRule3
        (thing (date ?d))
        (test (eq ?d 2147483647))
        =>
)

;; -2147483647 is the current value of Java's min integer.
(defrule _NewRule4
        (thing (date ?d))
        (test (eq ?d -2147483647))
        =>
)

;;  2100000000 is in-between Java's max and min.
(defrule _NewRule5
        (thing (date ?d))
        (test (eq ?d 2100000000))
        =>

)

(defrule _NewRule6
        (thing (date ?d))
        (test (eq ?d 60067621520002))
        =>
)

;; -2147483648 is one less than Java's min integer.
(defrule _NewRule7
        (thing (date ?d))
        (test (eq ?d -2147483648))
        =>
)

;; -21474836479 has one more digit than Java's min integer.
(defrule _NewRule8
        (thing (date ?d))
        (test (eq ?d -21474836489))
        =>
)
(defrule startup_rule
  =>
  (watch all)
  (ppdefrule _NewRule)
  (ppdefrule _NewRule2)
  (ppdefrule _NewRule3)
  (ppdefrule _NewRule4)
  (ppdefrule _NewRule5)
  (ppdefrule _NewRule6)
  (ppdefrule _NewRule7)
  (ppdefrule _NewRule8)
  (assert 
   (thing (date 60067621520002))
   )
)

(reset)
(run)

;;;;;;;;;;; end test file ;;;;;;;;;;;;;;;;;;;;;;;

;;;;;;;;;;;;;; RESULTS ;;;;;;;;;;;;;;;;;;;;;;
nil
(defrule _NewRule2
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d -6.0067621520002E13))
    =>)
(defrule _NewRule3
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d 2147483647))
    =>)
(defrule _NewRule4
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d -2147483647))
    =>)
(defrule _NewRule5
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d 2100000000))
    =>)
(defrule _NewRule6
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d 6.0067621520002E13))
    =>)
(defrule _NewRule7
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d -2147483648))
    =>)
(defrule _NewRule8
    ""
    (declare (salience 0))
    (thing (date ?d))
    (test (eq ?d -2.1474836489E10))
    =>)
 ==> f-1 (thing (date 6.0067621520002E13))
==> Activation: _NewRule6 :  f-1,
FIRE 2 _NewRule6 f-1,

;;;;;;;;;;;;;; end results  ;;;;;;;;;;;;;;;;;;;;;;

----------------------------------------------------------------------
George Rudolph
Senior Software Engineer
Motorola SSG
8201 E McDowell Rd.  Scottsdale, AZ, USA 85252
MailStop H2036B
Email: [EMAIL PROTECTED]
Ph: 480-675-2343
Fax: 480-441-3472
-----------------------------------------------------------------------

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

Reply via email to