|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectse.sics.tasim.aw.Agent
public abstract class Agent
The abstract class Agent
should be inherited by all
implementations of agents that wants to be able to participate in TAC Games
or other Trading Agent Simulations on the TAC SCM Simulator.
Agents can be run both within the Simulator as built-in agents or they can
run outside the Simulator (in the AgentWare) and connect to it via Internet.
Features of Agent:
simulationSetup
.
Field Summary | |
---|---|
static java.lang.String |
ADMIN
The address to the server administrator |
static java.lang.String |
COORDINATOR
The address to the simulation coordinator |
Constructor Summary | |
---|---|
protected |
Agent()
|
Method Summary | |
---|---|
protected void |
addTimeListener(TimeListener listener)
Adds the specified time listener to receive notifications about time units. |
java.lang.String |
getAddress()
Returns the address of this agent |
java.lang.String |
getName()
Returns the name of this agent |
protected int |
getNextID()
Returns a unique ID for use in various messages |
protected long |
getServerTime()
Returns the server time. |
protected abstract void |
messageReceived(Message message)
messageReceived is called when a message to the agent is received. |
protected void |
removeTimeListener(TimeListener listener)
Removes the specified time listener so that it no longer receives notifications about time units. |
protected void |
sendMessage(Message message)
Send a message to another agent in a game/simulation |
protected void |
sendMessage(java.lang.String receiver,
Transportable content)
Create and send a message to another agent in a game/simulation |
protected void |
sendMessages(java.util.Hashtable messageTable)
Extract all receivers and message contents from the hash table and sends them. |
protected void |
sendToRole(int role,
Transportable content)
|
protected abstract void |
simulationFinished()
Called when a game/simulation is finished and the agent should free its resources. |
protected abstract void |
simulationSetup()
Called when a game/simulation is starting and the agent should initialize |
protected void |
simulationStopped()
Called when a game/simulation is in the process of being stopped. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String COORDINATOR
public static final java.lang.String ADMIN
Constructor Detail |
---|
protected Agent()
Method Detail |
---|
public java.lang.String getName()
public java.lang.String getAddress()
protected long getServerTime()
protected int getNextID()
protected void addTimeListener(TimeListener listener)
listener
- the time listenerprotected void removeTimeListener(TimeListener listener)
listener
- the time listenerprotected void sendMessage(Message message)
message
- to sendprotected void sendMessage(java.lang.String receiver, Transportable content)
receiver
- of the messagecontent
- of the messageprotected void sendMessages(java.util.Hashtable messageTable)
messageTable
- a Hashtable
mapping agent addresses (receivers)
with Transportable objects (message contents)protected void sendToRole(int role, Transportable content)
protected abstract void messageReceived(Message message)
message
- the received messageprotected abstract void simulationSetup()
protected void simulationStopped()
protected abstract void simulationFinished()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |