org.mars_sim.msp.simulation
Class Simulation

java.lang.Object
  extended by org.mars_sim.msp.simulation.Simulation
All Implemented Interfaces:
java.io.Serializable, ClockListener

public class Simulation
extends java.lang.Object
implements ClockListener, java.io.Serializable

The Simulation class is the primary singleton class in the MSP simulation. It's capable of creating a new simulation or loading/saving an existing one.

See Also:
Serialized Form

Field Summary
static java.lang.String DEFAULT_DIR
           
static java.lang.String DEFAULT_FILE
           
static java.lang.String VERSION
           
 
Method Summary
 void clockPulse(double time)
          Clock pulse from master clock
static void createNewSimulation()
          Creates a new simulation instance.
 CreditManager getCreditManager()
          Gets the credit manager.
 HistoricalEventManager getEventManager()
          Get the historical event manager.
 MalfunctionFactory getMalfunctionFactory()
          Get the malfunction factory.
 Mars getMars()
          Get the planet Mars.
 MasterClock getMasterClock()
          Get the master clock.
 MedicalManager getMedicalManager()
          Get the medical manager.
 MissionManager getMissionManager()
          Get the mission manager.
 RelationshipManager getRelationshipManager()
          Get the relationship manager.
 UnitManager getUnitManager()
          Get the unit manager.
static Simulation instance()
          Gets a singleton instance of the simulation.
 boolean isDefaultLoad()
          Checks if simulation was loaded from default save file.
 void loadSimulation(java.io.File file)
          Loads a simulation instance from a save file.
 void saveSimulation(java.io.File file)
          Saves a simulation instance to a save file.
 void start()
          Start the simulation.
 void stop()
          Stop the simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERSION

public static final java.lang.String VERSION
See Also:
Constant Field Values

DEFAULT_FILE

public static final java.lang.String DEFAULT_FILE
See Also:
Constant Field Values

DEFAULT_DIR

public static final java.lang.String DEFAULT_DIR
See Also:
Constant Field Values
Method Detail

instance

public static Simulation instance()
Gets a singleton instance of the simulation.

Returns:
Simulation instance

createNewSimulation

public static void createNewSimulation()
                                throws java.lang.Exception
Creates a new simulation instance.

Throws:
java.lang.Exception - if new simulation could not be created.

loadSimulation

public void loadSimulation(java.io.File file)
                    throws java.lang.Exception
Loads a simulation instance from a save file.

Parameters:
file - the file to be loaded from.
Throws:
java.lang.Exception - if simulation could not be loaded.

saveSimulation

public void saveSimulation(java.io.File file)
                    throws java.lang.Exception
Saves a simulation instance to a save file.

Parameters:
file - the file to be saved to.
Throws:
java.lang.Exception - if simulation could not be saved.

start

public void start()
Start the simulation.


stop

public void stop()
Stop the simulation.


clockPulse

public void clockPulse(double time)
Clock pulse from master clock

Specified by:
clockPulse in interface ClockListener
Parameters:
time - amount of time passing (in millisols)

getMars

public Mars getMars()
Get the planet Mars.

Returns:
Mars

getUnitManager

public UnitManager getUnitManager()
Get the unit manager.

Returns:
unit manager

getMissionManager

public MissionManager getMissionManager()
Get the mission manager.

Returns:
mission manager

getRelationshipManager

public RelationshipManager getRelationshipManager()
Get the relationship manager.

Returns:
relationship manager.

getCreditManager

public CreditManager getCreditManager()
Gets the credit manager.

Returns:
credit manager.

getMalfunctionFactory

public MalfunctionFactory getMalfunctionFactory()
Get the malfunction factory.

Returns:
malfunction factory

getEventManager

public HistoricalEventManager getEventManager()
Get the historical event manager.

Returns:
historical event manager

getMedicalManager

public MedicalManager getMedicalManager()
Get the medical manager.

Returns:
medical manager

getMasterClock

public MasterClock getMasterClock()
Get the master clock.

Returns:
master clock

isDefaultLoad

public boolean isDefaultLoad()
Checks if simulation was loaded from default save file.

Returns:
true if default load.