|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.orekit.time.TimeComponents
public class TimeComponents
Class representing a time within the day broken up as hour, minute and second components.
Instances of this class are guaranteed to be immutable.
DateComponents
,
DateTimeComponents
,
Serialized FormField Summary | |
---|---|
static int |
DEFAULT_SECONDS_PRECISION
Default digit number of the seconds fractional part. |
static TimeComponents |
H00
Constant for commonly used hour 00:00:00. |
static TimeComponents |
H12
Constant for commonly used hour 12:00:00. |
Constructor Summary | |
---|---|
TimeComponents(double secondInDay)
Build a time from the second number within the day. |
|
TimeComponents(int secondInDayA,
double secondInDayB)
Build a time from the second number within the day. |
|
TimeComponents(int hour,
int minute,
double second)
Build a time from its clock elements. |
Method Summary | |
---|---|
int |
compareTo(TimeComponents other)
|
boolean |
equals(Object other)
|
int |
getHour()
Get the hour number. |
int |
getMinute()
Get the minute number. |
double |
getSecond()
Get the seconds number. |
double |
getSecondsInDay()
Get the second number within the day. |
int |
hashCode()
|
static TimeComponents |
parseTime(String string)
Parse a string in ISO-8601 format to build a time. |
String |
toString()
Get a string representation of the time. |
protected String |
toString(int precision,
boolean isTimeNearLeapSecond)
Get a string representation of the time. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_SECONDS_PRECISION
public static final TimeComponents H00
public static final TimeComponents H12
Constructor Detail |
---|
public TimeComponents(int hour, int minute, double second) throws IllegalArgumentException
Note that seconds between 60.0 (inclusive) and 61.0 (exclusive) are allowed
in this method, since they do occur during leap seconds introduction
in the UTC
time scale.
hour
- hour number from 0 to 23minute
- minute number from 0 to 59second
- second number from 0.0 to 61.0 (excluded)
IllegalArgumentException
- if inconsistent arguments
are given (parameters out of range)public TimeComponents(double secondInDay)
secondInDay
- second number from 0.0 to Constants.JULIAN_DAY
(excluded)public TimeComponents(int secondInDayA, double secondInDayB) throws IllegalArgumentException
The second number is defined here as the sum
secondInDayA + secondInDayB
from 0.0 to Constants.JULIAN_DAY
(excluded). The two parameters are used for increased accuracy.
secondInDayA
- first part of the second numbersecondInDayB
- last part of the second number
IllegalArgumentException
- if seconds number is out of rangeMethod Detail |
---|
public static TimeComponents parseTime(String string) throws IllegalArgumentException
The supported formats are:
As this class does not support time zones (because space flight dynamics uses time scales
with offsets from UTC having sub-second accuracy), only UTC is zone is
supported (and in fact ignored). It is the responsibility of the AbsoluteDate
class to
handle time scales appropriately.
string
- string to parse
IllegalArgumentException
- if string cannot be parsedpublic int getHour()
public int getMinute()
public double getSecond()
public double getSecondsInDay()
public String toString()
toString
in class Object
protected String toString(int precision, boolean isTimeNearLeapSecond) throws IllegalArgumentException
precision
- digit number of the seconds fractional partisTimeNearLeapSecond
- true if the date is inside or immediately before
a leap second. It is used to set the upper boundary of the current day:
23:59:60.99.. when true, 23:59:59.99.. when false.
IllegalArgumentException
- if inconsistent arguments
are given (negative precision)public int compareTo(TimeComponents other)
compareTo
in interface Comparable<TimeComponents>
public boolean equals(Object other)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |