public final class TimeOperations
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static TimeInstant |
add(TimeInstant instant,
TimeSpan span)
Returns a new Time Instant determined from the instant passed to this
method plus the time span passed to method.
|
static TimeInstant |
add(TimeSpan span,
TimeInstant instant)
Returns a new Time Instant determined from the instant passed to this
method plus the time span passed to method.
|
static TimeSpan |
add(TimeSpan a,
TimeSpan b)
Returns a new TimeSpan object representing the sum of the given TimeSpan
objects.
|
static TimeSpan |
diff(TimeInstant a,
TimeInstant b)
Returns a new TimeSpan object representing the absolute difference of the
given TimeInstant objects, i.e. the span of time between the two instants
of time.
|
static TimeSpan |
diff(TimeSpan a,
TimeSpan b)
Returns a new TimeSpan object representing the absolute difference of the
given TimeSpan objects.
|
static TimeSpan |
divide(TimeSpan dividend,
double divisor)
Returns a new TimeSpan object representing the quotient of the given
TimeSpan and the divisor of type double.
|
static double |
divide(TimeSpan dividend,
TimeSpan divisor)
Returns a new TimeSpan object representing the quotient of the given
TimeSpan objects.
|
static java.lang.String |
formatTimeInstant(TimeInstant instant)
Formats the given instant of time according to the timeFormatter.
|
static java.lang.String |
formatTimeSpan(TimeSpan span)
Formats the given span of time according to the timeFormatter.
|
static TimeFormatter |
getDefaultTimeFormatter()
Sets the TimeFormatter used by this environment to a
SingleUnitTimeFormatter, using the current reference
unit and four floating point digits. |
static java.util.concurrent.TimeUnit |
getEpsilon()
Returns the epsilon value representing the granularity of simulation time
for this experiment.
|
static TimeSpan |
getEpsilonSpan()
Returns the smallest distinguishable TimeSpan.
|
static java.util.concurrent.TimeUnit |
getReferenceUnit()
Returns the reference time unit specifying what is meant by the
simulation time step of 1 in statements without an explicit declaration
of a time unit like in
new TimeSpan(5). |
static TimeInstant |
getStartTime()
Returns the TimeInstant when the experiment has started.
|
static TimeFormatter |
getTimeFormatter()
Returns the time Formatter.
|
static TimeSpan |
multiply(double factor,
TimeSpan span)
Returns a new TimeSpan object representing the product of the given
TimeSpan and the factor of type double.
|
static TimeSpan |
multiply(TimeSpan span,
double factor)
Returns a new TimeSpan object representing the product of the given
TimeSpan and the factor of type double.
|
static void |
setReferenceUnitX(java.util.concurrent.TimeUnit referenceUnit)
Sets the reference time unit specifying what is meant by the simulation
time step of 1 in statements without an explicit declaration of a time
unit like in
new TimeSpan(5). |
static void |
setTimeFormatter(TimeFormatter myTimeFormatter,
boolean override)
Sets the time Formatter.
|
static TimeInstant |
subtract(TimeInstant instant,
TimeSpan span)
Returns a new Time Instant determined from the instant passed to this
method minus the time span passed to method.
|
public static TimeSpan add(TimeSpan a, TimeSpan b)
a - TimeSpan : TimeSpan ab - TimeSpan : TimeSpan bpublic static TimeInstant add(TimeSpan span, TimeInstant instant)
Long.MAX_VALUE-1 (in the unit of epsilon).
The preferred time zone of the result is equal to the preferred time zone
of parameter b.span - TimeSpan : The TimeSpan to add...instant - TimeInstant : ...to this TimeInstant.public static TimeInstant add(TimeInstant instant, TimeSpan span)
Long.MAX_VALUE-1 (in the unit of epsilon).
The preferred time zone of the result is equal to the preferred time zone
of instant passed to this method.instant - TimeInstant : The TimeInstant, to which...span - TimeSpan : ...this TimeSpan will be addedpublic static TimeInstant subtract(TimeInstant instant, TimeSpan span)
instant - TimeInstant : The TimeInstant, from which...span - TimeSpan : ...this TimeSpan will be subtractedpublic static TimeSpan diff(TimeSpan a, TimeSpan b)
a - TimeSpan : TimeSpan ab - TimeSpan : TimeSpan bpublic static TimeSpan diff(TimeInstant a, TimeInstant b)
Long.MAX_VALUE-1 (in the unit of epsilon).a - TimeInstant : TimeInstant ab - TimeInstant : TimeInstant bpublic static TimeSpan multiply(TimeSpan span, double factor)
Long.MAX_VALUE-1
(in the unit of epsilon).span - TimeSpan : The span of timefactor - double : The scalar factorpublic static TimeSpan multiply(double factor, TimeSpan span)
Long.MAX_VALUE-1
(in the unit of epsilon).factor - double : The scalar factorspan - TimeSpan : The span of timepublic static double divide(TimeSpan dividend, TimeSpan divisor)
dividend - TimeSpan : The dividenddivisor - TimeSpan : The divisorpublic static TimeSpan divide(TimeSpan dividend, double divisor)
dividend - TimeSpan : The dividenddivisor - double : The divisorpublic static java.util.concurrent.TimeUnit getEpsilon()
public static TimeSpan getEpsilonSpan()
public static java.util.concurrent.TimeUnit getReferenceUnit()
new TimeSpan(5).public static void setReferenceUnitX(java.util.concurrent.TimeUnit referenceUnit)
new TimeSpan(5).referenceUnit - the reference time unitpublic static java.lang.String formatTimeInstant(TimeInstant instant)
instant - the instant of time to be formattedpublic static java.lang.String formatTimeSpan(TimeSpan span)
span - the span of time to be formattedpublic static TimeFormatter getTimeFormatter()
public static void setTimeFormatter(TimeFormatter myTimeFormatter, boolean override)
myTimeFormatter - the Time Formatteroverride - indicates that a custom TimeFormatter is supplied (true).
This formatter will persist even if future calls to this method provide additional
TimeFormatters who have this parameter set to false.
The default time TimeFormatter supplied during the Experiment
setup will use override = false, so that the default formatter will only
be used if no TimeFormatter has been explicitly set the the user.public static TimeFormatter getDefaultTimeFormatter()
SingleUnitTimeFormatter, using the current reference
unit and four floating point digits.public static TimeInstant getStartTime()