If you look more closely you should find some jess reflect package class
methods are in your call stack (and should be catching the exception.)

The call method attempts to find a method on your class object
(mypackage.myclass) matching the name and argument types.

This seems to be what is wrong (as you pointed out the discrepency in the
list data type.)  Look at the ReflectFunctions.java - class "Call", method
"call".

Here is a comment from the code in Context.java (which is involved in the
evaluation of your "if" clause:

// -*- sigh -*-
// For very few forms, a variable is treated as an lvalue and
// therefore must not be substituted here. For now, only
// bind and foreach are treated this way: Just leave the first arg
// alone. Note that the actual bind is still executed in Funcall.

This seems to indicate that your "then" and "else" expressions are being
incorrectly evaluated (or not at all.)

Try something like the following (this example might not even compile...) :

(if (eq ?myvar 0) then
   (bind $?arrayToUse ($?arrayA))
 else
   (bind $?arrayToUse ($?arrayB))
)
(call mypackage.myclass mymethod $?arrayToUse)

In any case, this whole area of jess is being completely reimplemented by
Earnest and could fix your problem.


Good luck!

alanm


**** btw ***

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Kenny Macleod
> Sent: Tuesday, April 27, 1999 1:37 AM
> To: '[EMAIL PROTECTED]'
> Subject: JESS: Possible bug
>
>
> Folks,
>
> I think I may have run into a possible bug in Jess 4.4.  On the other
> hand, I could just be doing something daft and not realising it.
>
> I am trying to invoke the (call) function on a Java static method.  This
> method takes a single argument, an array of bytes.
>
> In the rules, this argument can be one of two pre-defined multivariable
> values, call them $?arrayA and $?arrayB.  Now, I can call the method
> using the following syntax:
>
>       (call mypackage.myclass mymethod $?arrayA)
>
> That works fine.  However, I want to select the argument to pass
> depending on the value of another variable, call it ?myvar:
>
>       (bind $?arrayToUse (if (eq ?myvar 0) then $?arrayA else
> $?arrayB))
>       (call mypackage.myclass mymethod $?arrayToUse)
>
> When I try it this way, I get a Rete exception ("method mymethod not
> found or invalid argument types").
>
> Am I using the multivariable values correctly, or is the 'if' statement
> returning values of the wrong type here?  After further poking around,
> it seems that the $?arrayToUse variable is of type RU.MULTIFIELD.  The
> ReteException, however, is being thrown from within
> Jess.Value.listValue(), which only accepts values of type RU.LIST.
>
> Any thoughts on what's going wrong here?
>
> Regards
>
>
> Kenny
>
>
> ------------------------------------------------------
> Kenny MacLeod          |
>                        | Email: [EMAIL PROTECTED]
> Mutant Technology Ltd  | Tel:   (+44) 171 257 9988
> 12-13 Henrietta Street | Fax:   (+44) 171 836 2600
> London, UK WC2E 8LH    | WWW:   www.mutant-tech.com
> ------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the
> list. List problems? Notify [EMAIL PROTECTED]
> ---------------------------------------------------------------------
>

---------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the
list. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to