Package org.djunits.unit.si
Enum SIPrefixes
- All Implemented Interfaces:
Serializable
,Comparable<SIPrefixes>
,java.lang.constant.Constable
public enum SIPrefixes extends Enum<SIPrefixes>
Useful sets of SI prefixes.
Copyright (c) 2019-2019 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
-
Enum Constant Summary
Enum Constants Enum Constant Description KILO
SI prefixes allowed, but default starts with "kilo" / "k", e.g., for the "kilogram".NONE
No SI prefixes allowed.PER_UNIT
All standard SI prefixes allowed for "per unit".UNIT
All standard SI prefixes allowed.UNIT_POS
All SI prefixes indicating larger than 1. -
Field Summary
Fields Modifier and Type Field Description static Map<String,SIPrefix>
KILO_PREFIXES
The SI prefixes and their values for the "KILO" settings.static Map<String,SIPrefix>
PER_UNIT_PREFIXES
The SI prefixes and their values for the "PER_UNIT" settings.static Map<String,SIPrefix>
UNIT_POS_PREFIXES
The larger than 1 SI prefixes and their values for the "UNIT_POS" settings.static Map<String,SIPrefix>
UNIT_PREFIXES
The SI prefixes and their values for the "UNIT" settings. -
Method Summary
Modifier and Type Method Description static 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
getUnit(String prefixKey)
Look up and return the prefix information for the given prefix key (e.g., "G" for "giga").static SIPrefixes
valueOf(String name)
Returns the enum constant of this type with the specified name.static SIPrefixes[]
values()
Returns an array containing the constants of this enum type, 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.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type 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.
-