The problem is in your use of:
(print_ACLMessage( ?message ))
it should be:
(print_ACLMessage ?message)
-- I think...
alan
-----Original Message-----
From: Katz, Ed [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 11:47 AM
To: '[EMAIL PROTECTED]'
Cc: Jess-Users (E-mail)
Subject: JESS: Java method call question.
I'm trying to call a Java method on an deffunction argument. But I
keep getting a "bad index" error. I can call the method
"getPerformative" in my create_dummy_message function. But when I pass
the same instance to my print_ACLMessage function as an argument and
call the same method, I get the error. Could you please point out to
me what I'm missing?
Thanks.
(deffunction create_dummy_message ()
"create a dummy message for debugging"
(bind ?message (new jade.lang.acl.ACLMessage (get-member
jade.lang.acl.ACLMessage PROPOSE)))
(printout t "create_dummy_message ACL=<" (call ?message getPerformative)
">" crlf crlf )
(print_ACLMessage( ?message ))
)
(deffunction print_ACLMessage( ?a )
(printout t "ACLMessage:" crlf
"Performative" (call ?a getPerformative) crlf
crlf )
)
Jess, the Java Expert System Shell
Copyright (C) 1998 E.J. Friedman Hill and the Sandia Corporation
Jess Version 6.0a5 3/12/2001
Jess> (batch testing.jess)
TRUE
Jess> (create_dummy_message)
create_dummy_message ACL=<11>
Jess reported an error in routine ValueVector.get
while executing (call ?message)
while executing deffunction print_ACLMessage
while executing (print_ACLMessage (call ?message))
while executing deffunction create_dummy_message
while executing (create_dummy_message).
Message: Bad index 2 in call to get() on this vector: (call ?message).
Program text: ( create_dummy_message ) at line 2.
at jess.ValueVector.get(ValueVector.java:77)
at jess.Call.call(ReflectFunctions.java:301)
at jess.FunctionHolder.call(FunctionHolder.java:37)
at jess.Funcall.execute(Funcall.java:247)
at jess.FuncallValue.resolveValue(FuncallValue.java:33)
at jess.Deffunction.call(Deffunction.java:145)
at jess.FunctionHolder.call(FunctionHolder.java:37)
at jess.Funcall.execute(Funcall.java:247)
at jess.FuncallValue.resolveValue(FuncallValue.java:33)
at jess.Deffunction.call(Deffunction.java:173)
at jess.FunctionHolder.call(FunctionHolder.java:37)
at jess.Funcall.execute(Funcall.java:247)
at jess.Jesp.parseAndExecuteFuncall(Jesp.java:1520)
at jess.Jesp.parseSexp(Jesp.java:180)
at jess.Jesp.parse(Jesp.java:61)
at jess.Main.execute(jess/Main.java:136)
at jess.Main.main(jess/Main.java:23)
Jess>
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
---------------------------------------------------------------------
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]
---------------------------------------------------------------------