Enum Class Unit
- All Implemented Interfaces:
Serializable,Comparable<Unit>,Constable
Enumeration of supported units of measure.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription -
Method Summary
Modifier and TypeMethodDescriptionbase()doublefactor()booleanisBase()static UnitofSerdeNumber(short n) doubleScale a value from this unit to another of the same base unit.shortsymbol()static UnitReturns the enum constant of this class with the specified name.static Unitstatic Unit[]values()Returns an array containing the constants of this enum class, in the order they are declared.static UnitwithDescription(String description) Get the unit corresponding to the specifieddescription.
-
Enum Constant Details
-
NONE
-
BITS
-
KILOBITS
-
MEGABITS
-
GIGABITS
-
TERABITS
-
BYTES
-
KILOBYTES
-
KIBIBYTES
-
MEGABYTES
-
MEBIBYTES
-
GIGABYTES
-
GIBIBYTES
-
TERABYTES
-
TEBIBYTES
-
PETABYTES
-
PEBIBYTES
-
EXABYTES
-
EXBIBYTES
-
BITS_PER_SECOND
-
KILOBITS_PER_SECOND
-
MEGABITS_PER_SECOND
-
GIGABITS_PER_SECOND
-
TERABITS_PER_SECOND
-
BYTES_PER_SECOND
-
KILOBYTES_PER_SECOND
-
KIBIBYTES_PER_SECOND
-
MEGABYTES_PER_SECOND
-
GIGABYTES_PER_SECOND
-
TERABYTES_PER_SECOND
-
PER_SECOND
-
PER_MINUTE
-
NANOSECONDS
-
MICROSECONDS
-
MILLISECONDS
-
SECONDS
-
MINUTES
-
HOURS
-
DAYS
-
DEGREES_CELSIUS
-
HERTZ
-
MEGAHERTZ
-
GIGAHERTZ
-
PERCENT
-
FRACTION
-
NANOCORES
-
CORES
-
MICROCORES
-
MILLICORES
-
EPOCH_NANOSECONDS
-
EPOCH_MILLISECONDS
-
METRES
-
KILOMETRES
-
VOLTS
-
KILOVOLTS
-
MILLIAMPERES
-
AMPERES
-
JOULES
-
KILOJOULES
-
WATTS
-
GRAMS
-
KILOGRAMS
-
AUD
-
CAD
-
CHF
-
CNY
-
DKK
-
EUR
-
GBP
-
HKD
-
JPY
-
NOK
-
NZD
-
SEK
-
SGD
-
USD
-
ZAR
-
BYTE_SECONDS
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
isBase
public boolean isBase()- Returns:
Trueif this is a base unit,falseotherwise.
-
base
- Returns:
- This unit's base unit, which is itself if this is a base unit.
-
description
- Returns:
- This unit's description.
-
symbol
- Returns:
- This unit's symbol, or
nullif it does not have one.
-
factor
public double factor()- Returns:
- This unit's scaling factor relative to it's base unit.
-
serdeNumber
public short serdeNumber()- Returns:
- Unique serialization number.
-
scale
Scale a value from this unit to another of the same base unit.- Parameters:
value- value to scaletarget- target unit- Returns:
- equivalent value in the target unit
- Throws:
IllegalArgumentException- if this unit and the target unit do not have the same base
-
withDescription
Get the unit corresponding to the specifieddescription.- Parameters:
description- The description.- Returns:
- The unit.
- Throws:
IllegalArgumentException- If the specifieddescriptionis unknown.
-
valueOf
- Parameters:
timeUnit- source unit- Returns:
- The equivalent unit, or
NONEif no match.
-
ofSerdeNumber
- Parameters:
n- serde number- Returns:
- the type corresponding to the given serde number
- Throws:
IllegalArgumentException- if no match found
-