Package itumulator.executable
Class Program
java.lang.Object
itumulator.executable.Program
Sets up the program to run simulations. The Program will handle creation of
World
, Simulator
, Canvas
, Frame
and correctly
connect these. As such, one can instantiate a single Program
and access relevant objects through this, as well as running the simulation.
The Program contains two views (changable by clicking the topic right button). It defaults to the isomorphic 2.5d perspective, unless the size of the map exceeds 20.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionProvides the canvas itself, responsible for drawing contents (Not necessary to execute the simulation).int
getDelay()
Get the current delay (in ms)getFrame()
Provides the frame itself, responsible for buttons (Not necessary to execute the simulation).Provides the simulator itself, responsible for execution of simulations (Not necessary to execute the simulation).int
getSize()
Provides the size of the worldgetWorld()
Provides the world which this program concerns itself with.void
run()
Executes rounds of simulation using the delay (in ms) given.void
setDelay
(int delay) Adjust the delay (in ms) betweenrun
executionsvoid
Decide on the graphical representation of objects when shown within the GUI.void
show()
Used to initially show the graphical interface.void
simulate()
Executes a single 'step' of simulation.
-
Constructor Details
-
Program
public Program(int size, int display_size, int delay) Produces a new program.- Parameters:
size
- the size of the world to render (will be square).display_size
- of the graphical window.delay
- inbetween simulation steps when runningrun()
.
-
-
Method Details
-
getWorld
Provides the world which this program concerns itself with. Using this world object you can add new actors to the world.- Returns:
World
wherein one can add elements to simulate.
-
getSimulator
Provides the simulator itself, responsible for execution of simulations (Not necessary to execute the simulation).- Returns:
- Simulator
-
getCanvas
Provides the canvas itself, responsible for drawing contents (Not necessary to execute the simulation).- Returns:
- Canvas.
-
getFrame
Provides the frame itself, responsible for buttons (Not necessary to execute the simulation).- Returns:
- Frame.
-
getSize
public int getSize()Provides the size of the world- Returns:
- int representing both x and y dimensions.
-
show
public void show()Used to initially show the graphical interface. -
simulate
public void simulate()Executes a single 'step' of simulation. -
run
public void run()Executes rounds of simulation using the delay (in ms) given. -
setDelay
public void setDelay(int delay) Adjust the delay (in ms) betweenrun
executions- Parameters:
delay
- in ms
-
getDelay
public int getDelay()Get the current delay (in ms)- Returns:
- int.
-
setDisplayInformation
Decide on the graphical representation of objects when shown within the GUI.- Parameters:
cl
- is the class which to associate a given display type with (can be accessed by writing [ClassName].class).di
- theDisplayInformation
to associate the type of object with.
-