|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectvitro.Controller
public abstract class Controller
A Controller manages the sequencing of turns in a simulation, associates Agents with one or more Actor and provides access to historical records of Actions and Annotations.
Field Summary | |
---|---|
protected Map<Actor,Agent> |
actorAgents
|
protected Set<Agent> |
agents
|
protected Map<Class,Agent> |
classAgents
|
Model |
model
|
Constructor Summary | |
---|---|
Controller(Model model)
Construct a new Controller associated with a given Model. |
Method Summary | ||
---|---|---|
protected List<Actor> |
actors()
Produce a List of Actors which can act during this timestep. |
|
Map<Annotation,Agent> |
annotations()
Obtain a collection of Annotations for the current timestep. |
|
void |
bind(Actor actor,
Agent agent)
Associate a specific Actor with a specified Agent. |
|
void |
bind(Class c,
Agent agent)
Associate every Actor that is an instance of a given Class with a specified Agent. |
|
protected
|
getAction(A a)
Determine the Action a given Actor would choose next. |
|
|
getAgent(A a)
Obtain a reference to the Agent that makes decisions for a specific actor. |
|
boolean |
hasNext()
|
|
boolean |
hasPrev()
|
|
int |
index()
|
|
void |
next()
Advance the simulation. |
|
protected abstract List<Action> |
nextRound()
This method is used to determine the order in which Actions will be applied. |
|
void |
prev()
Restore the simulation to the previous state. |
|
List<Action> |
previousActions()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Model model
protected final Set<Agent> agents
protected final Map<Class,Agent> classAgents
protected final Map<Actor,Agent> actorAgents
Constructor Detail |
---|
public Controller(Model model)
model
- the model which will be driven by this controller.Method Detail |
---|
public void bind(Class c, Agent agent)
c
- the Class of Actors to which the Agent will apply.agent
- the Agent to associate with Actors.public void bind(Actor actor, Agent agent)
actor
- the Actor to which the Agent will apply.agent
- the Agent to associate with an Actor.public <A extends Actor> Agent<A> getAgent(A a)
a
- an Actor to examine.
protected <A extends Actor> Action getAction(A a)
a
- an Actor for which to decide.
public boolean hasNext()
public boolean hasPrev()
public void next()
public void prev()
public Map<Annotation,Agent> annotations()
public List<Action> previousActions()
protected List<Actor> actors()
public int index()
protected abstract List<Action> nextRound()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |