|
JEphem site jephem API |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--tig.Time
Class containing utility static methods for date manipulation.
The manipulation of dates is based on the use of 'julian days'.
The internationalization of this class is hard coded. The reason is that parseDate
and formatHourDate
methods are locale dependant and must be modified if new languages are added.
Internationalized error messages have been hard coded to keep this class independant
from properties files.
Field Summary |
Fields inherited from interface tig.GeneralConstants |
BLANK, FS, LS, NO_SPECIF |
Constructor Summary | |
Time()
|
Method Summary | |
static double |
calcDecDay(int d,
int h,
int m,
int s)
Returns the decimal part of the day. |
static java.lang.String |
formatDate(int[] date,
java.lang.String lang)
Formats a date into a displayable String. |
static java.lang.String |
formatDate(java.lang.String strDate,
java.lang.String lang)
Formats a date the same way formatDate(int[], String) does. |
static java.lang.String |
formatHour(int[] hour,
java.lang.String lang)
Formats an hour into a displayable String. |
static java.lang.String |
formatHour(java.lang.String strHour,
java.lang.String lang)
Formats a date the same way formatHour(int[], String) does. |
static java.lang.String |
formatHourDate(int[] hourDate,
java.lang.String lang)
Formats a date and an hour into a displayable String. |
static java.lang.String |
formatHourDate(java.lang.String strDate,
java.lang.String strHour,
java.lang.String lang)
Formats a date the same way formatHourDate(int[], String) does. |
static boolean |
isLeapYear(int y)
Tests if y corresponds to a leap year. |
static int[] |
parseDate(java.lang.String strDate,
java.lang.String lang)
Transforms a date representated as a String to an array of integers containing the year, month, day. |
static int[] |
parseHour(java.lang.String strHour,
java.lang.String lang)
Transforms an hour representated as a String to an array of integers containing (in this order : hours, minutes, seconds. |
static int[] |
parseHourDate(java.lang.String strDate,
java.lang.String strHour,
java.lang.String lang)
Transforms a date and an hour representated as Strings to an array of integers containing (in this order : years, months, days, hours, minutes, seconds. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Time()
Method Detail |
public static boolean isLeapYear(int y)
y
corresponds to a leap year.
y
- positive number representing the year to test.
y
is positive and corresponds to a leap year.public static java.lang.String formatHourDate(int[] hourDate, java.lang.String lang)
hourDate
- An array containing integers representing : year, month, day, hour, minut, second.lang
- language code, as specified by ISO-639 norm (supported languages : "en" and "fr").
java.lang.IllegalArgumentException
- if :
public static java.lang.String formatDate(int[] date, java.lang.String lang)
date
- An array containing 3 integers representing : year, month, day.lang
- language code, as specified by ISO-639 norm (supported languages : "en" and "fr").
java.lang.IllegalArgumentException
- if :
public static java.lang.String formatHour(int[] hour, java.lang.String lang)
hour
- An array containing 3 integers representing : hour, minut, second.
java.lang.IllegalArgumentException
- if :
public static java.lang.String formatHourDate(java.lang.String strDate, java.lang.String strHour, java.lang.String lang) throws DateFormatException, HourFormatException
formatHourDate(int[], String)
does.
DateFormatException
- if parameter 'strDate' is not correct.
HourFormatException
- if parameter 'strHour' is not correct.public static java.lang.String formatDate(java.lang.String strDate, java.lang.String lang) throws DateFormatException
formatDate(int[], String)
does.
DateFormatException
- if parameter 'strDate' is not correct.public static java.lang.String formatHour(java.lang.String strHour, java.lang.String lang) throws HourFormatException
formatHour(int[], String)
does.
HourFormatException
- if parameter 'strHour' is not correct.public static int[] parseHourDate(java.lang.String strDate, java.lang.String strHour, java.lang.String lang) throws DateFormatException, HourFormatException, java.lang.IllegalArgumentException
parseHour(String, String)
and parseDate(String, String)
.
See their documentation for informations about parameter formats and exception thrown.
DateFormatException
HourFormatException
java.lang.IllegalArgumentException
public static int[] parseDate(java.lang.String strDate, java.lang.String lang) throws DateFormatException, java.lang.IllegalArgumentException
strDate | years | months | days |
---|---|---|---|
18/07/1998 | 18 | 7 | 1998 |
18.007:1998 | 18 | 7 | 1998 |
9-10 2000 | 9 | 10 | 2000 |
9 10 1 | 9 | 10 | 1 |
9 10 -16 | 9 | 10 | -16 |
9-10--16 | 9 | 10 | -16 |
9-10-16 | 9 | 10 | 16 |
strDate | year | Month | Day |
---|---|---|---|
07/18/1998 | 18 | 7 | 1998 |
007:18.1998 | 18 | 7 | 1998 |
9-10 2000 | 10 | 9 | 2000 |
9 10 1 | 9 | 10 | 1 |
9 10 -16 | 10 | 9 | -16 |
9-10--16 | 10 | 9 | -16 |
9-10-16 | 10 | 9 | 16 |
strDate
- A String containing the date, as specified above.lang
- language code, as specified by ISO-639 norm (supported languages : "en" and "fr").
java.lang.IllegalArgumentException
- if parameter 'lang' is different from 'en' or 'fr'.
DateFormatException
- if parameter 'strDate' is not correctly formatted.public static int[] parseHour(java.lang.String strHour, java.lang.String lang) throws HourFormatException, java.lang.IllegalArgumentException
strHour | hours | minuts | seconds |
---|---|---|---|
(empty string) | 0 | 0 | 0 |
12 | 12 | 0 | 0 |
12h30m | 12 | 30 | 0 |
-12:30:40s | 12 | 30 | 40 |
000012h000030m00040 | 12 | 30 | 40 |
strHour
- A String containing the hour, as specified above..lang
- language code, as specified by ISO-639 norm (supported languages : 'en' and 'fr').
HourFormatException
- if parameter 'strHour' is not correctly formatted.
java.lang.IllegalArgumentException
- if parameter 'lang' is different from 'en' or 'fr'.public static double calcDecDay(int d, int h, int m, int s)
|
JEphem site jephem API |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |