Package org.djunits.unit.si
Enum Class SIPrefixes
- All Implemented Interfaces:
Serializable
,Comparable<SIPrefixes>
,java.lang.constant.Constable
Useful sets of SI prefixes.
Copyright (c) 2019-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License
- Author:
- Alexander Verbraeck
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
Modifier and TypeFieldDescriptionThe map that translates an SI prefix power to the SI Prefix.The SI prefixes and their values for the "KILO" settings.The SI prefixes and their values for the "PER_UNIT" settings.The larger than 1 SI prefixes and their values for the "UNIT_POS" settings.The SI prefixes and their values for the "UNIT" settings. -
Method Summary
Modifier and TypeMethodDescriptionstatic SIPrefix
getKiloUnit
(String prefixKey) Return the prefix information for the given prefix key (e.g., "G" for "giga"), with an offset of a factor 1000 for units that have "kilo" as the default.static SIPrefix
getPerUnit
(String prefixKey) Look up and return the prefix information for the given prefix key (e.g., "/n" for "per nano").static SIPrefix
Look up and return the prefix information for the given prefix key (e.g., "G" for "giga").static SIPrefixes
Returns the enum constant of this class with the specified name.static SIPrefixes[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
No SI prefixes allowed. E.g., for the "inch". -
UNIT
All standard SI prefixes allowed. E.g., for the "meter". -
UNIT_POS
All SI prefixes indicating larger than 1. E.g., for the electronVolt to avoid underflow with float values. -
PER_UNIT
All standard SI prefixes allowed for "per unit". E.g., for the "per second". -
KILO
SI prefixes allowed, but default starts with "kilo" / "k", e.g., for the "kilogram".
-
-
Field Details
-
UNIT_PREFIXES
The SI prefixes and their values for the "UNIT" settings. -
PER_UNIT_PREFIXES
The SI prefixes and their values for the "PER_UNIT" settings. -
UNIT_POS_PREFIXES
The larger than 1 SI prefixes and their values for the "UNIT_POS" settings. -
KILO_PREFIXES
The SI prefixes and their values for the "KILO" settings. -
FACTORS
The map that translates an SI prefix power to the SI Prefix.
-
-
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
-
getUnit
Look up and return the prefix information for the given prefix key (e.g., "G" for "giga").- Parameters:
prefixKey
- String; the prefix key, e.g., "G" for "giga"- Returns:
- SIPrefix; the SIPrefix information, or null if the
prefixKey
does not exist
-
getPerUnit
Look up and return the prefix information for the given prefix key (e.g., "/n" for "per nano").- Parameters:
prefixKey
- String; the prefix key, e.g., "/n" for "per nano"- Returns:
- SIPrefix; the SIPrefix information, or null if the
prefixKey
does not exist
-
getKiloUnit
Return the prefix information for the given prefix key (e.g., "G" for "giga"), with an offset of a factor 1000 for units that have "kilo" as the default.- Parameters:
prefixKey
- String; the prefix key, e.g., "G" for "giga"- Returns:
- SIPrefix; the SIPrefix information, with an offset of 1000. So "k" will return 1, and "" will return 1.0E-3.
-