|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjodd.datetime.JulianDateStamp
public class JulianDateStamp
Julian Date stamp, for high precision calculations. Julian date is a real number and it basically consist of two parts: integer and fraction. Integer part carries date information, fraction carries time information.
The Julian day or Julian day number (JDN) is the (integer) number of days that have elapsed since Monday, January 1, 4713 BC in the proleptic Julian calendar 1. That day is counted as Julian day zero. Thus the multiples of 7 are Mondays. Negative values can also be used.
The Julian Date (JD) is the number of days (with decimal fraction of the day) that have elapsed since 12 noon Greenwich Mean Time (UT or TT) of that day. Rounding to the nearest integer gives the Julian day number. For calculations that will have time precision of 1e-3 seconds, both fraction and integer part must have enough numerics in it. The problem is that integer part is big and, on the other hand fractional is small, and since final julian date is a sum of this two values, some fraction numerals may be lost. Therefore, for higher precision both fractional and intger part of julian date real number has to be preserved.
TimeUtil,
JDateTime,
DateTimeStamp,
Serialized Form| Field Summary | |
|---|---|
protected double |
fraction
Fraction part of the Julian Date (JD). |
protected int |
integer
Integer part of the Julian Date (JD). |
| Constructor Summary | |
|---|---|
JulianDateStamp()
Default empty constructor. |
|
JulianDateStamp(java.math.BigDecimal bd)
Creates JD from BigDecimal. |
|
JulianDateStamp(double jd)
Creates JD from a double. |
|
JulianDateStamp(int i,
double f)
Creates JD from both integer and fractional part using normalization. |
|
| Method Summary | |
|---|---|
JulianDateStamp |
add(double delta)
Adds a double to current instance. |
JulianDateStamp |
add(JulianDateStamp jds)
Adds a JD to current instance. |
protected JulianDateStamp |
clone()
|
int |
daysBetween(JulianDateStamp otherDate)
Calculates the number of days between two dates. |
int |
daysSpan(JulianDateStamp otherDate)
Returns span between two days. |
double |
doubleValue()
Returns double value of JD. |
boolean |
equals(java.lang.Object object)
|
double |
getFraction()
|
int |
getInteger()
|
int |
getJulianDayNumber()
Returns JDN. |
JulianDateStamp |
getModifiedJulianDate()
|
JulianDateStamp |
getReducedJulianDate()
|
JulianDateStamp |
getTruncatedJulianDate()
|
int |
hashCode()
|
void |
set(double jd)
|
void |
set(int i,
double f)
Sets integer and fractional part with normalization. |
void |
setModifiedJulianDate(double mjd)
|
void |
setReducedJulianDate(double rjd)
|
void |
setTruncatedJulianDate(double tjd)
|
JulianDateStamp |
sub(double delta)
Subtracts a double from current instance. |
JulianDateStamp |
sub(JulianDateStamp jds)
Subtracts a JD from current instance. |
java.math.BigDecimal |
toBigDecimal()
Returns BigDecimal value of JD. |
java.lang.String |
toString()
Returns string representation of JD. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int integer
protected double fraction
| Constructor Detail |
|---|
public JulianDateStamp()
public JulianDateStamp(double jd)
double.
public JulianDateStamp(int i,
double f)
i - integer partf - fractional part should be in range [0.0, 1.0)set(int, double)public JulianDateStamp(java.math.BigDecimal bd)
BigDecimal.
| Method Detail |
|---|
public int getInteger()
public double getFraction()
public int getJulianDayNumber()
integer. It is calculated by
rounding to the nearest integer.
public double doubleValue()
double value of JD.
CAUTION: double values may not be suit for precision math due to
loss of precision.
public java.math.BigDecimal toBigDecimal()
BigDecimal value of JD.
public java.lang.String toString()
toString in class java.lang.Objectpublic JulianDateStamp add(JulianDateStamp jds)
public JulianDateStamp add(double delta)
public JulianDateStamp sub(JulianDateStamp jds)
public JulianDateStamp sub(double delta)
public void set(int i,
double f)
public void set(double jd)
public int daysBetween(JulianDateStamp otherDate)
public int daysSpan(JulianDateStamp otherDate)
public boolean equals(java.lang.Object object)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectprotected JulianDateStamp clone()
clone in class java.lang.Objectpublic JulianDateStamp getReducedJulianDate()
public void setReducedJulianDate(double rjd)
public JulianDateStamp getModifiedJulianDate()
public void setModifiedJulianDate(double mjd)
public JulianDateStamp getTruncatedJulianDate()
public void setTruncatedJulianDate(double tjd)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||