Interface Simulation
-
public interface SimulationThe interface for the main simulation of the ICGE.- Author:
- Tim Neumann
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidattachToWindow(GameWindow window)Attach this simulation to the given window.voidattachToWindow(GameWindow window, boolean stopWithWindowClose)Attach this simulation to the given window.ActionLoggetActionLog()Get the action log for this simulation.EntityTypeRegistrygetEntityTypeRegistry()Get the entity type registry associated with the simulation host.PlayfieldgetPlayfield()Get the playfield for this simulation.SimulationClockgetSimulationClock()Get the simulation clock for this simulation.SimulationProxygetSimulationProxyForWindow()Get the simulation proxy used by the game window to communicate with the simulation.TaskVerifiergetTaskVerifier()Get the task verifier set for this simulation.<E extends Entity,S extends E>
voidrunProgram(Program<E> program, S entity)Run the given program for the given Entity in the background.voidrunTask(Task taskToRun)Run the given task in the background.voidstop()Irreversibly stop the simulation and all running background tasks and programs.
-
-
-
Method Detail
-
getPlayfield
Playfield getPlayfield()
Get the playfield for this simulation.- Returns:
- The playfield used by this simulation
-
getTaskVerifier
TaskVerifier getTaskVerifier()
Get the task verifier set for this simulation.- Returns:
- The task verifier set for this simulation
-
getSimulationClock
SimulationClock getSimulationClock()
Get the simulation clock for this simulation.- Returns:
- the simulation clock used by this simulation
-
getEntityTypeRegistry
EntityTypeRegistry getEntityTypeRegistry()
Get the entity type registry associated with the simulation host.- Returns:
- The entity type registry
-
getActionLog
ActionLog getActionLog()
Get the action log for this simulation.- Returns:
- the action log used by this siumulation
-
getSimulationProxyForWindow
SimulationProxy getSimulationProxyForWindow()
Get the simulation proxy used by the game window to communicate with the simulation.- Returns:
- The simulation proxy for the UI to use
-
attachToWindow
void attachToWindow(GameWindow window)
Attach this simulation to the given window.- Parameters:
window- The window to attach to
-
attachToWindow
void attachToWindow(GameWindow window, boolean stopWithWindowClose)
Attach this simulation to the given window.- Parameters:
window- The window to attach tostopWithWindowClose- Iftruethe simulation will stop when the attached window is closed
-
stop
void stop()
Irreversibly stop the simulation and all running background tasks and programs. Calling this method twice will not throw an exception.
-
runTask
void runTask(Task taskToRun)
Run the given task in the background. Only one task can be run for a simulation so calling this twice will throw an exception.- Parameters:
taskToRun- The task to run
-
runProgram
<E extends Entity,S extends E> void runProgram(Program<E> program, S entity)
Run the given program for the given Entity in the background.- Type Parameters:
E- The subtype of Entity that the Program acceptsS- The type of the Entity to run the program for. Must be a subtype of E- Parameters:
program- The program to runentity- The Entity to run the program for
-
-