Two part answer:

1) Your first example below is the correct syntax to call a static method like this (given the import, anyway) -- i.e.m

(call java.util.Arrays equals ?array1 ?array2)

2) The problem is that Jess wants to convert Java arrays into Jess lists, and vice versa, Methods like Arrays.equals() that accept Object arguments can confuse matters greatly. You call some Java method that returns an array, and Jess converts it to a Jess list. Then you pass that list as an argument to a method that wants an Object, and Jess doesn't understand that you want to convert it back to an array.

I've been talking to several Jess users lately about overhauling Jess's handling of Java arrays, and I think we're converging on a more sensible design. It should even be possible to do this without breaking existing Jess code. Unfortunately, for now the only general solution is to use Jess list functions instead; for example, you could write a deffunction which emulated Arrays.equals() by looping over the lists.



On Oct 26, 2007, at 12:40 PM, Bogdan Werth wrote:

Hello list,
I am trying to call an equals method in java class Arrays from Jess and this somehow doesn't work the way I imagined it. In the online manual to JESS I've read that this is the call for java classes or objects
(call (<java object>|<java expression>))
So I tried to transfer something that I would write like this in java
Arrays.equals(array1, array2)
into jess like this
(call Arrays equals ?array1 ?array2) or like this (call (Array.equals) ?array1 ?array2) However none of these worked. Even with import statement of java.unil.Arrays it didn't want to work. Do I do something wrong or does JESS has a problem calling methods from classes which are not objects?

Thanks a million,
Bogdan

--------------------------------------------------------------------
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 owner-jess- [EMAIL PROTECTED]
--------------------------------------------------------------------

---------------------------------------------------------
Ernest Friedman-Hill
Informatics & Decision Sciences          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [EMAIL PROTECTED]
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