Package javax.measure
Enum MetricPrefix
- All Implemented Interfaces:
Serializable
,Comparable<MetricPrefix>
,java.lang.constant.Constable
,Prefix
public enum MetricPrefix extends Enum<MetricPrefix> implements Prefix
Provides support for the 20 prefixes used in the metric system (decimal multiples and submultiples of units). For example:
import static tech.units.indriya.unit.Units.*; // Static import.
import static javax.measure.MetricPrefix.*; // Static import.
import javax.measure.*;
import javax.measure.quantity.*;
...
Unit<Pressure> HECTOPASCAL = HECTO(PASCAL);
Unit<Length> KILOMETRE = KILO(METRE);
- Since:
- 2.0
- Version:
- 2.0, June 28, 2019
- Author:
- Jean-Marie Dautelle, Werner Keil
- See Also:
- Wikipedia: Metric Prefix
-
Nested Class Summary
-
Enum Constant Summary
Enum Constants Enum Constant Description ATTO
Prefix for 10-18.CENTI
Prefix for 10-2.DECI
Prefix for 10-1.DEKA
Prefix for 101.EXA
Prefix for 1018.FEMTO
Prefix for 10-15.GIGA
Prefix for 109.HECTO
Prefix for 102.KILO
Prefix for 103.MEGA
Prefix for 106.MICRO
Prefix for 10-6.MILLI
Prefix for 10-3.NANO
Prefix for 10-9.PETA
Prefix for 1015.PICO
Prefix for 10-12.TERA
Prefix for 1012.YOCTO
Prefix for 10-24.YOTTA
Prefix for 1024.ZEPTO
Prefix for 10-21.ZETTA
Prefix for 1021. -
Method Summary
Modifier and Type Method Description static <Q extends Quantity<Q>>
Unit<Q>ATTO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-18
static <Q extends Quantity<Q>>
Unit<Q>CENTI(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-2
static <Q extends Quantity<Q>>
Unit<Q>DECI(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-1
static <Q extends Quantity<Q>>
Unit<Q>DEKA(Unit<Q> unit)
Returns the specified unit multiplied by the factor101
static <Q extends Quantity<Q>>
Unit<Q>EXA(Unit<Q> unit)
Returns the specified unit multiplied by the factor1018
static <Q extends Quantity<Q>>
Unit<Q>FEMTO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-15
int
getExponent()
Exponent part of the associated factor inbase^exponent
representation.String
getName()
Returns the name of this prefix.String
getSymbol()
Returns the symbol of this prefix.Integer
getValue()
Base part of the associated factor inbase^exponent
representation.static <Q extends Quantity<Q>>
Unit<Q>GIGA(Unit<Q> unit)
Returns the specified unit multiplied by the factor109
static <Q extends Quantity<Q>>
Unit<Q>HECTO(Unit<Q> unit)
Returns the specified unit multiplied by the factor102
static <Q extends Quantity<Q>>
Unit<Q>KILO(Unit<Q> unit)
Returns the specified unit multiplied by the factor103
static <Q extends Quantity<Q>>
Unit<Q>MEGA(Unit<Q> unit)
Returns the specified unit multiplied by the factor106
static <Q extends Quantity<Q>>
Unit<Q>MICRO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-6
static <Q extends Quantity<Q>>
Unit<Q>MILLI(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-3
static <Q extends Quantity<Q>>
Unit<Q>NANO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-9
static <Q extends Quantity<Q>>
Unit<Q>PETA(Unit<Q> unit)
Returns the specified unit multiplied by the factor1015
static <Q extends Quantity<Q>>
Unit<Q>PICO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-12
static <Q extends Quantity<Q>>
Unit<Q>TERA(Unit<Q> unit)
Returns the specified unit multiplied by the factor1012
static MetricPrefix
valueOf(String name)
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.static <Q extends Quantity<Q>>
Unit<Q>YOCTO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-24
static <Q extends Quantity<Q>>
Unit<Q>YOTTA(Unit<Q> unit)
Returns the specified unit multiplied by the factor1024
static <Q extends Quantity<Q>>
Unit<Q>ZEPTO(Unit<Q> unit)
Returns the specified unit multiplied by the factor10-21
static <Q extends Quantity<Q>>
Unit<Q>ZETTA(Unit<Q> unit)
Returns the specified unit multiplied by the factor1021
-
Enum Constant Details
-
YOTTA
Prefix for 1024. -
ZETTA
Prefix for 1021. -
EXA
Prefix for 1018. -
PETA
Prefix for 1015. -
TERA
Prefix for 1012. -
GIGA
Prefix for 109. -
MEGA
Prefix for 106. -
KILO
Prefix for 103. -
HECTO
Prefix for 102. -
DEKA
Prefix for 101. -
DECI
Prefix for 10-1. -
CENTI
Prefix for 10-2. -
MILLI
Prefix for 10-3. -
MICRO
Prefix for 10-6. -
NANO
Prefix for 10-9. -
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.
-
-
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
-
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.times(1e24)
.
-
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.times(1e21)
.
-
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.times(1e18)
.
-
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.times(1e15)
.
-
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.times(1e12)
.
-
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.times(1e9)
.
-
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.times(1e6)
.
-
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.times(1e3)
.
-
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.times(1e2)
.
-
DEKA
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.times(1e1)
.
-
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.times(1e-1)
.
-
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.times(1e-2)
.
-
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.times(1e-3)
.
-
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.times(1e-6)
.
-
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.times(1e-9)
.
-
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.times(1e-12)
.
-
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.times(1e-15)
.
-
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.times(1e-18)
.
-
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.times(1e-21)
.
-
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.times(1e-24)
.
-
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.
-