net.aerith.misao.util
Class JulianDay

java.lang.Object
  |
  +--net.aerith.misao.util.JulianDay

public class JulianDay
extends java.lang.Object

The JulianDay represents a Julian Day.

It keeps the date and time value in two styles. One is the Julian Day in double. Another one is the set of year, month and day in int, int and double repsectively.


Field Summary
protected  double day
          The day value of this date and time.
static int FORMAT_DECIMALDAY_100000TH
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23.45678".
static int FORMAT_DECIMALDAY_10000TH
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23.4567".
static int FORMAT_DECIMALDAY_1000TH
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23.456".
static int FORMAT_DECIMALDAY_100TH
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23.45".
static int FORMAT_DECIMALDAY_10TH
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23.4".
static int FORMAT_DECIMALDAY_1TH
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23".
static int FORMAT_DEFAULT
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23.45678".
static int FORMAT_JD
          The number of type to output month, which represents to output the Julian Day such as "2451234.12345".
static int FORMAT_MONTH_IN_CODE
          The number of type to output month, which represents to output the code of month such as "2000 Jan 23".
static int FORMAT_MONTH_IN_FULL_SPELL
          The number of type to output month, which represents to output the full spell name such as "2000 January 23".
static int FORMAT_MONTH_IN_NUMBER
          The number of type to output month, which represents to output the month in number such as "2000 01 23".
static int FORMAT_MONTH_IN_NUMBER_WITHOUT_SPACE
          The number of type to output month, which represents to output the month in number without space such as "20000123".
static int FORMAT_MONTH_IN_REDUCED
          The number of type to output month, which represents to output the reduced name such as "2000 Jan.
static int FORMAT_TO_DAY
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23".
static int FORMAT_TO_HOUR
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23 01h".
static int FORMAT_TO_MINUTE
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23 01:23".
static int FORMAT_TO_SECOND
          The number of output accuracy type, which represents to output such a string as "2000 Jan 23 01:23:45".
protected  double julian_day
          The value of this date and time in Julian Day.
protected  int month
          The month value of this date and time.
protected static java.lang.String[] month_code
          The output codes of months.
protected static java.lang.String[] month_full_name
          The full spell output strings of months.
protected static java.lang.String[] month_reduced_name
          The reduced output strings of months.
protected  int year
          The year value of this date and time.
 
Constructor Summary
JulianDay()
          Constructs a JulianDay at J2000.0.
JulianDay(double initial_jd)
          Constructs a JulianDay of the specified Julian Day.
JulianDay(int initial_year, int initial_month, double initial_day)
          Constructs a JulianDay of the specified year, month and day.
JulianDay(int initial_year, int initial_month, int initial_day, int initial_hour, int initial_minute, double initial_second)
          Constructs a JulianDay of the specified year, month, day, hour, minute, and second.
 
Method Summary
static JulianDay create(java.util.Date date)
          Creates a JulianDay object from the specified local time considering the time zone.
static JulianDay create(java.lang.String string)
          Creates a JulianDay object from the specified string.
static int getAccuracy(java.lang.String string)
          Gets a accuracy of the specified date string.
 int getDay()
          Gets the day.
 double getDecimalDay()
          Gets the day and time in day.
static int getEquivalentAccuracy(int date_accuracy)
          Gets the equivalent accuracy of the specified accuracy.
static java.lang.String getFullSpellMonthString(int m)
          Gets the full spell name of the specified month.
 int getHour()
          Gets the hour.
 double getJD()
          Gets date and time value of this object as Julian Day.
 int getMinute()
          Gets the minute.
 int getMonth()
          Gets the month.
static int getMonth(java.lang.String month)
          Gets the month of the specified month string.
static java.lang.String getMonthCode(int m)
          Gets the code of the specified month.
 java.lang.String getOutputString(int month_format, int date_accuracy)
          Returns a string representation of the state of this object in the specified format.
static java.lang.String getReducedMonthString(int m)
          Gets the reduced name of the specified month.
 int getSecond()
          Gets the second.
 int getYear()
          Gets the year.
static boolean isDecimalDay(int date_accuracy)
          Returns true when the specified accuracy represents decimal day.
 JulianDay round(int date_accuracy)
          Rounds this day to the accuracy of the specified format and creates a new JulianDay object.
protected  void updateYearMonthDay()
          Converts the Julian Day of this object into year, month and day, and sets them into the member fields of this object.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

julian_day

protected double julian_day
The value of this date and time in Julian Day.

year

protected int year
The year value of this date and time.

month

protected int month
The month value of this date and time.

day

protected double day
The day value of this date and time.

month_full_name

protected static final java.lang.String[] month_full_name
The full spell output strings of months.

month_reduced_name

protected static final java.lang.String[] month_reduced_name
The reduced output strings of months.

month_code

protected static final java.lang.String[] month_code
The output codes of months.

FORMAT_DEFAULT

public static final int FORMAT_DEFAULT
The number of output accuracy type, which represents to output such a string as "2000 Jan 23.45678".

FORMAT_DECIMALDAY_100000TH

public static final int FORMAT_DECIMALDAY_100000TH
The number of output accuracy type, which represents to output such a string as "2000 Jan 23.45678".

FORMAT_DECIMALDAY_10000TH

public static final int FORMAT_DECIMALDAY_10000TH
The number of output accuracy type, which represents to output such a string as "2000 Jan 23.4567".

FORMAT_DECIMALDAY_1000TH

public static final int FORMAT_DECIMALDAY_1000TH
The number of output accuracy type, which represents to output such a string as "2000 Jan 23.456".

FORMAT_DECIMALDAY_100TH

public static final int FORMAT_DECIMALDAY_100TH
The number of output accuracy type, which represents to output such a string as "2000 Jan 23.45".

FORMAT_DECIMALDAY_10TH

public static final int FORMAT_DECIMALDAY_10TH
The number of output accuracy type, which represents to output such a string as "2000 Jan 23.4".

FORMAT_DECIMALDAY_1TH

public static final int FORMAT_DECIMALDAY_1TH
The number of output accuracy type, which represents to output such a string as "2000 Jan 23".

FORMAT_TO_SECOND

public static final int FORMAT_TO_SECOND
The number of output accuracy type, which represents to output such a string as "2000 Jan 23 01:23:45".

FORMAT_TO_MINUTE

public static final int FORMAT_TO_MINUTE
The number of output accuracy type, which represents to output such a string as "2000 Jan 23 01:23".

FORMAT_TO_HOUR

public static final int FORMAT_TO_HOUR
The number of output accuracy type, which represents to output such a string as "2000 Jan 23 01h".

FORMAT_TO_DAY

public static final int FORMAT_TO_DAY
The number of output accuracy type, which represents to output such a string as "2000 Jan 23".

FORMAT_MONTH_IN_FULL_SPELL

public static final int FORMAT_MONTH_IN_FULL_SPELL
The number of type to output month, which represents to output the full spell name such as "2000 January 23".

FORMAT_MONTH_IN_REDUCED

public static final int FORMAT_MONTH_IN_REDUCED
The number of type to output month, which represents to output the reduced name such as "2000 Jan. 23".

FORMAT_MONTH_IN_CODE

public static final int FORMAT_MONTH_IN_CODE
The number of type to output month, which represents to output the code of month such as "2000 Jan 23".

FORMAT_MONTH_IN_NUMBER

public static final int FORMAT_MONTH_IN_NUMBER
The number of type to output month, which represents to output the month in number such as "2000 01 23".

FORMAT_MONTH_IN_NUMBER_WITHOUT_SPACE

public static final int FORMAT_MONTH_IN_NUMBER_WITHOUT_SPACE
The number of type to output month, which represents to output the month in number without space such as "20000123".

FORMAT_JD

public static final int FORMAT_JD
The number of type to output month, which represents to output the Julian Day such as "2451234.12345".
Constructor Detail

JulianDay

public JulianDay()
Constructs a JulianDay at J2000.0.

JulianDay

public JulianDay(double initial_jd)
Constructs a JulianDay of the specified Julian Day.
Parameters:
initial_jd - the Julian Day.

JulianDay

public JulianDay(int initial_year,
                 int initial_month,
                 double initial_day)
Constructs a JulianDay of the specified year, month and day.
Parameters:
initial_year - the year of the date and time to construct.
initial_month - the month of the date and time to construct.
initial_day - the day of the date and time to construct.

JulianDay

public JulianDay(int initial_year,
                 int initial_month,
                 int initial_day,
                 int initial_hour,
                 int initial_minute,
                 double initial_second)
Constructs a JulianDay of the specified year, month, day, hour, minute, and second.
Parameters:
initial_year - the year of the date and time to construct.
initial_month - the month of the date and time to construct.
initial_day - the day of the date and time to construct.
initial_hour - the hour of the date and time to construct.
initial_minute - the minute of the date and time to construct.
initial_second - the second of the date and time to construct.
Method Detail

create

public static JulianDay create(java.util.Date date)
Creates a JulianDay object from the specified local time considering the time zone.
Parameters:
date - the Date object of the local time.
Returns:
the new JulianDay object.

create

public static JulianDay create(java.lang.String string)
Creates a JulianDay object from the specified string.
Parameters:
string - the string which represents the date and time.
Returns:
the new JulianDay object.

getAccuracy

public static int getAccuracy(java.lang.String string)
Gets a accuracy of the specified date string.
Parameters:
string - the string which represents the date and time.
Returns:
the format number of the date accuracy.

updateYearMonthDay

protected void updateYearMonthDay()
Converts the Julian Day of this object into year, month and day, and sets them into the member fields of this object.

getJD

public double getJD()
Gets date and time value of this object as Julian Day.
Returns:
the Julian Day.

getYear

public int getYear()
Gets the year.
Returns:
the year.

getMonth

public int getMonth()
Gets the month.
Returns:
the month.

getDay

public int getDay()
Gets the day.
Returns:
the day.

getDecimalDay

public double getDecimalDay()
Gets the day and time in day.
Returns:
the day and time in day.

getHour

public int getHour()
Gets the hour.
Returns:
the hour.

getMinute

public int getMinute()
Gets the minute.
Returns:
the minute.

getSecond

public int getSecond()
Gets the second.
Returns:
the second.

round

public JulianDay round(int date_accuracy)
Rounds this day to the accuracy of the specified format and creates a new JulianDay object.
Parameters:
date_accuracy - the number of accuracy.
Returns:
the rounded day.

getFullSpellMonthString

public static java.lang.String getFullSpellMonthString(int m)
Gets the full spell name of the specified month.
Parameters:
m - the month between 1 and 12.
Returns:
the full spell name of the specified month.

getReducedMonthString

public static java.lang.String getReducedMonthString(int m)
Gets the reduced name of the specified month.
Parameters:
m - the month between 1 and 12.
Returns:
the reduced name of the specified month.

getMonthCode

public static java.lang.String getMonthCode(int m)
Gets the code of the specified month.
Parameters:
m - the month between 1 and 12.
Returns:
the code of the specified month.

getMonth

public static int getMonth(java.lang.String month)
                    throws java.util.NoSuchElementException
Gets the month of the specified month string.
Parameters:
month - the month string.
Returns:
the month between 1 and 12.
Throws:
java.util.NoSuchElementException - if the specified code does not much any month.

isDecimalDay

public static boolean isDecimalDay(int date_accuracy)
Returns true when the specified accuracy represents decimal day.
Parameters:
date_accuracy - the format number of the accuracy.
Returns:
true when the specified accuracy represents decimal day.

getEquivalentAccuracy

public static int getEquivalentAccuracy(int date_accuracy)
Gets the equivalent accuracy of the specified accuracy.
Parameters:
date_accuracy - the format number of the accuracy.
Returns:
the format number of the equivalent accuracy.

getOutputString

public java.lang.String getOutputString(int month_format,
                                        int date_accuracy)
Returns a string representation of the state of this object in the specified format.
Parameters:
month_format - the number of format to output month.
date_accuracy - the number of accuracy.
Returns:
a string representation of the state of this object.