Hi Folks,

I received a private email asking if Jess could work with Java 5
enumerated types. There's no specific code to deal with them, but I
wondered if the existing "static import" feature would work. It turns
out that it does. I wrote this Java enum class:

  public enum MyEnum {
    FOO, BAR, BAZ;
  }

Then in Jess 7, I tried this:

  Jess> (import MyEnum)
  TRUE
  Jess> (MyEnum.FOO)
  <Java-Object:MyEnum>
  Jess> (eq (MyEnum.FOO) (MyEnum.BAR))
  FALSE
  Jess> (eq (MyEnum.FOO) (MyEnum.FOO))
  TRUE

So importing an enum class will make the values available as the
functions (EnumName.FOO), (EnumName.BAR), etc. Thought this might be
of interest to some of you.


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

Reply via email to