Package javax.measure
Enum MetricPrefix
- java.lang.Object
-
- java.lang.Enum<MetricPrefix>
-
- javax.measure.MetricPrefix
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<MetricPrefix>,Prefix
public enum MetricPrefix extends java.lang.Enum<MetricPrefix> implements Prefix
Provides support for the 24 prefixes used in the metric system (decimal multiples and submultiples of units). For example:
You could also applyimport 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);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.3, May 20, 2023
- Author:
- Jean-Marie Dautelle, Werner Keil
- See Also:
- Wikipedia: Metric Prefix
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ATTOPrefix for 10-18.CENTIPrefix for 10-2.DECAPrefix for 101.DECIPrefix for 10-1.EXAPrefix for 1018.FEMTOPrefix for 10-15.GIGAPrefix for 109.HECTOPrefix for 102.KILOPrefix for 103.MEGAPrefix for 106.MICROPrefix for 10-6.MILLIPrefix for 10-3.NANOPrefix for 10-9.PETAPrefix for 1015.PICOPrefix for 10-12.QUECTOPrefix for 10-30.QUETTAPrefix for 1030.RONNAPrefix for 1027.RONTOPrefix for 10-27.TERAPrefix for 1012.YOCTOPrefix for 10-24.YOTTAPrefix for 1024.ZEPTOPrefix for 10-21.ZETTAPrefix for 1021.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <Q extends Quantity<Q>>
Unit<Q>ATTO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-18static <Q extends Quantity<Q>>
Unit<Q>CENTI(Unit<Q> unit)Returns the specified unit multiplied by the factor10-2static <Q extends Quantity<Q>>
Unit<Q>DECA(Unit<Q> unit)Returns the specified unit multiplied by the factor101static <Q extends Quantity<Q>>
Unit<Q>DECI(Unit<Q> unit)Returns the specified unit multiplied by the factor10-1static <Q extends Quantity<Q>>
Unit<Q>DEKA(Unit<Q> unit)US alias forDECA.static <Q extends Quantity<Q>>
Unit<Q>EXA(Unit<Q> unit)Returns the specified unit multiplied by the factor1018static <Q extends Quantity<Q>>
Unit<Q>FEMTO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-15intgetExponent()Exponent part of the associated factor inbase^exponentrepresentation.java.lang.StringgetName()Returns the name of this prefix.java.lang.StringgetSymbol()Returns the symbol of this prefix.java.lang.IntegergetValue()Base part of the associated factor inbase^exponentrepresentation.static <Q extends Quantity<Q>>
Unit<Q>GIGA(Unit<Q> unit)Returns the specified unit multiplied by the factor109static <Q extends Quantity<Q>>
Unit<Q>HECTO(Unit<Q> unit)Returns the specified unit multiplied by the factor102static <Q extends Quantity<Q>>
Unit<Q>KILO(Unit<Q> unit)Returns the specified unit multiplied by the factor103static <Q extends Quantity<Q>>
Unit<Q>MEGA(Unit<Q> unit)Returns the specified unit multiplied by the factor106static <Q extends Quantity<Q>>
Unit<Q>MICRO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-6static <Q extends Quantity<Q>>
Unit<Q>MILLI(Unit<Q> unit)Returns the specified unit multiplied by the factor10-3static <Q extends Quantity<Q>>
Unit<Q>NANO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-9static <Q extends Quantity<Q>>
Unit<Q>PETA(Unit<Q> unit)Returns the specified unit multiplied by the factor1015static <Q extends Quantity<Q>>
Unit<Q>PICO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-12static <Q extends Quantity<Q>>
Unit<Q>QUECTO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-30static <Q extends Quantity<Q>>
Unit<Q>QUETTA(Unit<Q> unit)Returns the specified unit multiplied by the factor1030static <Q extends Quantity<Q>>
Unit<Q>RONNA(Unit<Q> unit)Returns the specified unit multiplied by the factor1027static <Q extends Quantity<Q>>
Unit<Q>RONTO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-27static <Q extends Quantity<Q>>
Unit<Q>TERA(Unit<Q> unit)Returns the specified unit multiplied by the factor1012static MetricPrefixvalueOf(java.lang.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-24static <Q extends Quantity<Q>>
Unit<Q>YOTTA(Unit<Q> unit)Returns the specified unit multiplied by the factor1024static <Q extends Quantity<Q>>
Unit<Q>ZEPTO(Unit<Q> unit)Returns the specified unit multiplied by the factor10-21static <Q extends Quantity<Q>>
Unit<Q>ZETTA(Unit<Q> unit)Returns the specified unit multiplied by the factor1021
-
-
-
Enum Constant Detail
-
QUETTA
public static final MetricPrefix QUETTA
Prefix for 1030.
-
RONNA
public static final MetricPrefix RONNA
Prefix for 1027.
-
YOTTA
public static final MetricPrefix YOTTA
Prefix for 1024.
-
ZETTA
public static final MetricPrefix ZETTA
Prefix for 1021.
-
EXA
public static final MetricPrefix EXA
Prefix for 1018.
-
PETA
public static final MetricPrefix PETA
Prefix for 1015.
-
TERA
public static final MetricPrefix TERA
Prefix for 1012.
-
GIGA
public static final MetricPrefix GIGA
Prefix for 109.- See Also:
- Wikipedia: Giga
-
MEGA
public static final MetricPrefix MEGA
Prefix for 106.- See Also:
- Wikipedia: Mega
-
KILO
public static final MetricPrefix KILO
Prefix for 103.- See Also:
- Wikipedia: Kilo
-
HECTO
public static final MetricPrefix HECTO
Prefix for 102.- See Also:
- Wikipedia: Hecto
-
DECA
public static final MetricPrefix DECA
Prefix for 101.- See Also:
- Wikipedia: Deca
-
DECI
public static final MetricPrefix DECI
Prefix for 10-1.- See Also:
- Wikipedia: Deci
-
CENTI
public static final MetricPrefix CENTI
Prefix for 10-2.- See Also:
- Wikipedia: Centi
-
MILLI
public static final MetricPrefix MILLI
Prefix for 10-3.- See Also:
- Wikipedia: Milli
-
MICRO
public static final MetricPrefix MICRO
Prefix for 10-6.- See Also:
- Wikipedia: Micro
-
NANO
public static final MetricPrefix NANO
Prefix for 10-9.- See Also:
- Wikipedia: Nano
-
PICO
public static final MetricPrefix PICO
Prefix for 10-12.
-
FEMTO
public static final MetricPrefix FEMTO
Prefix for 10-15.
-
ATTO
public static final MetricPrefix ATTO
Prefix for 10-18.
-
ZEPTO
public static final MetricPrefix ZEPTO
Prefix for 10-21.
-
YOCTO
public static final MetricPrefix YOCTO
Prefix for 10-24.
-
RONTO
public static final MetricPrefix RONTO
Prefix for 10-27.
-
QUECTO
public static final MetricPrefix QUECTO
Prefix for 10-30.
-
-
Method Detail
-
values
public static MetricPrefix[] 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 (MetricPrefix c : MetricPrefix.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MetricPrefix valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
QUETTA
public static <Q extends Quantity<Q>> Unit<Q> QUETTA(Unit<Q> unit)
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.times(1e30).- See Also:
QUETTA
-
RONNA
public static <Q extends Quantity<Q>> Unit<Q> RONNA(Unit<Q> unit)
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.times(1e27).- See Also:
RONNA
-
YOTTA
public static <Q extends Quantity<Q>> Unit<Q> YOTTA(Unit<Q> unit)
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).- See Also:
YOTTA
-
ZETTA
public static <Q extends Quantity<Q>> Unit<Q> ZETTA(Unit<Q> unit)
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).- See Also:
ZETTA
-
EXA
public static <Q extends Quantity<Q>> Unit<Q> EXA(Unit<Q> unit)
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).- See Also:
EXA
-
PETA
public static <Q extends Quantity<Q>> Unit<Q> PETA(Unit<Q> unit)
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).- See Also:
PETA
-
TERA
public static <Q extends Quantity<Q>> Unit<Q> TERA(Unit<Q> unit)
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).- See Also:
TERA
-
GIGA
public static <Q extends Quantity<Q>> Unit<Q> GIGA(Unit<Q> unit)
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).- See Also:
GIGA
-
MEGA
public static <Q extends Quantity<Q>> Unit<Q> MEGA(Unit<Q> unit)
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).- See Also:
MEGA
-
KILO
public static <Q extends Quantity<Q>> Unit<Q> KILO(Unit<Q> unit)
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).- See Also:
KILO
-
HECTO
public static <Q extends Quantity<Q>> Unit<Q> HECTO(Unit<Q> unit)
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).- See Also:
HECTO
-
DECA
public static <Q extends Quantity<Q>> Unit<Q> DECA(Unit<Q> unit)
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).- See Also:
DECA
-
DEKA
public static <Q extends Quantity<Q>> Unit<Q> DEKA(Unit<Q> unit)
US alias forDECA.- Type Parameters:
Q- type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e1).- See Also:
DECA
-
DECI
public static <Q extends Quantity<Q>> Unit<Q> DECI(Unit<Q> unit)
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).- See Also:
DECI
-
CENTI
public static <Q extends Quantity<Q>> Unit<Q> CENTI(Unit<Q> unit)
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).- See Also:
CENTI
-
MILLI
public static <Q extends Quantity<Q>> Unit<Q> MILLI(Unit<Q> unit)
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).- See Also:
MILLI
-
MICRO
public static <Q extends Quantity<Q>> Unit<Q> MICRO(Unit<Q> unit)
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).- See Also:
MICRO
-
NANO
public static <Q extends Quantity<Q>> Unit<Q> NANO(Unit<Q> unit)
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).- See Also:
NANO
-
PICO
public static <Q extends Quantity<Q>> Unit<Q> PICO(Unit<Q> unit)
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).- See Also:
PICO
-
FEMTO
public static <Q extends Quantity<Q>> Unit<Q> FEMTO(Unit<Q> unit)
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).- See Also:
FEMTO
-
ATTO
public static <Q extends Quantity<Q>> Unit<Q> ATTO(Unit<Q> unit)
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).- See Also:
ATTO
-
ZEPTO
public static <Q extends Quantity<Q>> Unit<Q> ZEPTO(Unit<Q> unit)
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). #see ZEPTO
-
YOCTO
public static <Q extends Quantity<Q>> Unit<Q> YOCTO(Unit<Q> unit)
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).- See Also:
YOCTO
-
RONTO
public static <Q extends Quantity<Q>> Unit<Q> RONTO(Unit<Q> unit)
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.times(1e-27).- See Also:
RONTO
-
QUECTO
public static <Q extends Quantity<Q>> Unit<Q> QUECTO(Unit<Q> unit)
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.times(1e-30).- See Also:
QUECTO
-
getSymbol
public java.lang.String getSymbol()
Returns the symbol of this prefix.
-
getValue
public java.lang.Integer getValue()
Base part of the associated factor inbase^exponentrepresentation. For metric prefix, this is always 10.
-
getExponent
public int getExponent()
Exponent part of the associated factor inbase^exponentrepresentation.- Specified by:
getExponentin interfacePrefix- Returns:
- the exponent part of this prefix.
-
-