public interface Strategy extends EventListener, Cloneable
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
execute(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. |
eventOccurred
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(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.Object clone() throws CloneNotSupportedException
CloneNotSupportedException
Copyright © 2014. All rights reserved.