com.timeindexing.time
Class TimeCalculator

java.lang.Object
  extended bycom.timeindexing.time.TimeCalculator

public class TimeCalculator
extends java.lang.Object

A date and time calculator.


Constructor Summary
TimeCalculator()
           
 
Method Summary
static Timestamp addTimestamp(Timestamp t0, Timestamp t1)
          Add one timestamp to another.
static ElapsedMillisecondTimestamp addTimestampM(RelativeTimestamp t0, RelativeTimestamp t1)
          Add one elapsed timestamp to another elapsed timestamp.
static MillisecondTimestamp addTimestampM(Timestamp t0, Timestamp t1)
          Add one millisecond timestamp to another.
static ElapsedNanosecondTimestamp addTimestampN(RelativeTimestamp t0, RelativeTimestamp t1)
          Add one elapsed timestamp to another.
static NanosecondTimestamp addTimestampN(Timestamp t0, Timestamp t1)
          Add one nanosecond timestamp to another.
static ElapsedSecondTimestamp addTimestampS(RelativeTimestamp t0, RelativeTimestamp t1)
          Add one elapsed timestamp to another.
static SecondTimestamp addTimestampS(Timestamp t0, Timestamp t1)
          Add one second timestamp to another.
static ElapsedMicrosecondTimestamp addTimestampU(RelativeTimestamp t0, RelativeTimestamp t1)
          Add one elapsed timestamp to another.
static MicrosecondTimestamp addTimestampU(Timestamp t0, Timestamp t1)
          Add one microsecond timestamp to another.
static AbsoluteTimestamp asAbsoluteTimestamp(long seconds, int nanos)
          Take some seconds and some nanoseconds, and return a AbsoluteTimestamp in the best scale.
static RelativeTimestamp asRelativeTimestamp(long seconds, int nanos)
          Take some seconds and some nanoseconds, and return a RelativeTimestamp in the best scale.
static Timestamp asScale(Timestamp t, Scale scale)
          Convert a Timestamp to a specific Scale.
static ElapsedMicrosecondTimestamp elapsedAsMicrosSince(AbsoluteTimestamp since)
          Microseconds that have elasped since the specific time.
static ElapsedMillisecondTimestamp elapsedAsMillisSince(AbsoluteTimestamp since)
          Milliseconds that have elasped since the specific time.
static ElapsedNanosecondTimestamp elapsedAsNanosSince(AbsoluteTimestamp since)
          Nanoseconds that have elasped since the specific time.
static ElapsedSecondTimestamp elapsedAsSecondsSince(AbsoluteTimestamp since)
          Seconds that have elasped since the specific time.
static RelativeTimestamp elapsedSince(Timestamp since)
          Time that has elasped since the specified time.
static boolean equals(Timestamp t0, Timestamp t1)
          Equals
static AbsoluteTimestamp fromDate(java.util.Date date)
          Convert a java.util.Date to a Timestamp.
static boolean greaterThan(Timestamp t0, Timestamp t1)
          Greater Than
static boolean greaterThanEquals(Timestamp t0, Timestamp t1)
          GreaterThanEquals
static boolean lessThan(Timestamp t0, Timestamp t1)
          Less Than
static boolean lessThanEquals(Timestamp t0, Timestamp t1)
          LessThanEquals
static boolean notEquals(Timestamp t0, Timestamp t1)
          Not Equals
static Timestamp subtractTimestamp(Timestamp t0, Timestamp t1)
          Substract one timestamp from another.
static ElapsedMillisecondTimestamp subtractTimestampM(RelativeTimestamp t0, RelativeTimestamp t1)
          Subtract one elapsed timestamp from another elapsed timestamp.
static MillisecondTimestamp subtractTimestampM(Timestamp t0, Timestamp t1)
          Subtract one millisecond timestamp from another.
static ElapsedNanosecondTimestamp subtractTimestampN(RelativeTimestamp t0, RelativeTimestamp t1)
          Subtract one elapsed timestamp from another.
static NanosecondTimestamp subtractTimestampN(Timestamp t0, Timestamp t1)
          Subtract one nanosecond timestamp from another.
static ElapsedSecondTimestamp subtractTimestampS(RelativeTimestamp t0, RelativeTimestamp t1)
          Subtract one elapsed timestamp from another.
static SecondTimestamp subtractTimestampS(Timestamp t0, Timestamp t1)
          Subtract one second timestamp from another.
static ElapsedMicrosecondTimestamp subtractTimestampU(RelativeTimestamp t0, RelativeTimestamp t1)
          Subtract one elapsed timestamp from another.
static MicrosecondTimestamp subtractTimestampU(Timestamp t0, Timestamp t1)
          Subtract one microsecond timestamp from another.
static AbsoluteTimestamp toAbsolute(RelativeTimestamp timestamp)
          Convert an RelativeTimestamp to an AbsoluteTimestamp.
static java.util.Date toDate(Timestamp ts)
          Convert a Timestamp to a java.util.Date.
static MicrosecondTimestamp toMicros(AbsoluteTimestamp ts)
          Convert AbsoluteTimestamp to MicrosecondScale.
static ElapsedMicrosecondTimestamp toMicros(RelativeTimestamp ts)
          Convert RelativeTimestamp to ElapsedMicrosecondTimestamp.
static Timestamp toMicros(Timestamp ts)
          Convert a Timestamp to MicrosecondScale Timestamp.
static MillisecondTimestamp toMillis(AbsoluteTimestamp ts)
          Convert AbsoluteTimestamp to MillisecondScale.
static ElapsedMillisecondTimestamp toMillis(RelativeTimestamp ts)
          Convert RelativeTimestamp to ElapsedMillisecondTimestamp.
static Timestamp toMillis(Timestamp ts)
          Convert a Timestamp to MillisecondScale Timestamp.
static NanosecondTimestamp toNanos(AbsoluteTimestamp ts)
          Convert AbsoluteTimestamp to NanosecondScale.
static ElapsedNanosecondTimestamp toNanos(RelativeTimestamp ts)
          Convert RelativeTimestamp to ElapsedNanosecondTimestamp.
static Timestamp toNanos(Timestamp ts)
          Convert a Timestamp to NanosecondScale Timestamp.
static RelativeTimestamp toRelative(AbsoluteTimestamp timestamp)
          Convert an AbsoluteTimestamp to a RelativeTimestamp.
static SecondTimestamp toSeconds(AbsoluteTimestamp ts)
          Convert AbsoluteTimestamp to SecondTimestamp.
static ElapsedSecondTimestamp toSeconds(RelativeTimestamp ts)
          Convert RelativeTimestamp to ElapsedSecondTimestamp.
static Timestamp toSeconds(Timestamp ts)
          Convert a Timestamp to SecondScale Timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeCalculator

public TimeCalculator()
Method Detail

addTimestamp

public static Timestamp addTimestamp(Timestamp t0,
                                     Timestamp t1)
Add one timestamp to another. Returns a value in the Scale with the greatest resolution.


addTimestampS

public static SecondTimestamp addTimestampS(Timestamp t0,
                                            Timestamp t1)
Add one second timestamp to another.


addTimestampS

public static ElapsedSecondTimestamp addTimestampS(RelativeTimestamp t0,
                                                   RelativeTimestamp t1)
Add one elapsed timestamp to another.


addTimestampM

public static MillisecondTimestamp addTimestampM(Timestamp t0,
                                                 Timestamp t1)
Add one millisecond timestamp to another.


addTimestampM

public static ElapsedMillisecondTimestamp addTimestampM(RelativeTimestamp t0,
                                                        RelativeTimestamp t1)
Add one elapsed timestamp to another elapsed timestamp.


addTimestampU

public static MicrosecondTimestamp addTimestampU(Timestamp t0,
                                                 Timestamp t1)
Add one microsecond timestamp to another.


addTimestampU

public static ElapsedMicrosecondTimestamp addTimestampU(RelativeTimestamp t0,
                                                        RelativeTimestamp t1)
Add one elapsed timestamp to another.


addTimestampN

public static NanosecondTimestamp addTimestampN(Timestamp t0,
                                                Timestamp t1)
Add one nanosecond timestamp to another.


addTimestampN

public static ElapsedNanosecondTimestamp addTimestampN(RelativeTimestamp t0,
                                                       RelativeTimestamp t1)
Add one elapsed timestamp to another.


subtractTimestamp

public static Timestamp subtractTimestamp(Timestamp t0,
                                          Timestamp t1)
Substract one timestamp from another. Returns a value in the Scale with the greatest resolution.


subtractTimestampS

public static SecondTimestamp subtractTimestampS(Timestamp t0,
                                                 Timestamp t1)
Subtract one second timestamp from another.


subtractTimestampS

public static ElapsedSecondTimestamp subtractTimestampS(RelativeTimestamp t0,
                                                        RelativeTimestamp t1)
Subtract one elapsed timestamp from another.


subtractTimestampM

public static MillisecondTimestamp subtractTimestampM(Timestamp t0,
                                                      Timestamp t1)
Subtract one millisecond timestamp from another.


subtractTimestampM

public static ElapsedMillisecondTimestamp subtractTimestampM(RelativeTimestamp t0,
                                                             RelativeTimestamp t1)
Subtract one elapsed timestamp from another elapsed timestamp.


subtractTimestampU

public static MicrosecondTimestamp subtractTimestampU(Timestamp t0,
                                                      Timestamp t1)
Subtract one microsecond timestamp from another.


subtractTimestampU

public static ElapsedMicrosecondTimestamp subtractTimestampU(RelativeTimestamp t0,
                                                             RelativeTimestamp t1)
Subtract one elapsed timestamp from another.


subtractTimestampN

public static NanosecondTimestamp subtractTimestampN(Timestamp t0,
                                                     Timestamp t1)
Subtract one nanosecond timestamp from another.


subtractTimestampN

public static ElapsedNanosecondTimestamp subtractTimestampN(RelativeTimestamp t0,
                                                            RelativeTimestamp t1)
Subtract one elapsed timestamp from another.


elapsedSince

public static RelativeTimestamp elapsedSince(Timestamp since)
Time that has elasped since the specified time. The reuslt is in the same Timestamp Scale as the argument.


elapsedAsSecondsSince

public static ElapsedSecondTimestamp elapsedAsSecondsSince(AbsoluteTimestamp since)
Seconds that have elasped since the specific time.


elapsedAsMillisSince

public static ElapsedMillisecondTimestamp elapsedAsMillisSince(AbsoluteTimestamp since)
Milliseconds that have elasped since the specific time.


elapsedAsMicrosSince

public static ElapsedMicrosecondTimestamp elapsedAsMicrosSince(AbsoluteTimestamp since)
Microseconds that have elasped since the specific time.


elapsedAsNanosSince

public static ElapsedNanosecondTimestamp elapsedAsNanosSince(AbsoluteTimestamp since)
Nanoseconds that have elasped since the specific time.


toRelative

public static RelativeTimestamp toRelative(AbsoluteTimestamp timestamp)
Convert an AbsoluteTimestamp to a RelativeTimestamp. Converts number of seconds and number of nanoseconds, without any processing. The AbsoluteTimestamp Epoch maps to RelativeTimestamp 0.


toAbsolute

public static AbsoluteTimestamp toAbsolute(RelativeTimestamp timestamp)
Convert an RelativeTimestamp to an AbsoluteTimestamp. Converts number of seconds and number of nanoseconds, without any processing. The RelativeTimestamp 0 maps to AbsoluteTimestamp Epoch.


asAbsoluteTimestamp

public static AbsoluteTimestamp asAbsoluteTimestamp(long seconds,
                                                    int nanos)
Take some seconds and some nanoseconds, and return a AbsoluteTimestamp in the best scale.


asRelativeTimestamp

public static RelativeTimestamp asRelativeTimestamp(long seconds,
                                                    int nanos)
Take some seconds and some nanoseconds, and return a RelativeTimestamp in the best scale.


asScale

public static Timestamp asScale(Timestamp t,
                                Scale scale)
Convert a Timestamp to a specific Scale.


toSeconds

public static Timestamp toSeconds(Timestamp ts)
Convert a Timestamp to SecondScale Timestamp. May lose some data.


toSeconds

public static SecondTimestamp toSeconds(AbsoluteTimestamp ts)
Convert AbsoluteTimestamp to SecondTimestamp. May lose some data.


toSeconds

public static ElapsedSecondTimestamp toSeconds(RelativeTimestamp ts)
Convert RelativeTimestamp to ElapsedSecondTimestamp. May lose some data.


toMillis

public static Timestamp toMillis(Timestamp ts)
Convert a Timestamp to MillisecondScale Timestamp. May lose some data.


toMillis

public static MillisecondTimestamp toMillis(AbsoluteTimestamp ts)
Convert AbsoluteTimestamp to MillisecondScale. May lose some data.


toMillis

public static ElapsedMillisecondTimestamp toMillis(RelativeTimestamp ts)
Convert RelativeTimestamp to ElapsedMillisecondTimestamp. May lose some data.


toMicros

public static Timestamp toMicros(Timestamp ts)
Convert a Timestamp to MicrosecondScale Timestamp. May lose some data.


toMicros

public static MicrosecondTimestamp toMicros(AbsoluteTimestamp ts)
Convert AbsoluteTimestamp to MicrosecondScale. May lose some data.


toMicros

public static ElapsedMicrosecondTimestamp toMicros(RelativeTimestamp ts)
Convert RelativeTimestamp to ElapsedMicrosecondTimestamp. May lose some data.


toNanos

public static Timestamp toNanos(Timestamp ts)
Convert a Timestamp to NanosecondScale Timestamp. May lose some data.


toNanos

public static NanosecondTimestamp toNanos(AbsoluteTimestamp ts)
Convert AbsoluteTimestamp to NanosecondScale. May lose some data.


toNanos

public static ElapsedNanosecondTimestamp toNanos(RelativeTimestamp ts)
Convert RelativeTimestamp to ElapsedNanosecondTimestamp. May lose some data.


toDate

public static java.util.Date toDate(Timestamp ts)
Convert a Timestamp to a java.util.Date.


fromDate

public static AbsoluteTimestamp fromDate(java.util.Date date)
Convert a java.util.Date to a Timestamp.


equals

public static boolean equals(Timestamp t0,
                             Timestamp t1)
Equals


notEquals

public static boolean notEquals(Timestamp t0,
                                Timestamp t1)
Not Equals


lessThanEquals

public static boolean lessThanEquals(Timestamp t0,
                                     Timestamp t1)
LessThanEquals


lessThan

public static boolean lessThan(Timestamp t0,
                               Timestamp t1)
Less Than


greaterThanEquals

public static boolean greaterThanEquals(Timestamp t0,
                                        Timestamp t1)
GreaterThanEquals


greaterThan

public static boolean greaterThan(Timestamp t0,
                                  Timestamp t1)
Greater Than