DefaultSimulationManager

public class DefaultSimulationManager implements SimulationManager

A default implementation of the SimulationManager class.

Author:Kyle M. Douglass

Constructors

DefaultSimulationManager

public DefaultSimulationManager()

Default constructor.

DefaultSimulationManager

public DefaultSimulationManager(ConcurrentHashMap simulations)

Adds a table of simulations to a new SimulationManager instance.

Parameters:
  • simulations – A table of simulations to add to the new instance.

Methods

addSimulator

public void addSimulator(Simulator simulator)

Adds a simulation to the manager.

Parameters:
  • The – simulation to add to the manager.

getIds

public List<Integer> getIds()

Returns the list of simulation IDs managed by the manager.

Returns:The list of simulation IDs managed by the manager.

getMostRecentMicroscope

public Microscope getMostRecentMicroscope()

Returns the most recent microscope that was used to create a simulation. This method serves as a sort of cache for remembering the most recently created Microscope object. Its purpose is to allow for easy generation of new Simulators. This method will return null if the SimulatorManager has never managed a simulation.

Returns:A copy of the Microscope object or null.

getSimulator

public Simulator getSimulator(int id)

Returns a reference to the simulator corresponding to the ID.

Parameters:
  • id – The ID number of a simulation.
Returns:

A reference to the Simulator.

removeSimulator

public void removeSimulator(int id)

Removes a Simulator from the manager.

Parameters:
  • id – The ID number of a simulation to remove.