I think Peter Klotz wrote:
> Hi,
> 
> I have a Java method that I want to call from Jess like this
> 
> (call ?obj someMethod "some string" (get ?obj someslot) nil)
> 
> So calling the method with mixed parameters, where nil is possible. Now 
> the problem is how does the Java method have to look like, so that Jess 
> can find a method to call, because usally the error from Jess is
> 
> no method overloading for someMethod can call with these arguments (call 
> ?obj someMethod "some string" (get ?obj someslot) nil)
> 
> Then I tried to have
> 
> public void someMethod(ValueVector args)
> public void someMethod(Value[] args)
> public void someMethod(Object[] args)
> public void someMethod(String[] args)
> 
> But in no case Jess would really want to call the method.

The first two methods are going to be very difficult to call in a
useful way from Jess, as we've discussed in the past. Jess simply
doesn't include the special cases for these built-in types that would
be needed. The second two versions should work fine. As usual, if the
formal argument to a method is an array, then you need to pass a list
as an argument:

    (call ?obj someMethod (create$ "some string" (get ?obj someslot) nil))

as indicated in the second table in section 2.6 of the Jess manual.

> This is a similar problem to the multislot getter issue that I have 
> posted already twice where the question is when does Jess match a 
> multislot if the getter looks like
> 
> public ValueVector getSomeSlot()
> public Value[] getSomeSlot()
> public Object[] getSomeSlot()
> public String[] getSomeSlot()
> 

It is indeed similar. The first one isn't a multislot; the second one
is, but it won't work the way you expect; and the last two will work
fine. 

---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  [EMAIL PROTECTED]
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--------------------------------------------------------------------
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