I'm a little bit confused by your mentioning 'defclass' and 'instance
variables' in the same sentence, as defclass deals with Bean
properties, which are not variables but methods. But, in any case,
when you fetch an array from Java into Jess, you get it as a
multifield. If Jess calls a Java method 

int[] getN123() { return new int[] { 1, 2, 3 }; }

using 'call', as in

(call ?anObject getN123)

the return value is the multifield (1 2 3). You can then access
individual elements using the multifield functions like nth$.

Similarly, if you call get-member to retrieve a Java instance variable
which is an array.

Now if you defclass a Bean with a method like getN123, the
correseponding deftemplate will look like

(deftemplate my-object (multislot n123) ...)

Now, for any of these three methods, if you want to set the
property/the variable/call a setter method, you have to assemble a
multifield with all the values, and set the whole thing at once. 

Jess does not currently handle what the Beans spec calls 'indexed
properties', which are methods like int getn123(int idx), in the
defclass statement.





I think [EMAIL PROTECTED] wrote:
> 
> [I'm using Jess4.1 Final]
> 
> I've been using defclass to communicate between Jess and Java, as described
> in Section 7.7 of the Jess manual. 
> 
> So far, I've used simple data types for instance variables, and this has
> worked fine.
> 
> Now I'm trying to get access to an array that is an instance variable.
> 
> According to the documentation in 7.7.1, "Array properties give rise to
> multislots in Jess."
> 
> I take this to mean that I can have arrays as instance variables in the Java
> class, and that these arrays become multislots in the Jess class.
> 
> Am I interpreting this right? If so, does anyone have an example that shows
> how to get access to the array, and the individual array elements?
> 
> Thanks in advance.
> 
> Tom Hamilton
> United Technologies Research Center
> ---------------------------------------------------------------------
> 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]
> ---------------------------------------------------------------------
> 
> 


---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (510) 294-2154
Sandia National Labs                FAX:   (510) 294-2234
Org. 8920, MS 9214                  [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. List problems? Notify [EMAIL PROTECTED]
---------------------------------------------------------------------

Reply via email to