public class IteratedAchieveREInitiator extends AchieveREInitiator
isSessionTerminated()
method.Modifier and Type | Field and Description |
---|---|
java.lang.String |
ALL_NEXT_REQUESTS_KEY
Key to retrieve from the DataStore of the behaviour the vector of
ACLMessage objects that will be sent at next round.
|
static java.lang.String |
REINIT |
ALL_REQUESTS_KEY, ALL_RESPONSES_KEY, ALL_RESULT_NOTIFICATIONS_KEY, CHECK_AGAIN, HANDLE_AGREE, HANDLE_ALL_RESPONSES, HANDLE_ALL_RESULT_NOTIFICATIONS, HANDLE_INFORM, HANDLE_REFUSE, REPLY_KEY, REQUEST_KEY
currentName, lastStates
Constructor and Description |
---|
IteratedAchieveREInitiator(Agent a,
ACLMessage msg)
Construct an
IteratedAchieveREInitiator with an empty DataStore |
IteratedAchieveREInitiator(Agent a,
ACLMessage msg,
DataStore store)
Construct an
IteratedAchieveREInitiator with a given DataStore |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
createConvId(java.util.Vector msgs)
Create a new conversation identifier to begin a new
interaction.
|
protected void |
handleAllResultNotifications(java.util.Vector resultNotifications)
This method is redefined to call the proper overloaded method
|
protected void |
handleAllResultNotifications(java.util.Vector resultNotifications,
java.util.Vector nextRequests)
This method is called when all the result notification messages
of the current round have been collected.
|
protected void |
handleFailure(ACLMessage failure)
This method is called every time a
failure
message is received, which is not out-of-sequence according
to the protocol rules. |
protected void |
handleInform(ACLMessage inform)
This method is redefined to call the proper overloaded method
|
protected void |
handleInform(ACLMessage inform,
java.util.Vector nextRequests)
This method is called every time an
inform
message is received, which is not out-of-sequence according
to the protocol rules. |
protected void |
handleNotUnderstood(ACLMessage notUnderstood)
This method is called every time a
not-understood
message is received, which is not out-of-sequence according
to the protocol rules. |
protected void |
handleOutOfSequence(ACLMessage msg)
This method is called every time a
message is received, which is out-of-sequence according
to the protocol rules.
|
static boolean |
isSessionTerminated(ACLMessage inform)
Check if the responder has closed the session just after sending this
inform message. |
void |
onStart()
Override the onStart() method to initialize the vectors that
will keep all the replies in the data store.
|
void |
registerHandleAllResultNotifications(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_ALL_RESULT_NOTIFICATIONS state. |
void |
registerHandleFailure(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_FAILURE state. |
void |
registerHandleInform(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_REFUSE state. |
void |
registerHandleNotUnderstood(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_NOT_UNDERSTOOD state. |
void |
registerHandleOutOfSequence(Behaviour b)
This method allows to register a user defined
Behaviour
in the HANDLE_OUT_OF_SEQ state. |
void |
reset()
reset this behaviour by putting a null ACLMessage as message
to be sent
|
void |
reset(ACLMessage msg)
reset this behaviour
|
void |
setDataStore(DataStore ds)
Override the setDataStore() method to propagate this
setting to all children.
|
getSession, handleAgree, handleAllResponses, handleRefuse, prepareRequests, registerHandleAgree, registerHandleAllResponses, registerHandleRefuse, registerPrepareRequests, reinit
checkTermination, deregisterDefaultTransition, deregisterState, deregisterTransition, forceTransitionTo, getChildren, getCurrent, getLastExitValue, getName, getPrevious, getState, handleInconsistentFSM, handleStateEntered, hasDefaultTransition, onEnd, registerDefaultTransition, registerDefaultTransition, registerFirstState, registerLastState, registerState, registerTransition, registerTransition, resetStates, scheduleFirst, scheduleNext, stringifyTransitionTable
action, done, resetChildren, setAgent
block, block, getAgent, getBehaviourName, getDataStore, getParent, isRunnable, restart, root, setBehaviourName
public final java.lang.String ALL_NEXT_REQUESTS_KEY
public static final java.lang.String REINIT
public IteratedAchieveREInitiator(Agent a, ACLMessage msg)
IteratedAchieveREInitiator
with an empty DataStorepublic IteratedAchieveREInitiator(Agent a, ACLMessage msg, DataStore store)
IteratedAchieveREInitiator
with a given DataStorea
- The agent performing the protocolmsg
- The message that must be used to initiate the protocol.
Notice that the default implementation of the
prepareRequest()
method returns an array composed of
only this message. The values of the slot
reply-with
is ignored and a different value is assigned
automatically by this class for each receiver.store
- The DataStore
that will be used by this
AchieveREInitiator
protected void handleInform(ACLMessage inform, java.util.Vector nextRequests)
inform
message is received, which is not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override this method in case they need to react to this event.inform
- the received inform messagenextRequest
- the Vector of ACLMessage objects to be sent at
next roundprotected final void handleInform(ACLMessage inform)
handleInform
in class AchieveREInitiator
inform
- the received inform messageprotected void handleAllResultNotifications(java.util.Vector resultNotifications, java.util.Vector nextRequests)
inform,
failure
received messages, which are not out-of-sequence
according to the protocol rules.
This default implementation does nothing; programmers might
wish to override this method in case they need to react to this event
by analysing all the messages in just one call.resultNodifications
- the Vector of ACLMessage object receivednextRequest
- the Vector of ACLMessage objects to be sent at
next roundprotected final void handleAllResultNotifications(java.util.Vector resultNotifications)
handleAllResultNotifications
in class AchieveREInitiator
public void registerHandleInform(Behaviour b)
Behaviour
in the HANDLE_REFUSE state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve the received inform
ACLMessage object from the datastore at the REPLY_KEY
key and the Vector of ACLMessage objects to be sent at next round
at the ALL_NEXT_REQUESTS_KEY
.registerHandleInform
in class AchieveREInitiator
b
- the Behaviour that will handle this statepublic void registerHandleAllResultNotifications(Behaviour b)
Behaviour
in the HANDLE_ALL_RESULT_NOTIFICATIONS state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the Vector of ACLMessage objects, received as a result notification,
from the datastore at the ALL_RESULT_NOTIFICATIONS_KEY
key and the Vector of ACLMessage objects to be sent at next round
at the ALL_NEXT_REQUESTS_KEY
.registerHandleAllResultNotifications
in class AchieveREInitiator
b
- the Behaviour that will handle this statepublic static boolean isSessionTerminated(ACLMessage inform)
inform
message.protected void handleNotUnderstood(ACLMessage notUnderstood)
not-understood
message is received, which is not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override the method in case they need to react to this event.notUnderstood
- the received not-understood messageprotected void handleFailure(ACLMessage failure)
failure
message is received, which is not out-of-sequence according
to the protocol rules.
This default implementation does nothing; programmers might
wish to override the method in case they need to react to this event.failure
- the received failure messageprotected void handleOutOfSequence(ACLMessage msg)
msg
- the received messagepublic void registerHandleNotUnderstood(Behaviour b)
Behaviour
in the HANDLE_NOT_UNDERSTOOD state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the not-understood
ACLMessage object received
from the datastore at the REPLY_KEY
key.b
- the Behaviour that will handle this statepublic void registerHandleFailure(Behaviour b)
Behaviour
in the HANDLE_FAILURE state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the failure
ACLMessage object received
from the datastore at the REPLY_KEY
key.b
- the Behaviour that will handle this statepublic void registerHandleOutOfSequence(Behaviour b)
Behaviour
in the HANDLE_OUT_OF_SEQ state.
This behaviour would override the homonymous method.
This method also set the
data store of the registered Behaviour
to the
DataStore of this current behaviour.
The registered behaviour can retrieve
the out of sequence
ACLMessage object received
from the datastore at the REPLY_KEY
key.b
- the Behaviour that will handle this statepublic void reset()
reset
in class FSMBehaviour
public void reset(ACLMessage msg)
msg
- is the ACLMessage to be sentpublic void onStart()
public void setDataStore(DataStore ds)
setDataStore
in class Behaviour
ds
- the DataStore
that this Behaviour
will use as its private data storeprotected java.lang.String createConvId(java.util.Vector msgs)
msgs
- A vector of ACL messages. If the first one has a
non-empty :conversation-id
slot, its value is
used, else a new conversation identifier is generated.