public interface ConversationInterface extends Runnable
Modifier and Type | Interface and Description |
---|---|
static class |
ConversationInterface.State |
Modifier and Type | Field and Description |
---|---|
static String |
CLIENT |
static int |
DEFER_ACTION
Used by consider_*(), verify_*(), perform_*(), release_*(),
conclude_*(), etc-type methods to signal that the action is
not yet ready to be executed, and that the method should be
called again later.
|
static int |
DROP_ACTION
Used by consider_*(), verify_*(), perform_*(), release_*(),
conclude_*(), etc-type methods to signal that the action should
be discarded -- i.e.: no action should be taken and the message
should be allowed by timeout when the REPLY-BY expires.
|
static String |
SERVER |
Modifier and Type | Method and Description |
---|---|
PerformDescriptor |
callHandlerMethod(MLMessage message,
String methodName)
Calls a method on
this with the specified name, passing it
the given MLMesssage, and returning a PerformDescriptor. |
PerformDescriptor |
dispatchMsgHandlerMethod(String consider,
Act act,
MLMessage message)
This method is called (directly or indirectly) in response to a
request -type message. |
PerformDescriptor |
dispatchMsgHandlerMethod(String consider,
Act act,
MLMessage message,
boolean contextual) |
PerformDescriptor |
eavesdrop(MLMessage msg)
This is the catch-all method called when
ProcessOptions.observeMessages
is set true and the handler method (the regular method concatenated with
"_evesdrop") is not found. |
TransientAgent |
getAgent() |
String |
getId() |
ConversationInterface.State |
getPreviousState() |
ConversationInterface.State |
getState() |
void |
init() |
void |
setId(String id) |
void |
setState(ConversationInterface.State s) |
void |
waitForEvent(Event event,
long timeout) |
static final int DEFER_ACTION
static final int DROP_ACTION
static final String SERVER
static final String CLIENT
void init()
PerformDescriptor callHandlerMethod(MLMessage message, String methodName) throws NoSuchMethodException
this
with the specified name, passing it
the given MLMesssage, and returning a PerformDescriptor. Throws
NoSuchMethodException if no such method exists.eavesdrop(MLMessage)
as a catch-all.message
- The message to pass.theMethodName
- The name of the method to call.NoSuchMethodException
- If any exception occurs during the call.PerformDescriptor eavesdrop(MLMessage msg)
ProcessOptions.observeMessages
is set true and the handler method (the regular method concatenated with
"_evesdrop") is not found. Subclasses should override this to implement
the desired behaviour. This implementation does nothing but return a
PerformDescriptor
with a DROP_ACTION
Status, which
indicates no action should be taken.msg
- An incoming message that is not addressed to this agent.PerformDescriptor dispatchMsgHandlerMethod(String consider, Act act, MLMessage message)
request
-type message.
This implementation uses the sun.reflect
package to
look for a method with the signature consider_*(MLMessage) (where * is the
name of the performative in the message) and calls that method if it
exists, otherwise it calls #considerDefault(Act, MLMessage)
.
If the message is just an inform
type and the called
method returns a performative in it's return of a sub-type of
negative-reply
then a reply
message is constructed and returned to the sender (even though inform
messages usually don't get a reply).act
- the Act object of the message (should be the same as that described in the act
field of message).b
- the request
-type performative message that precipitated the call to the methodcasa.interfaces.PolicyAgentInterface#consider(casa.Act, casa.MLMessage)
PerformDescriptor dispatchMsgHandlerMethod(String consider, Act act, MLMessage message, boolean contextual)
void waitForEvent(Event event, long timeout)
event
- String getId()
void setId(String id)
id
- the id to setConversationInterface.State getState()
ConversationInterface.State getPreviousState()
void setState(ConversationInterface.State s)
TransientAgent getAgent()