|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Strategy
Classes implementing this interface define strategies for agents. A strategy encapsulates the behaviour of the agent. Different agents of the same type may be configured with heterogenous behaviours, and a single agent can switch between several different behaviours during the course of a simulation. Since the outcome of following a specific behaviour can depend on the actions of other agents we use the term strategy from game-theory to refer to behaviours.
Method Summary | |
---|---|
java.lang.Object |
clone()
|
void |
execute(java.util.List<Agent> otherAgents)
Execute the behaviour defined by this strategy. |
Agent |
getAgent()
|
void |
setAgent(Agent agent)
Configure the agent associated with this strategy. |
void |
subscribeToEvents(EventScheduler scheduler)
A Strategy should subscribe to any events it wants to receive by calling the addListener method in the EventScheduler class. |
void |
unsubscribeFromEvents()
The strategy should call EventScheduler.removeListener()
to unsubscribe from events when this method is called. |
Methods inherited from interface net.sourceforge.jabm.event.EventListener |
---|
eventOccurred |
Method Detail |
---|
void setAgent(Agent agent)
Agent getAgent()
void subscribeToEvents(EventScheduler scheduler)
addListener
method in the EventScheduler
class.
scheduler
- The EventScheduler
on which to listen.void execute(java.util.List<Agent> otherAgents)
otherAgents
- The other agents with which the agent associated
with this strategy is interacting.void unsubscribeFromEvents()
EventScheduler.removeListener()
to unsubscribe from events when this method is called. This hook is
used to clean-up, for example when the strategy is disposed of.
java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |