public class ConsoleAgent extends AbstractAgent
AbstractAgent.ReturnCode, AbstractAgent.State
logger
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(JFrame 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, toString
public void setupFrame(JFrame frame)
AbstractAgent
frame.add(new IOPanel(this));
.
Default settings for the frame are:
MadkitMenu
, AgentMenu
and AgentLogLevelMenu
setupFrame
in class AbstractAgent
frame
- the default frame which has been created by MaDKit for this
agent.OutputPanel
protected void end()
AbstractAgent
Here 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 - May 2 2015