|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjsky.coords.HMS
public class HMS
Class representing a value of the form "hours:min:sec".
Constructor Summary | |
---|---|
HMS()
Default constructor: initialize to null values |
|
HMS(double val)
Initialize from a decimal hours value and calculate H:M:S.sss. |
|
HMS(double hours,
int min,
double sec)
Initialize with the given hours, minutes and seconds. |
|
HMS(HMS hms)
Copy constructor |
|
HMS(java.lang.String s)
Initialize from a string value, in format H:M:S.sss, hh, or H M S. |
|
HMS(java.lang.String s,
boolean hflag)
Initialize from a string value, in format H:M:S.sss, hh, or H M S. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Define equality based on the value |
int |
getHours()
Return the number of hours (not including minutes or seconds) |
int |
getMin()
Return the number of minutes (not including hours or seconds) |
double |
getSec()
Return the number of seconds (not including hours and minutes) |
byte |
getSign()
Return the sign of the value |
double |
getVal()
Return the value (fractional number of hours) as a double |
boolean |
isInitialized()
Return true if this object has been initialized with a valid value |
static void |
main(java.lang.String[] args)
Test cases |
void |
set(double hours,
int min,
double sec)
Set the hours, minutes and seconds. |
void |
setVal(double val)
Set from a decimal value (hours) and calculate H:M:S.sss. |
java.lang.String |
toString()
Return the value as a String in the form hh:mm:ss.sss. |
java.lang.String |
toString(boolean showSeconds)
Return the value as a String in the form hh:mm:ss.sss, or if showSeconds is false, hh:mm. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public HMS()
public HMS(double hours, int min, double sec)
public HMS(double val)
public HMS(HMS hms)
public HMS(java.lang.String s)
public HMS(java.lang.String s, boolean hflag)
s
- the RA stringhflag
- if true, assume RA is always in hours, otherwise, if it has a decimal point,
assume degMethod Detail |
---|
public void set(double hours, int min, double sec)
public void setVal(double val)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(boolean showSeconds)
public boolean isInitialized()
public int getHours()
public int getMin()
public double getSec()
public double getVal()
public byte getSign()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |