Re: JESS: Setting slot values using Java api

"Wolfgang Laun" <[email protected]>
Newsgroups gmane.comp.java.jess
Message-ID <31916_1285154981_o8MBSeso032222_AANLkTinyv_JxcdUmZtqDm+5x1D62v1=SjhPSt=tz8ZkA@mail.gmail.com>
You can't construct a Value with a type RU.ANY.

If the Slot doesn't provide the information, you'll have to obtain this
information from elsewhere; in getJessValue you have the value as a String,
and no other information. With a String being passed to the Value
constructor, you have the options RU.STRING and RU.SYMBOL. -- See Javadoc
for jess.Value.

-W


On 22 September 2010 07:04, Donald Winston <[email protected]> wrote:

> When the "slotType" is "ANY" my value is "<UNKNOWN>". So the RU.ANY data
> type cannot be used this way and I have to use one of the others?
>
> ...
> fact.setSlotValue(name, getJessValue(slotType, value));
> ...
>
> private Value getJessValue(String type, String value) throws JessException
> {
> if ("ANY".equals(type) == true)
> return new Value(value, RU.ANY);
> else if ("STRING".equals(type) == true)
> return new Value(value, RU.STRING);
> else if ("INTEGER".equals(type) == true)
> return new Value(Integer.parseInt(value), RU.INTEGER);
> else if ("FLOAT".equals(type) == true)
> return new Value(Float.parseFloat(value), RU.FLOAT);
> else if ("SYMBOL".equals(type) == true)
> return new Value(value, RU.SYMBOL);
> else if ("LONG".equals(type) == true)
> return new Value(Long.parseLong(value), RU.LONG);
> else
> return new Value(value, RU.ANY);
> }
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.