|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<FrequencyUnit>
nl.lxtreme.ols.api.util.FrequencyUnit
public enum FrequencyUnit
Represents a frequency unit that has a displayable representation and a scale factor to convert it from/to Hertz.
Enum Constant Summary | |
---|---|
GHZ
gigahertz. |
|
HZ
hertz. |
|
KHZ
kilohertz. |
|
MHZ
megahertz. |
|
MiHZ
millihertz. |
|
THZ
terahertz. |
Field Summary | |
---|---|
static double |
ZERO_THRESHOLD
Constant used to determine whether we should show "0Hz". |
Method Summary | |
---|---|
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 FrequencyUnit |
toUnit(double aFrequency)
Converts a given period to a FrequencyUnit instance. |
static FrequencyUnit |
valueOf(String name)
Returns the enum constant of this type with the specified name. |
static FrequencyUnit[] |
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 FrequencyUnit MiHZ
public static final FrequencyUnit HZ
public static final FrequencyUnit KHZ
public static final FrequencyUnit MHZ
public static final FrequencyUnit GHZ
public static final FrequencyUnit THZ
Field Detail |
---|
public static final double ZERO_THRESHOLD
Method Detail |
---|
public static FrequencyUnit[] values()
for (FrequencyUnit c : FrequencyUnit.values()) System.out.println(c);
public static FrequencyUnit 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 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 FrequencyUnit 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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |