|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmadkit.kernel.AbstractAgent
madkit.kernel.Agent
madkit.strobekit.StrobeAbstractAgent
The main class of the STROBEKIT agent API. Strobe agents are considered to inherit from this abstract class.
This class contains methods for:
CogintiveEnv
) management
StrobeMsg
) management
Remarks concerning Strobe agents:
CognitiveEnv
: One global and private called globalEnv
, and a set of local ones (dedicated to each acquaintance) represented by a hashmap
of pair (AgentAddress
, CognitiveEnv
).
Constructor Summary | |
StrobeAbstractAgent()
Default no-args constructor, which just set-up internal structures. |
|
StrobeAbstractAgent(java.lang.String n,
java.lang.String g,
java.lang.String r)
Do the same that StrobeAbstractAgent() but set-up also agent name, group, and role. |
Method Summary | |
madkit.kernel.AgentAddress[] |
acquaintanceAddresses()
Return an array of agent addresses corresponding to all the agents a Strobe agent has a cognitive environment dedicated to. |
madkit.kernel.AgentAddress[] |
acquaintanceAndIAddresses()
Return an array of agent addresses corresponding to itself (first position) and all the agents it has a cognitive environment dedicated to. |
java.lang.String[] |
acquaintanceAndINames()
Return an array of agent namess corresponding to itself (first position) and all the agents it has a cognitive environment dedicated to. |
java.lang.String[] |
acquaintanceNames()
Return an array of agent names corresponding to all the agents a Strobe agent has a cognitive environment dedicated to. |
void |
activate()
Method initially called when the micro-kernel registers the agent; Strobe agents have to use the method StrobeActivate . |
abstract void |
addAcquaintance(madkit.kernel.AgentAddress a)
This method has to be redefined by Strobe agents; it corresponds to the adding acquaintance policy i.e., how a Strobe agents create a new CognitiveEnv when they meet a new agent for the very first time. |
void |
addAcquaintanceByCopyingGlobalEnv(madkit.kernel.AgentAddress a)
Create a new local cognitive environment for a by copying the Strobe agent global cognitive environment. |
void |
addAcquaintanceByCopyingLocalEnv(madkit.kernel.AgentAddress newa,
madkit.kernel.AgentAddress olda)
Create a new local cognitive environment for newa by copying the Strobe agent local cognitive environment dedicated to olda . |
void |
addAcquaintanceBySharingLocalEnv(madkit.kernel.AgentAddress newa,
madkit.kernel.AgentAddress olda)
Use the same local cognitive environment for newa by sharing the Strobe agent local cognitive environment dedicated to olda . |
abstract void |
analyzeAnswer(java.lang.String res)
This method has to be redefined by Strobe agents; it corresponds to the way answer returned by Strobe message evaluation are analyzed. |
void |
createOrJoinGroup(java.lang.String g)
This method creates and/or joins a group corresponding to the bydefault Strobe agent group. |
StrobeMsg |
dynamicScheduler()
Wait for and return the next message to interpret according to the Strobe agent policy (by default, called waitNextMessage ). |
void |
end()
Method called by the agent micro-kernel at the end of the agent lifecycle; Strobe agents have to use the method StrobeEnd . |
void |
eval(StrobeMsg msg)
Evaluate the Strobe message in the good cognitive environment. |
CognitiveEnv |
getGlobalEnv()
Return the agent global cognitive environment. |
java.util.HashMap |
getLocalEnvs()
Return the agent local environments set; an hashmap of pair (AgentAddress , CognitiveEnv ). |
java.lang.String |
getStrobeAgentGroup()
Return the by default agent group. |
java.lang.String |
getStrobeAgentRole()
Return the by default agent role. |
void |
initializeCognitiveEnvWith(java.lang.String scmfilename)
Load the file scmfilename in the by default Scheme environment used for constructing CognitiveEnv of this Strobe agent. |
boolean |
isAlreadyAcquaintance(madkit.kernel.AgentAddress a)
Return true if a is already an acquaintance. |
void |
live()
This method defines the main behavior for threaded agents; Strobe agents have to use the method StrobeLive . |
void |
print()
Browse all the cognitive environments (locals and global) and send messages present in output streams. |
StrobeMsg |
read()
Choose (with Dynamic Scheduler) next message to interpret and return it; If the message sender is not already an acquaintance then addAcquaintance is called. |
void |
sendMessageAndPrint(madkit.kernel.AgentAddress a,
StrobeMsg m)
Print the StrobeMsg in the Strobe agent output writer just after sending it (using sendMessage ). |
void |
setGlobalEnv(CognitiveEnv gE)
|
void |
setLocalEnvs(java.util.HashMap lEs)
|
void |
setStrobeAgentGroup(java.lang.String g)
|
void |
setStrobeAgentRole(java.lang.String r)
|
void |
strobeActivate()
Replace the method activate for Strobe agents . |
void |
strobeEnd()
Replace the method end for Strobe agents . |
void |
strobeLive()
Replace the method live for Strobe agents . |
madkit.kernel.AgentAddress[] |
viewedAgentAddress()
Return an array of agent addresses corresponding to all the agents (including itself) a Strobe agent can see i.e., having the same groupe and role in the "strobe" community. |
java.lang.String[] |
viewedAgentName()
Return an array of agent names corresponding to all the agents (including itself) a Strobe agent can see i.e., having the same groupe and role in the "strobe" community. |
Methods inherited from class madkit.kernel.Agent |
pause, receiveMessage, run, waitNextMessage, waitNextMessage |
Methods inherited from class madkit.kernel.AbstractAgent |
broadcastMessage, broadcastMessage, connectedWithCommunity, createGroup, createGroup, debug, disposeMyGUI, foundGroup, getAddress, getAgentInformation, getAgentsWithRole, getAgentsWithRole, getAgentWithRole, getAgentWithRole, getAvailableCommunities, getBean, getController, getDebug, getExistingGroups, getExistingGroups, getExistingRoles, getExistingRoles, getGroups, getGUIObject, getMessageBoxSize, getMyGroups, getMyGroups, getMyRoles, getMyRoles, getName, getRoles, hasGUI, initGUI, isCommunity, isGroup, isGroup, isMessageBoxEmpty, isRole, isRole, joinGroup, killAgent, launchAgent, leaveGroup, leaveGroup, leaveRole, leaveRole, nextMessage, print, println, redisplayMyGUI, requestRole, requestRole, requestRole, restoreAgent, sendMessage, sendMessage, sendMessage, setBean, setController, setDebug, setGUIObject, setName, setOutput, setOutputWriter, windowClosing |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public StrobeAbstractAgent()
public StrobeAbstractAgent(java.lang.String n, java.lang.String g, java.lang.String r)
Method Detail |
public java.lang.String getStrobeAgentGroup()
public void setStrobeAgentGroup(java.lang.String g)
public java.lang.String getStrobeAgentRole()
public void setStrobeAgentRole(java.lang.String r)
public CognitiveEnv getGlobalEnv()
public void setGlobalEnv(CognitiveEnv gE)
public java.util.HashMap getLocalEnvs()
hashmap
of pair (AgentAddress
, CognitiveEnv
).
public void setLocalEnvs(java.util.HashMap lEs)
public final void activate()
StrobeActivate
.
public final void live()
StrobeLive
.
public final void end()
StrobeEnd
.
public void strobeActivate()
activate
for Strobe agents .
public void strobeLive()
live
for Strobe agents .
public void strobeEnd()
end
for Strobe agents .
public madkit.kernel.AgentAddress[] viewedAgentAddress()
groupe
and role
in the "strobe" community.
public java.lang.String[] viewedAgentName()
groupe
and role
in the "strobe" community.
public madkit.kernel.AgentAddress[] acquaintanceAddresses()
public java.lang.String[] acquaintanceNames()
public madkit.kernel.AgentAddress[] acquaintanceAndIAddresses()
public java.lang.String[] acquaintanceAndINames()
public boolean isAlreadyAcquaintance(madkit.kernel.AgentAddress a)
true
if a
is already an acquaintance.
public abstract void addAcquaintance(madkit.kernel.AgentAddress a)
CognitiveEnv
when they meet a new agent for the very first time.
public void addAcquaintanceByCopyingGlobalEnv(madkit.kernel.AgentAddress a)
a
by copying the Strobe agent global cognitive environment.
public void addAcquaintanceByCopyingLocalEnv(madkit.kernel.AgentAddress newa, madkit.kernel.AgentAddress olda)
newa
by copying the Strobe agent local cognitive environment dedicated to olda
.
public void addAcquaintanceBySharingLocalEnv(madkit.kernel.AgentAddress newa, madkit.kernel.AgentAddress olda)
newa
by sharing the Strobe agent local cognitive environment dedicated to olda
.
public void initializeCognitiveEnvWith(java.lang.String scmfilename)
scmfilename
in the by default Scheme environment used for constructing CognitiveEnv
of this Strobe agent.
public void createOrJoinGroup(java.lang.String g)
public void sendMessageAndPrint(madkit.kernel.AgentAddress a, StrobeMsg m)
StrobeMsg
in the Strobe agent output writer just after sending it (using sendMessage
).
public StrobeMsg read()
addAcquaintance
is called.
public StrobeMsg dynamicScheduler()
waitNextMessage
).
public void eval(StrobeMsg msg)
public void print()
public abstract void analyzeAnswer(java.lang.String res)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |