Package javax.measure
Enum MetricPrefix
- All Implemented Interfaces:
Serializable
,Comparable<MetricPrefix>
,Constable
,Prefix
Provides support for the 24 prefixes used in the metric system (decimal multiples and submultiples of units). For example:
import static tech.units.indriya.unit.Units.*; // Static import (from the RI).
import static javax.measure.MetricPrefix.*; // Static import.
import javax.measure.*;
import javax.measure.quantity.*;
...
Unit<Pressure> HECTOPASCAL = HECTO(PASCAL);
Unit<Length> KILOMETRE = KILO(METRE);
You could also apply Unit.prefix
:
...
Unit<Pressure> HECTOPASCAL = PASCAL.prefix(HECTO);
Unit<Length> KILOMETRE = METRE.prefix(KILO);
Do not use ordinal() to obtain the numeric representation of MetricPrefix. Use getValue() and getExponent() instead.
- Implementation Requirements
- This is an immutable and thread-safe enum.
- Since:
- 2.0
- Version:
- 2.4, October 31, 2023
- Author:
- Jean-Marie Dautelle, Werner Keil
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantDescriptionPrefix for 10-18.Prefix for 10-2.Prefix for 101.Prefix for 10-1.Prefix for 1018.Prefix for 10-15.Prefix for 109.Prefix for 102.Prefix for 103.Prefix for 106.Prefix for 10-6.Prefix for 10-3.Prefix for 10-9.Prefix for 1015.Prefix for 10-12.Prefix for 10-30.Prefix for 1030.Prefix for 1027.Prefix for 10-27.Prefix for 1012.Prefix for 10-24.Prefix for 1024.Prefix for 10-21.Prefix for 1021. -
Method Summary
Modifier and TypeMethodDescriptionReturns the specified unit multiplied by the factor10-18
Returns the specified unit multiplied by the factor10-2
Returns the specified unit multiplied by the factor101
Returns the specified unit multiplied by the factor10-1
US alias forDECA
.Returns the specified unit multiplied by the factor1018
Returns the specified unit multiplied by the factor10-15
int
Exponent part of the associated factor inbase^exponent
representation.getName()
Returns the name of this prefix.Returns the symbol of this prefix.getValue()
Base part of the associated factor inbase^exponent
representation.Returns the specified unit multiplied by the factor109
Returns the specified unit multiplied by the factor102
Returns the specified unit multiplied by the factor103
Returns the specified unit multiplied by the factor106
Returns the specified unit multiplied by the factor10-6
Returns the specified unit multiplied by the factor10-3
Returns the specified unit multiplied by the factor10-9
Returns the specified unit multiplied by the factor1015
Returns the specified unit multiplied by the factor10-12
Returns the specified unit multiplied by the factor10-30
Returns the specified unit multiplied by the factor1030
Returns the specified unit multiplied by the factor1027
Returns the specified unit multiplied by the factor10-27
Returns the specified unit multiplied by the factor1012
static MetricPrefix
Returns the enum constant of this type with the specified name.static MetricPrefix[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Returns the specified unit multiplied by the factor10-24
Returns the specified unit multiplied by the factor1024
Returns the specified unit multiplied by the factor10-21
Returns the specified unit multiplied by the factor1021
-
Enum Constant Details
-
QUETTA
Prefix for 1030. -
RONNA
Prefix for 1027. -
YOTTA
Prefix for 1024. -
ZETTA
Prefix for 1021. -
EXA
Prefix for 1018. -
PETA
Prefix for 1015. -
TERA
Prefix for 1012. -
GIGA
Prefix for 109.- See Also:
-
MEGA
Prefix for 106.- See Also:
-
KILO
Prefix for 103.- See Also:
-
HECTO
Prefix for 102.- See Also:
-
DECA
Prefix for 101.- See Also:
-
DECI
Prefix for 10-1.- See Also:
-
CENTI
Prefix for 10-2.- See Also:
-
MILLI
Prefix for 10-3.- See Also:
-
MICRO
Prefix for 10-6.- See Also:
-
NANO
Prefix for 10-9.- See Also:
-
PICO
Prefix for 10-12. -
FEMTO
Prefix for 10-15. -
ATTO
Prefix for 10-18. -
ZEPTO
Prefix for 10-21. -
YOCTO
Prefix for 10-24. -
RONTO
Prefix for 10-27. -
QUECTO
Prefix for 10-30.
-
-
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
-
QUETTA
Returns the specified unit multiplied by the factor1030
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e30)
.- See Also:
-
RONNA
Returns the specified unit multiplied by the factor1027
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e27)
.- See Also:
-
YOTTA
Returns the specified unit multiplied by the factor1024
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e24)
.- See Also:
-
ZETTA
Returns the specified unit multiplied by the factor1021
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e21)
.- See Also:
-
EXA
Returns the specified unit multiplied by the factor1018
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e18)
.- See Also:
-
PETA
Returns the specified unit multiplied by the factor1015
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e15)
.- See Also:
-
TERA
Returns the specified unit multiplied by the factor1012
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e12)
.- See Also:
-
GIGA
Returns the specified unit multiplied by the factor109
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e9)
.- See Also:
-
MEGA
Returns the specified unit multiplied by the factor106
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e6)
.- See Also:
-
KILO
Returns the specified unit multiplied by the factor103
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e3)
.- See Also:
-
HECTO
Returns the specified unit multiplied by the factor102
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e2)
.- See Also:
-
DECA
Returns the specified unit multiplied by the factor101
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e1)
.- See Also:
-
DEKA
US alias forDECA
.- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e1)
.- See Also:
-
DECI
Returns the specified unit multiplied by the factor10-1
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-1)
.- See Also:
-
CENTI
Returns the specified unit multiplied by the factor10-2
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-2)
.- See Also:
-
MILLI
Returns the specified unit multiplied by the factor10-3
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-3)
.- See Also:
-
MICRO
Returns the specified unit multiplied by the factor10-6
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-6)
.- See Also:
-
NANO
Returns the specified unit multiplied by the factor10-9
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-9)
.- See Also:
-
PICO
Returns the specified unit multiplied by the factor10-12
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-12)
.- See Also:
-
FEMTO
Returns the specified unit multiplied by the factor10-15
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-15)
.- See Also:
-
ATTO
Returns the specified unit multiplied by the factor10-18
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-18)
.- See Also:
-
ZEPTO
Returns the specified unit multiplied by the factor10-21
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-21)
. #see ZEPTO
-
YOCTO
Returns the specified unit multiplied by the factor10-24
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-24)
.- See Also:
-
RONTO
Returns the specified unit multiplied by the factor10-27
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-27)
.- See Also:
-
QUECTO
Returns the specified unit multiplied by the factor10-30
- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.prefix(1e-30)
.- See Also:
-
getSymbol
Returns the symbol of this prefix. -
getValue
Base part of the associated factor inbase^exponent
representation. For metric prefix, this is always 10. -
getExponent
Exponent part of the associated factor inbase^exponent
representation.- Specified by:
getExponent
in interfacePrefix
- Returns:
- the exponent part of this prefix.
-
getName
Returns the name of this prefix.
-