SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.util.TimeUnit Enum Reference

Represents a time unit for conversion of time durations. More...

Public Member Functions

String getShortName ()
 Returns the short name representing this unit in a string specifying a time duration.
String getLongName ()
 Returns the long name of this time unit.
String toString ()
 Calls getLongName.
double getHours ()
 Returns this time unit represented in hours.

Static Public Member Functions

static double convert (double value, TimeUnit srcUnit, TimeUnit dstUnit)
 Converts value expressed in time unit srcUnit to a time duration expressed in dstUnit and returns the result of the conversion.

enum values @{

 NANOSECOND =("ns", "nanosecond", 1.0 / 3600000000000.0)
 Represents a nanosecond which has short name ns.
 MICROSECOND =("us", "microsecond", 1.0 / 3600000000.0)
 Represents a microsecond which has short name us.
 MILLISECOND =("ms", "millisecond", 1.0 / 3600000.0)
 Represents a millisecond which has short name ms.
 SECOND =("s", "second", 1.0 / 3600.0)
 Represents a second which has short name s.
 MINUTE =("min", "minute", 1.0 / 60.0)
 Represents a minute which has short name min.
 HOUR =("h", "hour", 1.0)
 Represents an hour which has short name h.
 DAY =("d", "day", 24.0)
 Represents a day which has short name d.
 WEEK =("w", "week", 24.0 * 7)
 Represents a week which has short name w.

Detailed Description

Represents a time unit for conversion of time durations.

A time unit instance can be used to get information about the time unit and as a selector to perform conversions. Each time unit has a short name used when representing a time unit, a full descriptive name, and the number of hours corresponding to one unit.

Definition at line 36 of file TimeUnit.java.

Member Function Documentation

◆ convert()

double umontreal.ssj.util.TimeUnit.convert ( double value,
TimeUnit srcUnit,
TimeUnit dstUnit )
static

Converts value expressed in time unit srcUnit to a time duration expressed in dstUnit and returns the result of the conversion.

Parameters
valuethe value being converted.
srcUnitthe source time unit.
dstUnitthe destination time unit.
Returns
the converted value.
Exceptions
NullPointerExceptionif `srcUnit` or `dstUnit` are `null`.

Definition at line 161 of file TimeUnit.java.

◆ getHours()

double umontreal.ssj.util.TimeUnit.getHours ( )

Returns this time unit represented in hours.

This returns the number of hours corresponding to one unit.

Returns
the time unit represented in hours.

Definition at line 146 of file TimeUnit.java.

◆ getLongName()

String umontreal.ssj.util.TimeUnit.getLongName ( )

Returns the long name of this time unit.

Returns
the long name of this time unit.

Definition at line 127 of file TimeUnit.java.

◆ getShortName()

String umontreal.ssj.util.TimeUnit.getShortName ( )

Returns the short name representing this unit in a string specifying a time duration.

Returns
the short name of this time unit.

Definition at line 118 of file TimeUnit.java.

◆ toString()

String umontreal.ssj.util.TimeUnit.toString ( )

Calls getLongName.

Returns
the result of getLongName.

Definition at line 136 of file TimeUnit.java.

Member Data Documentation

◆ DAY

umontreal.ssj.util.TimeUnit.DAY =("d", "day", 24.0)

Represents a day which has short name d.

Definition at line 87 of file TimeUnit.java.

◆ HOUR

umontreal.ssj.util.TimeUnit.HOUR =("h", "hour", 1.0)

Represents an hour which has short name h.

Definition at line 80 of file TimeUnit.java.

◆ MICROSECOND

umontreal.ssj.util.TimeUnit.MICROSECOND =("us", "microsecond", 1.0 / 3600000000.0)

Represents a microsecond which has short name us.

Definition at line 52 of file TimeUnit.java.

◆ MILLISECOND

umontreal.ssj.util.TimeUnit.MILLISECOND =("ms", "millisecond", 1.0 / 3600000.0)

Represents a millisecond which has short name ms.

Definition at line 59 of file TimeUnit.java.

◆ MINUTE

umontreal.ssj.util.TimeUnit.MINUTE =("min", "minute", 1.0 / 60.0)

Represents a minute which has short name min.

Definition at line 73 of file TimeUnit.java.

◆ NANOSECOND

umontreal.ssj.util.TimeUnit.NANOSECOND =("ns", "nanosecond", 1.0 / 3600000000000.0)

Represents a nanosecond which has short name ns.

Definition at line 45 of file TimeUnit.java.

◆ SECOND

umontreal.ssj.util.TimeUnit.SECOND =("s", "second", 1.0 / 3600.0)

Represents a second which has short name s.

Definition at line 66 of file TimeUnit.java.

◆ WEEK

umontreal.ssj.util.TimeUnit.WEEK =("w", "week", 24.0 * 7)

Represents a week which has short name w.

Definition at line 96 of file TimeUnit.java.


The documentation for this enum was generated from the following file: