Here's a page on the Jess wiki showing a simple way to work with enums in Jess:

http://www.jessrules.com/jesswiki/view?EnumeratedTypes

Here's another page about a possibly more elegant way:

http://www.jessrules.com/jesswiki/view?BindEnumUserFunction


On Jul 30, 2008, at 11:26 AM, Joao Antunes Mourao wrote:

Hello,

I'm trying to make a query according to an enum type. Like for example,
i have defined a class of car in java like:

car{
   String model;
  ColorEnumType color;
}

and I define the enum in java like

public enum ColorEnumType{ Black, White;}

Now, i want to make a query to see which black cars I have in the jess
memory. I do

(query search-by-color
(declare (variables ?color))
(Car (model ?model) (color ?color))

Until here I think is no problem. Now, when i want to make a search i
write:

(bind ?result (run-query* search-by-color ColorEnumType.Black))

and simple doesn' t work. If i search for the model, is no problem,
because is a String. I guess is related with the fact that color is an
enum. Also i had imported all the classes needed, so from this i guess
there is no problem.

Can anyone tell me what is the problem on this? What i'm doing wrong?

Regards,

Joao Mourao

unclassified email


Disclaimer:

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender and delete this e-mail. Any unauthorized copying, disclosure
or distribution of the material in this e-mail is strictly forbidden.

Considering the inherent risks of the use of e-mail communication,
Thales Nederland BV shall not be liable for any damage derived from it.

Thales Nederland BV is seated in Hengelo (Ov.), the Netherlands,
and registered at the Chamber of Commerce under number 06061578.

<joao.mourao.vcf>

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences, Sandia National Laboratories
PO Box 969, MS 9012, 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]
--------------------------------------------------------------------

Reply via email to