|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.time.MarsClock
public class MarsClock
The MarsClock class keeps track of Martian time. This uses Shaun Moss's Mars Calendar, which is described at http://www.virtualmars.net/Time.asp.
Field Summary | |
---|---|
static int |
NORTHERN_HEMISPHERE
|
static int |
SOLS_IN_ORBIT_LEAPYEAR
|
static int |
SOLS_IN_ORBIT_NON_LEAPYEAR
|
static int |
SOUTHERN_HEMISPHERE
|
Constructor Summary | |
---|---|
MarsClock(int orbit,
int month,
int sol,
double millisol)
Constructs a MarsClock object with a given time param orbit current orbit param month current month param sol current sol param millisol current millisol |
|
MarsClock(java.lang.String dateString)
Constructor with date string parameter. |
Method Summary | |
---|---|
void |
addTime(double addedMillisols)
Adds time to the calendar |
java.lang.Object |
clone()
Creates a clone of this MarsClock object, with the time set the same. |
static double |
convertMillisolsToSeconds(double millisols)
Converts millisols to seconds |
static double |
convertSecondsToMillisols(double seconds)
Converts seconds to millisols |
boolean |
equals(java.lang.Object object)
Checks if another object is equal to this one. |
java.lang.String |
getDateString()
Gets the current date string. |
double |
getMillisol()
Returns the millisol |
int |
getMonth()
Returns the month (1 - 24) |
java.lang.String |
getMonthName()
Returns the name of the current month. |
int |
getOrbit()
Returns the orbit |
java.lang.String |
getSeason(int hemisphere)
Returns the current season for the given hemisphere |
int |
getSolOfMonth()
Returns the sol of month (1 - 28) |
int |
getSolOfWeek()
Returns the sol number of the week (1-7) |
java.lang.String |
getSolOfWeekName()
Return the sol name of the week |
static int |
getSolsInMonth(int month,
int orbit)
Returns the number of sols in a month for a given month and orbit. |
int |
getSolsInWeek()
Returns the number of sols in the current week |
static double |
getTimeDiff(MarsClock firstTime,
MarsClock secondTime)
Returns the time difference between two Mars clock instances. |
java.lang.String |
getTimeStamp()
Returns formatted time stamp string. |
java.lang.String |
getTimeString()
Return the current time string. |
int |
getWeekOfMonth()
Returns the week of the month (1-4) |
int |
hashCode()
Gets the hash code for this object. |
static boolean |
isLeapOrbit(int orbit)
Returns true if orbit is a leap orbit, false if not. |
java.lang.String |
toString()
Displays the string version of the clock. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int SOLS_IN_ORBIT_NON_LEAPYEAR
public static final int SOLS_IN_ORBIT_LEAPYEAR
public static final int NORTHERN_HEMISPHERE
public static final int SOUTHERN_HEMISPHERE
Constructor Detail |
---|
public MarsClock(java.lang.String dateString) throws java.lang.Exception
dateString
- format: "orbit-month-sol:millisol"
java.lang.Exception
- if dateString is invalid.public MarsClock(int orbit, int month, int sol, double millisol)
Method Detail |
---|
public static double convertSecondsToMillisols(double seconds)
seconds
- decimal number of seconds
public static double convertMillisolsToSeconds(double millisols)
millisols
- decimal number of millisols
public static double getTimeDiff(MarsClock firstTime, MarsClock secondTime)
firstTime
- first Mars clock instancesecondTime
- second Mars clock instance
public static int getSolsInMonth(int month, int orbit)
month
- the month numberorbit
- the orbit numberpublic static boolean isLeapOrbit(int orbit)
orbit
- the orbit numberpublic void addTime(double addedMillisols)
addedMillisols
- millisols to be added to the calendarpublic java.lang.String getTimeStamp()
public java.lang.String getDateString()
public java.lang.String getTimeString()
public java.lang.String getMonthName()
public int getOrbit()
public int getMonth()
public int getSolOfMonth()
public double getMillisol()
public int getWeekOfMonth()
public int getSolOfWeek()
public java.lang.String getSolOfWeekName()
public int getSolsInWeek()
public java.lang.String getSeason(int hemisphere)
hemisphere
- the hemisphere
NORTHERN_HEMISPHERE or SOUTHERN_HEMISPHERE valid parameters
public java.lang.Object clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |