Jeospace API

org.jeospace.physics.orbit
Class Epoch

java.lang.Object
  extended byorg.jeospace.physics.orbit.Epoch
All Implemented Interfaces:
java.lang.Comparable

public class Epoch
extends java.lang.Object
implements java.lang.Comparable

An immutable object, an epoch is a representation of an instant in time that is used as a point of reference - typically in astronomical calculations. This class provides utility methods for converting between various forms of date and time representations.

Version:
$Revision: 1.1.1.1 $
Author:
Rex Melton
See Also:
Calendar

Field Summary
static Epoch B1900
          The epoch B1900
static Epoch B1950
          The epoch B1950
static double HOURS_PER_DAY
          The number of hours per day
static Epoch J2000
          The epoch J2000
static Epoch J2050
          The epoch J2050
static double JULIAN_CENTURY
          The double value representing the number of Julian days in a Julian century
static double JULIAN_DAY_AT_THE_SYSTEM_EPOCH
          Constant - the Julian Day at Jan 1 1970, 12:00 PM
static double JULIAN_MILLENIUM
          The double value representing the number of Julian days in a Julian millenium
static double MILLIS_PER_DAY
          The number of milliseconds per day
static double MINUTES_PER_DAY
          The number of minutes per day
static Epoch MJD
          The epoch of the Modified Julian day
static double SECONDS_PER_DAY
          The number of seconds per day
 
Constructor Summary
Epoch()
          Construct an Epoch object initialized to the value of the current system time.
Epoch(java.util.Calendar cal)
          Construct an Epoch object initialized to the value of the argument Calendar.
Epoch(double julianDay)
          Construct an Epoch object initialized from the argument Julian day.
Epoch(Epoch epoch)
          Construct an Epoch object initialized to the value of the argument.
 
Method Summary
 int compareTo(Epoch that)
          Compare this object with the argument for order.
 int compareTo(java.lang.Object obj)
          Compare this object with the argument for order.
 boolean equals(java.lang.Object obj)
          Compare two Epochs for equality.
 java.util.Calendar getCalendar()
          Return the Calendar representation of this Epoch
static java.util.Calendar getCalendar(double julianDay)
          Return the Gregorian calendar that cooresponds to the specified Julian Day.
static void getCalendar(double julianDay, java.util.Calendar calendar)
          Initialize the argument Calendar object to coorespond to the specified Julian Day.
static double getCurrentJulianDay()
          Return the Julian Day equivalent to the value of the current system time.
static double getFractionOfDay(java.util.Calendar cal)
          Return the value of a fraction portion of a day represented by the Calendar fields that are less significant than the Calendar.DAY field.
static double getJulianCenturiesJ2K(double julianDay)
          Get the double representation of the Julian Centuries referenced to the epoch J.2000 for the specified Julian Day.
 double getJulianDay()
          Return the Julian Day representation of this Epoch
static double getJulianDay(java.util.Calendar calendar)
          Get the double representation of the Julian Day for the specified Calendar.
static double getJulianMillenniaJ2K(double julianDay)
          Get the double representation of the Julian Millennia referenced to the epoch J.2000 for the specified Julian Day.
 int hashcode()
          Return the hash code
 java.lang.String toString()
          Return a String representation of this Epoch object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

B1900

public static final Epoch B1900
The epoch B1900


B1950

public static final Epoch B1950
The epoch B1950


J2000

public static final Epoch J2000
The epoch J2000


J2050

public static final Epoch J2050
The epoch J2050


MJD

public static final Epoch MJD
The epoch of the Modified Julian day


JULIAN_CENTURY

public static final double JULIAN_CENTURY
The double value representing the number of Julian days in a Julian century

See Also:
Constant Field Values

JULIAN_MILLENIUM

public static final double JULIAN_MILLENIUM
The double value representing the number of Julian days in a Julian millenium

See Also:
Constant Field Values

JULIAN_DAY_AT_THE_SYSTEM_EPOCH

public static final double JULIAN_DAY_AT_THE_SYSTEM_EPOCH
Constant - the Julian Day at Jan 1 1970, 12:00 PM

See Also:
Constant Field Values

HOURS_PER_DAY

public static final double HOURS_PER_DAY
The number of hours per day

See Also:
Constant Field Values

MINUTES_PER_DAY

public static final double MINUTES_PER_DAY
The number of minutes per day

See Also:
Constant Field Values

SECONDS_PER_DAY

public static final double SECONDS_PER_DAY
The number of seconds per day

See Also:
Constant Field Values

MILLIS_PER_DAY

public static final double MILLIS_PER_DAY
The number of milliseconds per day

See Also:
Constant Field Values
Constructor Detail

Epoch

public Epoch()
Construct an Epoch object initialized to the value of the current system time.


Epoch

public Epoch(Epoch epoch)
Construct an Epoch object initialized to the value of the argument.

Parameters:
epoch - the Epoch object to duplicate

Epoch

public Epoch(double julianDay)
Construct an Epoch object initialized from the argument Julian day.

Parameters:
julianDay - the double value of the epoch Julian day.

Epoch

public Epoch(java.util.Calendar cal)
Construct an Epoch object initialized to the value of the argument Calendar.

Parameters:
cal - the argument Calendar.
Method Detail

getCurrentJulianDay

public static double getCurrentJulianDay()
Return the Julian Day equivalent to the value of the current system time.

Returns:
the Julian Day equivalent to the value of the current system time.

getJulianDay

public double getJulianDay()
Return the Julian Day representation of this Epoch

Returns:
the Julian Day representation of this Epoch

getCalendar

public java.util.Calendar getCalendar()
Return the Calendar representation of this Epoch

Returns:
the Calendar representation of this Epoch

getJulianDay

public static double getJulianDay(java.util.Calendar calendar)
Get the double representation of the Julian Day for the specified Calendar. This method is only valid for the astronomical year -4712 (Gregorian year -4713) and later.

Note: The Gregorian calendar does not have the concept of the year 0 or negative dates. The Gregorian calendar transitions from the year 1 BC to the year 1 AD.

Parameters:
calendar - the Calendar to convert
Returns:
the double representation of the Julian Day

getJulianCenturiesJ2K

public static double getJulianCenturiesJ2K(double julianDay)
Get the double representation of the Julian Centuries referenced to the epoch J.2000 for the specified Julian Day.

Parameters:
julianDay - the Julian Day
Returns:
the double representation of the Julian Centuries

getJulianMillenniaJ2K

public static double getJulianMillenniaJ2K(double julianDay)
Get the double representation of the Julian Millennia referenced to the epoch J.2000 for the specified Julian Day.

Parameters:
julianDay - the Julian Day
Returns:
the double representation of the Julian Millennia

getCalendar

public static java.util.Calendar getCalendar(double julianDay)
Return the Gregorian calendar that cooresponds to the specified Julian Day. The returned Calendar is set to Universal time.

Parameters:
julianDay - the Julian Day
Returns:
the Calendar

getCalendar

public static void getCalendar(double julianDay,
                               java.util.Calendar calendar)
Initialize the argument Calendar object to coorespond to the specified Julian Day. Note that the TimeZone of the argument Calendar object is preserved.

Parameters:
julianDay - the Julian Day
calendar - the Calendar object to initialize

getFractionOfDay

public static final double getFractionOfDay(java.util.Calendar cal)
Return the value of a fraction portion of a day represented by the Calendar fields that are less significant than the Calendar.DAY field.

Parameters:
cal - the Calendar
Returns:
the double representing the fraction of a day

hashcode

public int hashcode()
Return the hash code

Returns:
the hash code

equals

public boolean equals(java.lang.Object obj)
Compare two Epochs for equality. The result is true if and only if the argument object is not null, is an Epoch object and represents the same Julian Day as this Epoch.

Parameters:
obj - the object to compare with
Returns:
true if the Epochs are equivalent; false otherwise.

compareTo

public int compareTo(Epoch that)
Compare this object with the argument for order.

Parameters:
that - The Epoch to compare
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareTo

public int compareTo(java.lang.Object obj)
Compare this object with the argument for order.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - The Object to compare
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - if the argument is not an Epoch.

toString

public java.lang.String toString()
Return a String representation of this Epoch object.

Returns:
a String representation of this Epoch object

Jeospace API

Copyright © 2006 - jeospace.org