jodd.datetime
Class JulianDateStamp

java.lang.Object
  extended byjodd.datetime.JulianDateStamp
All Implemented Interfaces:
java.io.Serializable

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

Julian Date stamp, for high precision calculations. Julian date is a real number and it basicly consist of two parts: integer and fraction. Integer part carries date information, fraction carries time information.

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.

See Also:
TimeUtil, Serialized Form

Field Summary
 double fraction
          Fraction part of the Julian Date number.
 int integer
          Integer part of the Julian Date number.
 
Constructor Summary
JulianDateStamp()
          Default constructor.
JulianDateStamp(java.math.BigDecimal bd)
          Creates JuliandDateStamp from BigDecimal.
JulianDateStamp(double jd)
          Creates JuliandDateStamp from a double.
JulianDateStamp(int i, double d)
          Creates JuliandDateStamp from both integer and fractional part.
 
Method Summary
 double doubleValue()
          Returns double value of julian date number.
 java.math.BigDecimal toBigDecimal()
          Returns BigDecimal value of julian date number.
 java.lang.String toString()
          Simple String conversion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

integer

public int integer
Integer part of the Julian Date number.


fraction

public double fraction
Fraction part of the Julian Date number.

Constructor Detail

JulianDateStamp

public JulianDateStamp()
Default constructor.


JulianDateStamp

public JulianDateStamp(double jd)
Creates JuliandDateStamp from a double.

Parameters:
jd - julian date

JulianDateStamp

public JulianDateStamp(int i,
                       double d)
Creates JuliandDateStamp from both integer and fractional part.

Parameters:
i - integer part
d - fractional part

JulianDateStamp

public JulianDateStamp(java.math.BigDecimal bd)
Creates JuliandDateStamp from BigDecimal.

Parameters:
bd - julian date
Method Detail

doubleValue

public double doubleValue()
Returns double value of julian date number. CAUTION: double values may not be suit for precision math.

Returns:
julian date as double

toBigDecimal

public java.math.BigDecimal toBigDecimal()
Returns BigDecimal value of julian date number.

Returns:
julian date as double

toString

public java.lang.String toString()
Simple String conversion.

Returns:
julian integer as string


Jodd v0.24.5 Javadoc