public static enum Unit.Time extends Enum<Unit.Time>
Enum Constant and Description |
---|
FS
femtoseconds.
|
MS
milliseconds.
|
NS
nanoseconds.
|
PS
picoseconds.
|
S
seconds.
|
US
microseconds.
|
Modifier and Type | Field and Description |
---|---|
static double |
ZERO_THRESHOLD
Constant used to determine whether we should show "0.000 s".
|
Modifier and Type | Method and Description |
---|---|
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.
|
Unit.Time |
predecessor()
Returns the predecessor of this unit of time.
|
Unit.Time |
successor()
Returns the successor of this unit of time.
|
static Unit.Time |
toUnit(double aTimeValue)
Converts a given time value (as double representation, in seconds) to a
more suitable unit of time.
|
static Unit.Time |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Unit.Time[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Unit.Time S
public static final Unit.Time MS
public static final Unit.Time US
public static final Unit.Time NS
public static final Unit.Time PS
public static final Unit.Time FS
public static final double ZERO_THRESHOLD
public static Unit.Time[] values()
for (Unit.Time c : Unit.Time.values()) System.out.println(c);
public static Unit.Time valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- 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 Unit.Time toUnit(double aTimeValue)
aTimeValue
- the time value (in seconds) to return the unit of time for.Unit.Time
, 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 Unit.Time predecessor()
null
if no greater unit of time is defined.public Unit.Time successor()
null
if no smaller unit of time is defined.Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.