public final class TimeInstant extends java.lang.Object implements java.lang.Comparable<TimeInstant>
| Constructor and Description |
|---|
TimeInstant(java.util.Calendar calendar)
Constructs a TimeInstant object that represents the given instant of time
specified by the Calendar object.
|
TimeInstant(java.util.Calendar calendar,
boolean applyPrefferdTimeZoneFromCalendar)
Constructs a TimeInstant object that represents the given instant of time
specified by the Calendar object.
|
TimeInstant(java.util.Date date)
Constructs a TimeInstant object that represents the given instant of time
specified by the Date object.
|
TimeInstant(double timeInReferenceUnit)
Constructs a TimeInstant object with the given time value in the time
unit of the reference time.
|
TimeInstant(double time,
java.util.concurrent.TimeUnit unit)
Constructs a TimeInstant object with the given time value in the time
unit given as second parameter.
|
TimeInstant(long timeInReferenceUnit)
Constructs a TimeInstant object with the given time value in the time
unit of the reference time.
|
TimeInstant(long time,
java.util.concurrent.TimeUnit unit)
Constructs a TimeInstant object with the given time value in the time
unit of the given parameter.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(TimeInstant anotherInstant)
Compares the given TimeInstant to this TimeInstant.
|
boolean |
equals(java.lang.Object o)
Indicates whether this TimeInstant is equal to the given parameter.
|
TimeInstant |
getBeginOf(java.util.concurrent.TimeUnit smallestUnit)
Determines that last instant prior to this instant at which
a new period of the unit provided "begins", which means smaller
units are zero.
|
java.util.TimeZone |
getPreferredTimeZone()
The preferred time zone for printing this time instant.
|
java.util.Calendar |
getTimeAsCalender()
Returns the value of this TimeInstant object as a Calender object.
|
java.util.Date |
getTimeAsDate()
Returns the value of this TimeInstant object as a Date object.
|
double |
getTimeAsDouble()
Returns the value of this TimeInstant object as a double type in the time
unit of the reference time.
|
double |
getTimeAsDouble(java.util.concurrent.TimeUnit unit)
Returns the value of this TimeInstant object as a double type in the time
unit given as a parameter.
|
long |
getTimeInEpsilon()
Returns the value of the TimeInstant object as a long type in the time
unit of epsilon
|
long |
getTimeRounded()
Returns the value of this TimeInstant object as a long type in the time
unit of the reference time.
|
long |
getTimeRounded(java.util.concurrent.TimeUnit unit)
Returns the value of this TimeInstant object as a long type in the time
unit given as a parameter.
|
long |
getTimeTruncated()
Returns the value of this TimeInstant object as a long type in the time
unit of the reference time.
|
long |
getTimeTruncated(java.util.concurrent.TimeUnit unit)
Returns the value of this TimeInstant object as a long type in the time
unit given as a parameter.
|
int |
hashCode()
Returns a hash code value for the object.
|
static boolean |
isAfter(TimeInstant a,
TimeInstant b)
Checks if the first of two points of simulation time is after the second.
|
static boolean |
isAfterOrEqual(TimeInstant a,
TimeInstant b)
Checks if the first of two points of simulation time is after the second
or equal to the second.
|
static boolean |
isBefore(TimeInstant a,
TimeInstant b)
Checks if the first of two points of simulation time is before the
second.
|
static boolean |
isBeforeOrEqual(TimeInstant a,
TimeInstant b)
Checks if the first of two points of simulation time is before the second
or equal to the second.
|
static boolean |
isEqual(TimeInstant a,
TimeInstant b)
Checks if the two TimeInstant parameters describe the same point of
simulation time.
|
void |
setPreferredTimeZone(java.util.TimeZone preferredTimeZone)
Sets the preferred time zone for printing this time instant.
|
java.lang.String |
toString()
Returns the String Representation of this TimeInstant according to the
TimeFormatter.
|
java.lang.String |
toString(int digits)
Returns the String Representation of this TimeInstant according to the
TimeFormatter, truncating digits after the decimal point if necessary.
|
public TimeInstant(long time,
java.util.concurrent.TimeUnit unit)
time - long : The time value of this TimeInstant in the time unit of
unit.unit - TimeUnit: the TimeUnitpublic TimeInstant(long timeInReferenceUnit)
timeInReferenceUnit - long : The time value of this TimeInstant in the time unit of
the reference time.public TimeInstant(double time,
java.util.concurrent.TimeUnit unit)
time - double : The time value of this TimeInstant in the time unit of
the reference time.unit - TimeUnit : the time unitpublic TimeInstant(double timeInReferenceUnit)
timeInReferenceUnit - double : The time value of this TimeInstant in the time unit of
the reference time.public TimeInstant(java.util.Calendar calendar,
boolean applyPrefferdTimeZoneFromCalendar)
calendar - Calendar : the instant of time that is represented by this TimeIstantapplyPrefferdTimeZoneFromCalendar - boolean : Use the time zone as set in calendar for output (true)
or use UTC as default time zone for output (false)Calendarpublic TimeInstant(java.util.Calendar calendar)
Calendarpublic TimeInstant(java.util.Date date)
date - Date : the instant of time that is represented by this TimeInstantDatepublic long getTimeInEpsilon()
public long getTimeTruncated(java.util.concurrent.TimeUnit unit)
public long getTimeTruncated()
public long getTimeRounded(java.util.concurrent.TimeUnit unit)
unit - the TimeUnitpublic long getTimeRounded()
public java.util.Calendar getTimeAsCalender()
public java.util.Date getTimeAsDate()
public double getTimeAsDouble(java.util.concurrent.TimeUnit unit)
public double getTimeAsDouble()
public java.util.TimeZone getPreferredTimeZone()
public void setPreferredTimeZone(java.util.TimeZone preferredTimeZone)
preferredTimeZone - java.util.TimeZone : The time value of this TimeInstant in the time unit of
the reference time.public static boolean isBefore(TimeInstant a, TimeInstant b)
TimeInstant i.e.
TimeInstant.isAfter(a,b) where a and b are valid TimeInstant
objects.a - TimeInstant : first comparandb - TimeInstant : second comparandpublic static boolean isAfter(TimeInstant a, TimeInstant b)
TimeInstant i.e.
TimeInstant.isAfter(a,b) where a and b are valid TimeInstant
objects.a - TimeInstant : first comparandb - TimeInstant : second comparandpublic static boolean isAfterOrEqual(TimeInstant a, TimeInstant b)
TimeInstant i.e.
TimeInstant.isAfterOrEqual(a,b) where a and b are valid
timeInstant objects.a - TimeInstant : first comparandb - TimeInstant : second comparandpublic static boolean isEqual(TimeInstant a, TimeInstant b)
TimeInstant i.e.
TimeInstant.isEqual(a,b) where a and b are valid TimeInstant
objects.a - TimeInstant : first comparandb - TimeInstant : second comparandpublic static boolean isBeforeOrEqual(TimeInstant a, TimeInstant b)
TimeInstant i.e.
TimeInstant.isBeforeOrEqual(a,b) where a and b are valid
timeInstant objects.a - TimeInstant : first comparandb - TimeInstant : second comparandpublic TimeInstant getBeginOf(java.util.concurrent.TimeUnit smallestUnit)
getBeginOf(TimeUnit.TimeUnit.DAYS) yields
28.12.2011 00:00:00:000 (begin of current hour).getBeginOf(TimeUnit.TimeUnit.MINUTES) yields
28.12.2011 11:23:00:000 (begin of current day).smallestUnit - TimeUnit : the unit to begin (i.e. smaller units set to zero);
must be TimeUnit.DAYS, TimeUnit.HOURS, TimeUnit.MINUTES, TimeUnit.SECONDS or TimeUnit.MILLISECONDS.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the reference object with which to compare.public int compareTo(TimeInstant anotherInstant)
compareTo in interface java.lang.Comparable<TimeInstant>anotherInstant - : The TimeInstant to be compared to this TimeInstantpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString(),
TimeFormatterpublic java.lang.String toString(int digits)
digits - Maximum number of digits after decimal pointObject.toString(),
TimeFormatter