I'm using Jess 5.0b4 and JDK 1.2.2 on NT 4.0.
I have some code that supports a GUI rule editor.
The code gets a defrule from the engine, then parses the rule
using methods available from the Defrule object.
In processing the right-hand-side of a rule,
it looks for strings, variables, or function calls.
When processing a particular Funcall object,
it uses the RU arg types to distinguish argument types and know
how to further process them (like RU.STRING, RU.VARIABLE, RU.FUNCALL).
(Note: I did not write this code, but I do have to maintain it.)
I had assumed that each kind of arg or Value object would have only one
type--
i.e. the RU types are mutually exclusive. However, I have run into a case
where
in the code snippet
//myFunc is a Funcall that is passed in...
jess.Value arg = myFunc.get(i);
if (arg.type() == jess.RU.FUNCALL) {
Funcall func = arg.funcallValue(context);
tempstr = func.toString();
System.out.println(" func = " + func.toString());
}
if(arg.type() == jess.RU.STRING) {
tempstr = arg.stringValue(context);
System.out.println(" string = " + tempstr);
}
both clauses seem to be getting executed for the same arg.
The case involves an action like
(do-this ?param1 (strcat "string1 " (call warper warp ?myObject)
" string2"))
where the call to warper.warp() returns a String.
Relating to the snippet above, the strcat call is the value of "myFunc", and
the (call warper warp ?myObject) is the value of "arg".
Question 1. Is this the type confusion a bug?
Question 2. Is there an easier way to parse defrules (back) out of the
engine than what is being done?
----------
George Rudolph
Motorola SSG
----------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------