Hi Erich,
I have some bad news for your client: this syntax
{myEnum != MyEnum.ENUMVAL1}
NEVER worked. The test they've written is comparing the myEnum slot to
the Jess symbol "MyEnum.ENUMVAL1", which, although it wouldn't give an
error, also never did the right thing. This stopped working because
dots in variables because significant, and there it, actually, a dot
notation you can use, although not quite in this context.
Your get-member workaround will work fine, but there are some somewhat
nicer looking alternatives: either this
http://www.jessrules.com/jesswiki/view?EnumeratedTypes
or the even fancier
http://www.jessrules.com/jesswiki/view?BindEnumUserFunction
depending on how involved the enums are.
On Sep 2, 2009, at 12:05 PM, erich oliphant wrote:
Hi,
I'm helping a client that's currently on a very old Jess 7.0 (b2 I
believe) upgrade to the 7.1p2 version. The existing jess code imports
some 'constructed' pre- Java 1.5 enums of the form
public class MyEnum {
public final static ENUMVAL1 = new MyEnum(..);
}
In the 7.0b Jess code we were able to (import) the MyEnum and
reference ENUMVAL1 in expressions like:
...
exists (com.somepkg.SomeClass
{myEnum != MyEnum.ENUMVAL1})
..
Jess 7.1 is not happy about this and reports "Message: Variable used
before definition: MyEnum."
Just want to verify based on my reading of the latest docs but it
seems that this:
{myEnum != MyEnum.ENUMVAL1}
should be replaced with something like this:
{myEnum != (get-member MyEnum ENUMVAL1)}
Is this the correct way to address this ?
Thanks In Advance,
Erich
--------------------------------------------------------------------
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]
.
--------------------------------------------------------------------
---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences Phone: (925) 294-2154
Sandia National Labs
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].
--------------------------------------------------------------------