|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSimulation
Class that implements a general Simulation
Field Summary | |
protected LinkedList |
agents
Linked lists for tracking all agents in the simulationh |
FrameSequence |
frames
FrameSequence in case the user wants an animation |
BufferedWriter |
output
A BufferedWriter for writing to |
protected World |
world
World that the simulation runs |
Constructor Summary | |
Simulation()
Constructor to set output to null |
Method Summary | |
void |
add(Agent newOne)
Add this actor to the agents list |
void |
closeFile()
close the file and clear the output stream |
void |
endStep(int t)
End of step processing |
LinkedList |
getAgents()
Accessor for all agents |
String |
lineForFile()
lineForFile -- string to write to file on each timeStep. |
void |
openFile(String filename)
Open the input file and set the BufferedWriter to speak to it. |
void |
openFrames(String dir)
Open a frame sequence at the given directory |
void |
remove(Agent newOne)
Remove this actor from the agents list |
void |
run()
Run for a default of 50 steps |
void |
run(int timeRange)
Ask all agents to run for the number of input steps |
void |
setUp()
setUp the simulation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected LinkedList agents
protected World world
public BufferedWriter output
public FrameSequence frames
Constructor Detail |
public Simulation()
Method Detail |
public LinkedList getAgents()
public void add(Agent newOne)
newOne
- agent to add to the listpublic void remove(Agent newOne)
newOne
- agent to remove to the listpublic void setUp()
public void openFile(String filename)
public void openFrames(String dir)
dir
- String where the directory ispublic void run(int timeRange)
public void run()
public void endStep(int t)
t
- timestep countpublic String lineForFile()
public void closeFile()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |