Package org.djunits.unit.si
Enum SIPrefixes
- java.lang.Object
-
- java.lang.Enum<SIPrefixes>
-
- org.djunits.unit.si.SIPrefixes
-
- All Implemented Interfaces:
Serializable
,Comparable<SIPrefixes>
public enum SIPrefixes extends Enum<SIPrefixes>
Useful sets of SI prefixes.Copyright (c) 2019-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See DJUNITS License- Author:
- Alexander Verbraeck
-
-
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
All Methods Static Methods Concrete Methods 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 Detail
-
NONE
public static final SIPrefixes NONE
No SI prefixes allowed. E.g., for the "inch".
-
UNIT
public static final SIPrefixes UNIT
All standard SI prefixes allowed. E.g., for the "meter".
-
UNIT_POS
public static final SIPrefixes UNIT_POS
All SI prefixes indicating larger than 1. E.g., for the electronVolt to avoid underflow with float values.
-
PER_UNIT
public static final SIPrefixes PER_UNIT
All standard SI prefixes allowed for "per unit". E.g., for the "per second".
-
KILO
public static final SIPrefixes KILO
SI prefixes allowed, but default starts with "kilo" / "k", e.g., for the "kilogram".
-
-
Field Detail
-
UNIT_PREFIXES
public static final Map<String,SIPrefix> UNIT_PREFIXES
The SI prefixes and their values for the "UNIT" settings.
-
PER_UNIT_PREFIXES
public static final Map<String,SIPrefix> PER_UNIT_PREFIXES
The SI prefixes and their values for the "PER_UNIT" settings.
-
UNIT_POS_PREFIXES
public static final Map<String,SIPrefix> UNIT_POS_PREFIXES
The larger than 1 SI prefixes and their values for the "UNIT_POS" settings.
-
-
Method Detail
-
values
public static SIPrefixes[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (SIPrefixes c : SIPrefixes.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static SIPrefixes valueOf(String name)
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
public static SIPrefix getUnit(String prefixKey)
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
public static SIPrefix getPerUnit(String prefixKey)
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
public 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.- 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.
-
-