public static enum Unit.Frequency extends Enum<Unit.Frequency>
Enum Constant and Description |
---|
GHZ
gigahertz.
|
HZ
hertz.
|
KHZ
kilohertz.
|
MHZ
megahertz.
|
MiHZ
millihertz.
|
THZ
terahertz.
|
Modifier and Type | Field and Description |
---|---|
static double |
ZERO_THRESHOLD
Constant used to determine whether we should show "0Hz".
|
Modifier and Type | Method and Description |
---|---|
static String |
format(double aFrequency)
Convenience method to directly get a displayable represention of a given
frequency.
|
String |
format(double aFrequency,
int aScale)
Returns the given frequency as string representation using this frequency
unit's display name.
|
String |
getDisplayName()
Returns display name of this frequency unit, like "Hz" or "MHz".
|
double |
getFactor()
Returns the scale factor to get from Hertz to this frequency unit.
|
static Unit.Frequency |
toUnit(double aFrequency)
Converts a given period to a
FrequencyUnit instance. |
static Unit.Frequency |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static Unit.Frequency[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Unit.Frequency MiHZ
public static final Unit.Frequency HZ
public static final Unit.Frequency KHZ
public static final Unit.Frequency MHZ
public static final Unit.Frequency GHZ
public static final Unit.Frequency THZ
public static final double ZERO_THRESHOLD
public static Unit.Frequency[] values()
for (Unit.Frequency c : Unit.Frequency.values()) System.out.println(c);
public static Unit.Frequency 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 aFrequency)
This method does the same as calling:
toUnit( aFrequency ).format( aFrequency, 3 );
.
aFrequency
- the frequency to get a displayable representation for.null
.public static Unit.Frequency toUnit(double aFrequency)
FrequencyUnit
instance.aFrequency
- the frequency to convert to a FrequencyUnit
.FrequencyUnit
instance, never null
.public String format(double aFrequency, int aScale)
aFrequency
- the frequency 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()
null
.public double getFactor()
Copyright © 2015 L'Xtreme IT consultancy. All rights reserved.