|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.time.MasterClock
public class MasterClock
The MasterClock represents the simulated time clock on virtual Mars. Virtual Mars has only one master clock. The master clock delivers a clock pulse the virtual Mars every second or so, which represents a pulse of simulated time. All actions taken with virtual Mars and its units are synchronized with this clock pulse.
Field Summary | |
---|---|
static long |
TIME_PULSE_LENGTH
|
Constructor Summary | |
---|---|
MasterClock()
Constructor |
Method Summary | |
---|---|
void |
addClockListener(ClockListener newListener)
Adds a clock listener |
void |
exitProgram()
Sets the exit program flag. |
EarthClock |
getEarthClock()
Returns the Earth clock |
MarsClock |
getInitialMarsTime()
Gets the initial Mars time at the start of the simulation. |
MarsClock |
getMarsClock()
Returns the Martian clock |
double |
getTimePulse()
Gets the time pulse length |
double |
getTimeRatio()
Gets the simulation/real-time ratio. |
UpTimer |
getUpTimer()
Returns uptime timer |
boolean |
isLoadingSimulation()
Checks if in the process of loading a simulation. |
boolean |
isPaused()
Checks if the simulation is paused or not. |
boolean |
isSavingSimulation()
Checks if in the process of saving a simulation. |
void |
loadSimulation(java.io.File file)
Sets the load simulation flag and the file to load from. |
void |
removeClockListener(ClockListener oldListener)
Removes a clock listener |
void |
run()
Run clock |
void |
saveSimulation(java.io.File file)
Sets the save simulation flag and the file to save to. |
void |
setPaused(boolean isPaused)
Set if the simulation is paused or not. |
void |
setTimeRatio(double ratio)
Sets the simulation/real-time ratio. |
void |
stop()
Stop the clock |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long TIME_PULSE_LENGTH
Constructor Detail |
---|
public MasterClock() throws java.lang.Exception
java.lang.Exception
- if clock could not be constructed.Method Detail |
---|
public MarsClock getMarsClock()
public MarsClock getInitialMarsTime()
public EarthClock getEarthClock()
public UpTimer getUpTimer()
public final void addClockListener(ClockListener newListener)
newListener
- the listener to add.public final void removeClockListener(ClockListener oldListener)
oldListener
- the listener to remove.public void loadSimulation(java.io.File file)
file
- the file to load from.public boolean isLoadingSimulation()
public void saveSimulation(java.io.File file)
file
- save to file or null if default file.public boolean isSavingSimulation()
public void exitProgram()
public double getTimePulse() throws java.lang.Exception
java.lang.Exception
- if time pulse length could not be determined.public void setTimeRatio(double ratio) throws java.lang.Exception
ratio
- the simulation/real-time ratio.
java.lang.Exception
- if parameter is invalid.public double getTimeRatio()
public void run()
run
in interface java.lang.Runnable
public void stop()
public void setPaused(boolean isPaused)
isPaused
- true if simulation is paused.public boolean isPaused()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |