public class ConsoleAgent extends AbstractAgent
AbstractAgent.ReturnCode, AbstractAgent.State| Constructor and Description |
|---|
ConsoleAgent() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
end()
This method corresponds to the last behavior which is called by the MaDKit
kernel.
|
void |
setupFrame(AgentFrame frame)
Called when the default GUI mechanism is used upon agent creation.
|
activate, broadcastMessage, broadcastMessageWithRole, bucketModeCreateGroup, bucketModeRequestRole, checkAgentAddress, compareTo, createGroup, createGroup, createGroup, createGroupIfAbsent, createGroupIfAbsent, createGroupIfAbsent, createGUIOnStartUp, destroyCommunity, destroyGroup, destroyRole, executeThisAgent, executeThisAgent, executeThisAgent, getAgentAddressIn, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getDistantAgentWithRole, getExistingCommunities, getExistingGroups, getExistingRoles, getKernelAddress, getLastReceivedMessage, getLastReceivedMessage, getLogger, getMadkitConfig, getMadkitProperty, getMadkitProperty, getMyGroups, getMyRoles, getName, getNetworkID, getOrganizationSnapShot, getReplyTo, getServerInfo, getSimpleNetworkID, getState, hasGUI, hashCode, hasRole, isAlive, isCommunity, isGroup, isKernelOnline, isMadkitPropertyTrue, isMessageBoxEmpty, isRole, killAgent, killAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgent, launchAgentBucket, launchAgentBucket, launchAgentBucket, launchAgentBucket, launchNode, launchXmlAgents, leaveGroup, leaveRole, nextMessage, nextMessage, nextMessages, proceedEnumMessage, purgeMailbox, receiveMessage, reload, requestRole, requestRole, sendMessage, sendMessage, sendMessageWithRole, sendMessageWithRole, sendReply, sendReplyWithRole, setLogLevel, setMadkitProperty, setMadkitProperty, setName, toStringpublic void setupFrame(AgentFrame frame)
AbstractAgentframe.setContentPane(new OutputPanel(this));.
Default settings for the frame are:
MadkitMenu, AgentMenu and AgentLogLevelMenusetupFrame in class AbstractAgentframe - the default frame which has been created by MaDKit for this
agent.OutputPanelprotected void end()
AbstractAgentHere is a typical example:
@Override
protected void end()
{
AbstractAgent.ReturnCode returnCode = leaveRole("a community", "a group", "my role");
if (returnCode == AbstractAgent.ReturnCode.SUCCESS){
if(logger != null)
logger.info("I am leaving the artificial society");
}
else{
if(logger != null)
logger.warning("something wrong when ending, return code is "+returnCode);
}
if(logger != null)
logger.info("I am done");
}
}
end in class AbstractAgent
Fabien Michel, Olivier Gutknecht, Jacques Ferber - July 18 2017