|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object se.sics.tasim.aw.Agent TACAgent
public class TACAgent
The main agent class. Each day, messages from the server are received and processed. The agent's information is updated, the managers perform their tasks, the information is updated again with the results, and then messages are sent to the server.
Field Summary | |
---|---|
private DailyActions |
actions
the messages to be sent by the agent at the end of the day |
private AgentInfo |
agentInfo
stores the agent's state |
private java.lang.String |
agentName
the agent's name |
private boolean |
debugMode
|
private InterfaceDemandManager |
demandManager
the demand manager object |
private java.util.Hashtable |
managers
stores manager classes by name to allow reuse |
private GameSettings |
settings
the game parameters sent at the beginning of the game |
private InterfaceSupplyManager |
supplyManager
the supply manager object |
private java.io.PrintStream |
textLog
where to write any output |
private DailyInfo |
todaysInfo
the information received at the beginning of the day |
Fields inherited from class se.sics.tasim.aw.Agent |
---|
ADMIN, COORDINATOR |
Constructor Summary | |
---|---|
TACAgent()
|
|
TACAgent(java.lang.String name)
The constructor for debug mode. |
Method Summary | |
---|---|
void |
eveningUpdate(DailyActions actions)
Update agent with actions performed that day. |
private java.lang.Object |
getManager(java.lang.String name)
Return a manager object based on the class name. |
private java.lang.String |
getNextLine(java.io.BufferedReader f)
|
protected void |
messageReceived(se.sics.tasim.aw.Message message)
A method of the Agent superclass, called with each message received from the server, either at the start of the game or the beginning of each day. |
void |
morningUpdate(DailyInfo todaysInfo)
Update agent with information received at the start of the day. |
void |
nextTimeUnit(int date)
|
private void |
processStartInfo(se.sics.tasim.props.StartInfo info)
Handles the information we are given at the start of the game. |
private void |
readConfig()
Reads in the agent parameters (such as manager classes) from the config file with name [agentName]Config.txt |
private void |
sendMessages()
Sends all of the messages generated today. |
void |
setGameSettings(GameSettings settings)
Sets the game settings. |
protected void |
simulationFinished()
A method of the Agent superclass, called when the game ends. |
protected void |
simulationSetup()
A method of the Agent superclass, called when the agent starts. |
void |
simulationStopped()
A method of the Agent superclass, called when the game ends. |
void |
startDay()
The method that performs each day's tasks. |
Methods inherited from class se.sics.tasim.aw.Agent |
---|
addTimeListener, getAddress, getName, getNextID, getServerTime, removeTimeListener, sendMessage, sendMessage, sendMessages, sendToRole |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private boolean debugMode
private DailyInfo todaysInfo
private GameSettings settings
private AgentInfo agentInfo
private DailyActions actions
private java.io.PrintStream textLog
private java.lang.String agentName
private java.util.Hashtable managers
private InterfaceDemandManager demandManager
private InterfaceSupplyManager supplyManager
Constructor Detail |
---|
public TACAgent(java.lang.String name)
name
- the name the agent ran as (e.g., Dummy3)public TACAgent() throws java.lang.Exception
java.lang.Exception
Method Detail |
---|
public void nextTimeUnit(int date)
nextTimeUnit
in interface se.sics.tasim.aw.TimeListener
private java.lang.String getNextLine(java.io.BufferedReader f) throws java.lang.Exception
java.lang.Exception
private java.lang.Object getManager(java.lang.String name) throws java.lang.Exception
name
- the class name
java.lang.Exception
protected void simulationSetup()
simulationSetup
in class se.sics.tasim.aw.Agent
private void readConfig()
protected void simulationFinished()
simulationFinished
in class se.sics.tasim.aw.Agent
protected void messageReceived(se.sics.tasim.aw.Message message)
messageReceived
in class se.sics.tasim.aw.Agent
public void startDay() throws java.lang.Exception
java.lang.Exception
private void sendMessages()
private void processStartInfo(se.sics.tasim.props.StartInfo info)
info
- starting info (BOM, catalog, etc.)public void simulationStopped()
simulationStopped
in class se.sics.tasim.aw.Agent
public void morningUpdate(DailyInfo todaysInfo)
todaysInfo
- all messages receivedpublic void eveningUpdate(DailyActions actions)
actions
- all outgoing messagespublic void setGameSettings(GameSettings settings)
settings
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |