public class Simulation
extends java.lang.Object
Constructor and Description |
---|
Simulation()
Creates a simulation with an empty list of agents
|
Modifier and Type | Method and Description |
---|---|
java.util.List<Agent> |
getAgents()
Returns the list of the agents of the simulation
|
int |
getIteration()
It returns the current iteration of the simulation
starting from zero
|
int |
getSize()
Returns the number of the agents in the simulation
|
void |
live()
Run an iteration of the simulation by calling live
method of all agents.
|
void |
register(Agent agent)
Register an agent in the simulation
|
void |
run(int numIterations)
Runs the whole simulation with the left number of iterations
indicated in the parameter.
|
java.lang.String |
toString()
It returns a representative string of the simulator indicating
the state of all the agents
|
public void register(Agent agent)
public void live()
public void run(int numIterations)
public int getSize()
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<Agent> getAgents()
public int getIteration()