public class Watcher extends AbstractAgent
AbstractAgent.ReturnCode, AbstractAgent.State
logger
Constructor and Description |
---|
Watcher() |
Modifier and Type | Method and Description |
---|---|
protected void |
activate()
This method corresponds to the first behavior which is called by the
MaDKit kernel when an agent is launched.
|
void |
addProbe(Probe<? extends AbstractAgent> probe)
Adds the probe to the artificial organization so that it starts
to probe the agents which are at the corresponding CGR location.
|
Probe<AbstractAgent>[] |
allProbes() |
Set<Probe<? extends AbstractAgent>> |
getProbes()
Returns the probes which have been successfully added
|
void |
removeAllProbes()
Remove all probes at once.
|
void |
removeProbe(Probe<? extends AbstractAgent> probe)
Removes the probe from the artificial organization, thus stopping the probing activity.
|
String |
toString() |
broadcastMessage, broadcastMessageWithRole, bucketModeCreateGroup, bucketModeRequestRole, checkAgentAddress, compareTo, createGroup, createGroup, createGroup, createGroupIfAbsent, createGroupIfAbsent, createGroupIfAbsent, createGUIOnStartUp, destroyCommunity, destroyGroup, destroyRole, end, 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, setupFrame, setupFrame
public void addProbe(Probe<? extends AbstractAgent> probe)
probe
- the probe to addpublic void removeProbe(Probe<? extends AbstractAgent> probe)
probe
- the probe to removeprotected void activate()
AbstractAgent
Here is a typical example:
@Override protected void activate() { AbstractAgent.ReturnCode returnCode = requestRole("a community", "a group", "my role"); if (returnCode == AbstractAgent.ReturnCode.SUCCESS){ if(logger != null) logger.info("I am now playing my role in the artificial society"); } else{ if(logger != null) logger.warning("something wrong, return code is "+returnCode); } }
activate
in class AbstractAgent
public void removeAllProbes()
public Probe<AbstractAgent>[] allProbes()
public Set<Probe<? extends AbstractAgent>> getProbes()
public String toString()
toString
in class AbstractAgent
String
giving the name and
the current state of the agent
Fabien Michel, Olivier Gutknecht, Jacques Ferber - March 9 2017