|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<UnitOfTime>
nl.lxtreme.ols.api.util.UnitOfTime
public enum UnitOfTime
Represents a unit of time that can be displayed has a scale factor.
Enum Constant Summary | |
---|---|
FS
femtoseconds. |
|
MS
milliseconds. |
|
NS
nanoseconds. |
|
PS
picoseconds. |
|
S
seconds. |
|
US
microseconds. |
Field Summary | |
---|---|
static double |
ZERO_THRESHOLD
Constant used to determine whether we should show "0.000 s". |
Method Summary | |
---|---|
static String |
format(double aTime)
Convenience method to directly get a displayable represention of a given time value. |
String |
format(double aTime,
int aScale)
Returns the given time as string representation using this time unit's display name and a fixed number of digits after the decimal separator. |
String |
formatHumanReadable(double aTime)
Returns the given time as string representation using this time unit's display name and the least number of digits after the decimal separator. |
String |
getDisplayName()
Returns the current value of displayName. |
double |
getFactor()
Returns the current value of factor. |
UnitOfTime |
predecessor()
Returns the predecessor of this unit of time. |
UnitOfTime |
successor()
Returns the successor of this unit of time. |
static UnitOfTime |
toUnit(double aTimeValue)
Converts a given time value (as double representation, in seconds) to a more suitable unit of time. |
static UnitOfTime |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static UnitOfTime[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final UnitOfTime S
public static final UnitOfTime MS
public static final UnitOfTime US
public static final UnitOfTime NS
public static final UnitOfTime PS
public static final UnitOfTime FS
Field Detail |
---|
public static final double ZERO_THRESHOLD
Method Detail |
---|
public static UnitOfTime[] values()
for (UnitOfTime c : UnitOfTime.values()) System.out.println(c);
public static UnitOfTime valueOf(String name)
name
- the name of the enum constant to be returned.
IllegalArgumentException
- if this enum type has no constant
with the specified name
NullPointerException
- if the argument is nullpublic static String format(double aTime)
This method does the same as calling:
toUnit( aTime ).format( aTime, 3 );
.
aTime
- the time value (in seconds) to get a displayable representation
for.
null
.public static UnitOfTime toUnit(double aTimeValue)
aTimeValue
- the time value (in seconds) to return the unit of time for.
UnitOfTime
, never null
.public String format(double aTime, int aScale)
aTime
- the time (in seconds) to convert to a string representation;aScale
- the scale (= number of digits after decimal separator) to use in
the string representation.
null
.public String formatHumanReadable(double aTime)
aTime
- the time (in seconds) to convert to a string representation;aScale
- the scale (= number of digits after decimal separator) to use in
the string representation.
null
.public String getDisplayName()
public double getFactor()
public UnitOfTime predecessor()
null
if
no greater unit of time is defined.public UnitOfTime successor()
null
if no smaller unit of time is defined.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |