|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jodd.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
,
todo Add switches to MJD, TJD...
,
Serialized FormField Summary | |
---|---|
double |
fraction
Fraction part of the Julian Date (JD). |
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 java.lang.Object |
clone()
|
double |
doubleValue()
Returns double value of JD. |
boolean |
equals(java.lang.Object object)
|
int |
getJulianDayNumber()
Returns JDN. |
int |
hashCode()
|
void |
set(int i,
double f)
Sets integer and fractional part with normalization. |
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 |
---|
public int integer
public 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 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.Object
public 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 boolean equals(java.lang.Object object)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected java.lang.Object clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |