I read it on older messages of the list. And because my first attempts produced errors, I assumed Jess doesn't support Enums. But now, I got it working. Thanks!

I found nothing about this at the manual or at the wiki. I think it would be a good idea to include this.

Helge


Am 06.11.2006 um 16:32 schrieb Ernest Friedman-Hill:


On Nov 6, 2006, at 7:58 AM, Helge Hartmann wrote:

Hello!

It read, that Jess does not allreads support Enums.

Please let me know where you read this, as it's not true. I'll see if I can get it fixed. We've done some experiments with Java 5 enums, and they can be used nicely. For example, see http://www.mail-archive.com/[email protected]/msg00313.html .

But I can't access these static fields from Jess. I have an Shadow fact, that has an int filed type. When I type

    (modify ?account (type (call Type EXTENDED)))

I get an error, that there is no method called EXTENDED. Is there a possibility to use Enums or static fields? Or how can I work around this?

Well, indeed, because there is no method (static or otherwise) named EXTENDED. "call" is only for calling Java methods, not accessing Java variables.

In Jess 6 and easier, you have to use get-member to get static variables:


(modify ?account (type (get-member Type EXTENDED)))

But in Jess 7, importing a class creates Jess functions that return the value of each public static variable in the class. So, for example, if you say

(import Type)

you can then refer to Type.EXTENDED as (Type.EXTENDED), like this:

(modify ?account (type (Type.EXTENDED)))

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


Helge Hartmann
Antwort an: [EMAIL PROTECTED]




Reply via email to