public abstract class AbstractStrategy extends Object implements Strategy, Cloneable, Serializable
Modifier and Type | Field and Description |
---|---|
protected Agent |
agent |
protected EventScheduler |
scheduler |
Constructor and Description |
---|
AbstractStrategy() |
AbstractStrategy(Agent agent) |
AbstractStrategy(EventScheduler scheduler,
Agent agent) |
Modifier and Type | Method and Description |
---|---|
Object |
clone() |
void |
eventOccurred(SimEvent event) |
void |
execute(List<Agent> otherAgents)
Execute the behaviour defined by this strategy.
|
void |
fireEvent(SimEvent event) |
Agent |
getAgent() |
EventScheduler |
getScheduler() |
void |
onSimulationFinished() |
void |
setAgent(Agent agent)
Configure the agent associated with this strategy.
|
void |
setScheduler(EventScheduler scheduler) |
void |
subscribeToEvents() |
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. |
protected Agent agent
protected EventScheduler scheduler
public AbstractStrategy()
public AbstractStrategy(Agent agent)
public AbstractStrategy(EventScheduler scheduler, Agent agent)
public void setAgent(Agent agent)
Strategy
public void subscribeToEvents(EventScheduler scheduler)
Strategy
addListener
method in the EventScheduler
class.subscribeToEvents
in interface Strategy
scheduler
- The EventScheduler
on which to listen.public void subscribeToEvents()
public void setScheduler(EventScheduler scheduler)
public EventScheduler getScheduler()
public void unsubscribeFromEvents()
Strategy
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.unsubscribeFromEvents
in interface Strategy
public void eventOccurred(SimEvent event)
eventOccurred
in interface EventListener
public void onSimulationFinished()
public void execute(List<Agent> otherAgents)
Strategy
public void fireEvent(SimEvent event)
public Object clone() throws CloneNotSupportedException
clone
in interface Strategy
clone
in class Object
CloneNotSupportedException
Copyright © 2014. All rights reserved.