public class HMS extends Object implements Serializable
Constructor and Description |
---|
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(String s)
Initialize from a string value, in format H:M:S.sss, hh, or H M
S.
|
HMS(String s,
boolean hflag)
Initialize from a string value, in format H:M:S.sss, hh, or
H M S.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(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(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.
|
String |
toString()
Return the value as a String in the form hh:mm:ss.sss.
|
public HMS()
public HMS(double hours, int min, double sec)
public HMS(double val)
public HMS(HMS hms)
public HMS(String s)
public HMS(String s, boolean hflag)
s
- the RA stringhflag
- if true, assume RA is always in hours, otherwise, if it has a decimal point,
assume degpublic void set(double hours, int min, double sec)
public void setVal(double val)
public String toString()
public boolean isInitialized()
public int getHours()
public int getMin()
public double getSec()
public double getVal()
public byte getSign()
public boolean equals(Object obj)
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.