driver.ted.utilities
Class T_JulianDate

java.lang.Object
  extended by driver.ted.utilities.T_JulianDate
All Implemented Interfaces:
java.io.Serializable

public class T_JulianDate
extends java.lang.Object
implements java.io.Serializable

Title: T_JulianDate Class Description: Provides a Julian Date implementation based upon Jean Meeus' Astronomical Algorithms.
Copyright:(c) 2002
Change History:

Version:
1.1
Author:
Ted Driver
See Also:
Serialized Form

Constructor Summary
T_JulianDate()
          T_JulianDate Default Constructor that sets the date and time to the current computer time.
T_JulianDate(double j)
          T_JulianDate Constructor that sets the date and time based on a double provided as the julian date.
T_JulianDate(int mo, int da, int y, int h, int mi, int s)
          T_JulianDate Constructor that sets the date and time based on the given parameters.
T_JulianDate(T_Time ti, T_Date da)
          T_JulianDate Constructor that sets the date and time based on the given T_Time and T_Date objects.
 
Method Summary
 void advance(int mo, int d, int y, int h, int mi, int s)
          This function will increment (or decrement) the date and time by the specified amounts.
 T_Date getDate()
          This function returns the T_Date class for the current date.
 java.lang.String getDayOfWeek()
          This function returns a string representation of the day of week.
 int getDayOfYear()
          This function returns the julian day or the day of the year.
 double getDayOfYearAndTime()
          This function returns the julian day or the day of the year with a fraction appended representing the time of day.
 boolean getGregorian()
          This function returns the current gregorian boolean value.
 int getIntDayOfWeek()
          This function returns an integer representing the day of the week.
 double getJulianDate()
          This function returns the current julian date double value.
 boolean getLeapYear()
          This function returns the current leap year boolean value.
 double getModifiedJulianDate()
          This function returns the modified Julian date.
 T_Time getTime()
          This function returns the T_Time class for the current time.
 void setDate(int mo, int day, int year)
          Set the date and update the Julian Date
 void setDayOfYear(int doy)
          This function will set the Julian date based on the day of year.
 void setJulianDate()
          This function will set the julian date to the current system time and date using the default machine timezone.
 void setJulianDate(double j)
          This function will set the julian date to the date represented by the double value passed in.
 void setJulianDate(int mo, int d, int y, int h, int mi, int s)
          This function will change the Julian date to the new date and time as specified by the input parameters.
 void setJulianDate(T_Date d, T_Time t)
          This function will change the Julian date to the new date and time as specified by the input parameters
 void setTime(int hr, int min, int sec)
          Set the time and update the Julian Date
 java.lang.String toMediumString()
          This method returns a longer String representation of the Julian Date including the double, date and time values.
 java.lang.String toSTKUTCGString()
          This method returns a String representation of the Julian Date in STK's UTCG format.
 java.lang.String toString()
          This method returns a String representation of the Julian Date including the double, date and time values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

T_JulianDate

public T_JulianDate()
T_JulianDate Default Constructor that sets the date and time to the current computer time.


T_JulianDate

public T_JulianDate(int mo,
                    int da,
                    int y,
                    int h,
                    int mi,
                    int s)
T_JulianDate Constructor that sets the date and time based on the given parameters.

Parameters:
mo - The month 1-12
da - The day 1-31
y - The year -4712 to 10000
h - The hour 0-23
mi - The minutes 0-59
s - The seconds 0-59

T_JulianDate

public T_JulianDate(T_Time ti,
                    T_Date da)
T_JulianDate Constructor that sets the date and time based on the given T_Time and T_Date objects.

Parameters:
ti - The T_Time class initialized to a specific time.
da - The T_Date class initialized to a specific date.

T_JulianDate

public T_JulianDate(double j)
T_JulianDate Constructor that sets the date and time based on a double provided as the julian date.

Parameters:
j - The double representing the julian date
Method Detail

toString

public java.lang.String toString()
This method returns a String representation of the Julian Date including the double, date and time values. The Format of the string is:
2451545.0 -- 01/01/00 12:00:00

Overrides:
toString in class java.lang.Object
Returns:
A string representing the current Julian Date

toMediumString

public java.lang.String toMediumString()
This method returns a longer String representation of the Julian Date including the double, date and time values. Example format:
January 01, 2000 12:00:00, 2451545.0

Returns:
A string representing the current Julian Date.

toSTKUTCGString

public java.lang.String toSTKUTCGString()
This method returns a String representation of the Julian Date in STK's UTCG format. The Format of the string is:
(dd mmm yyyy hh:mm:ss.s)

Returns:
A string representing the current Julian Date in STK UTCG format

setDayOfYear

public void setDayOfYear(int doy)
This function will set the Julian date based on the day of year. The year currently set is used.

Parameters:
doy - The interger day of the year.

advance

public void advance(int mo,
                    int d,
                    int y,
                    int h,
                    int mi,
                    int s)
This function will increment (or decrement) the date and time by the specified amounts. Negative values can be used to decrement the date or time.

Parameters:
mo - The number of months to advance (positive or negative).
d - The number of days to advance (positive or negative).
y - The number of years to advance (positive or negative).
h - The number of hours to advance (positive or negative).
mi - The number of minutes to advance (positive or negative).
s - The number of seconds to advance (positive or negative).

setJulianDate

public void setJulianDate(int mo,
                          int d,
                          int y,
                          int h,
                          int mi,
                          int s)
This function will change the Julian date to the new date and time as specified by the input parameters.

Parameters:
mo - The number of months to advance
d - The number of days to advance
y - The number of years to advance
h - The number of hours to advance
mi - The number of minutes to advance
s - The number of seconds to advance

setJulianDate

public void setJulianDate(T_Date d,
                          T_Time t)
This function will change the Julian date to the new date and time as specified by the input parameters

Parameters:
d - A T_Date class with a specified date set
t - A T_Time class with the specified time set

setJulianDate

public void setJulianDate()
This function will set the julian date to the current system time and date using the default machine timezone. The current time is obtained by using the Gregorian Calendar constructor.


setDate

public void setDate(int mo,
                    int day,
                    int year)
Set the date and update the Julian Date

Parameters:
mo - The month (1-12)
day - The day (1-31) Must correct for the defined month at the time of setting.
year - The year (-4712 to 10000)

setTime

public void setTime(int hr,
                    int min,
                    int sec)
Set the time and update the Julian Date

Parameters:
hr - The hour
min - The minute
sec - The second

setJulianDate

public void setJulianDate(double j)
This function will set the julian date to the date represented by the double value passed in.

Parameters:
j - The double value representing the julian date

getJulianDate

public double getJulianDate()
This function returns the current julian date double value.

Returns:
A double value representing the current date and time.

getLeapYear

public boolean getLeapYear()
This function returns the current leap year boolean value.

Returns:
A boolean denoting whether the current year is a leap year (true) or not (false).

getGregorian

public boolean getGregorian()
This function returns the current gregorian boolean value.

Returns:
A boolean denoting whether the current date is in the gregorian calendar (true) or not (false).

getDayOfWeek

public java.lang.String getDayOfWeek()
This function returns a string representation of the day of week.

Returns:
A String denoting the current day of the week

getIntDayOfWeek

public int getIntDayOfWeek()
This function returns an integer representing the day of the week.

Returns:
An integer denoting the day of the week (0 = Sunday through 6 = Saturday)

getDayOfYear

public int getDayOfYear()
This function returns the julian day or the day of the year.

Returns:
An integer denoting the current day of the year (0-366).

getDayOfYearAndTime

public double getDayOfYearAndTime()
This function returns the julian day or the day of the year with a fraction appended representing the time of day.

Returns:
A double denoting the current day of the year (0-366) and time of day (0 < 1) .

getModifiedJulianDate

public double getModifiedJulianDate()
This function returns the modified Julian date. The modified Julian Date is the Julian Date minus 2400000.5.

Returns:
A double denoting the modified julian date.

getDate

public T_Date getDate()
This function returns the T_Date class for the current date.

Returns:
A T_Date class that contains the current date.

getTime

public T_Time getTime()
This function returns the T_Time class for the current time.

Returns:
A T_Time class that contains the current time.