Package tech.units.indriya.unit
Enum MetricPrefix
- All Implemented Interfaces:
Serializable,Comparable<MetricPrefix>,Prefix
This class 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 tech.units.indriya.unit.MetricPrefix.*; // Static import.
import javax.measure.*;
import javax.measure.quantity.*;
...
Unit HECTOPASCAL = HECTO(PASCAL);
Unit KILOMETRE = KILO(METRE);
- Since:
- 2.0
- Version:
- 1.8, 2018-04-20
- See Also:
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intBase part of the associated factor in base^exponent representation.private intExponent part of the associated factor in base^exponent representation.private final StringThe symbol of this prefix, as returned bygetSymbol(). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMetricPrefix(String symbol, int base, int exponent) Creates a new prefix. -
Method Summary
Modifier and TypeMethodDescriptionstatic <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> ATTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-18static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> CENTI(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-2static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> DECI(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-1static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> DEKA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor101static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> EXA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1018static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> FEMTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-15intgetBase()Base part of the associated factor in base^exponent representation.intExponent part of the associated factor in base^exponent representation.Returns the symbol of this prefix.static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> GIGA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor109static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> HECTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor102static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> KILO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor103static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> MEGA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor106static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> MICRO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-6static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> MILLI(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-3static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> NANO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-9static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> PETA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1015static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> PICO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-12static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> TERA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1012static MetricPrefixReturns 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 javax.measure.Quantity<Q>>
javax.measure.Unit<Q> YOCTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-24static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> YOTTA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1024static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> ZEPTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-21static <Q extends javax.measure.Quantity<Q>>
javax.measure.Unit<Q> ZETTA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1021
-
Enum Constant Details
-
YOTTA
-
ZETTA
-
EXA
-
PETA
-
TERA
-
GIGA
-
MEGA
-
KILO
-
HECTO
-
DEKA
-
DECI
-
CENTI
-
MILLI
-
MICRO
-
NANO
-
PICO
-
FEMTO
-
ATTO
-
ZEPTO
-
YOCTO
-
-
Field Details
-
symbol
The symbol of this prefix, as returned bygetSymbol().- See Also:
-
base
private int baseBase part of the associated factor in base^exponent representation. -
exponent
private int exponentExponent part of the associated factor in base^exponent representation.
-
-
Constructor Details
-
MetricPrefix
Creates a new prefix.- Parameters:
symbol- the symbol of this prefix.base- part of the associated factor in base^exponent representation.exponent- part of the associated factor in base^exponent representation.
-
-
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
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> YOTTA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1024- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e24).
-
ZETTA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> ZETTA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1021- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e21).
-
EXA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> EXA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1018- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e18).
-
PETA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> PETA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1015- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e15).
-
TERA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> TERA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor1012- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e12).
-
GIGA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> GIGA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor109- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e9).
-
MEGA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> MEGA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor106- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e6).
-
KILO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> KILO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor103- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e3).
-
HECTO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> HECTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor102- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e2).
-
DEKA
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> DEKA(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor101- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e1).
-
DECI
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> DECI(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-1- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-1).
-
CENTI
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> CENTI(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-2- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-2).
-
MILLI
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> MILLI(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-3- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-3).
-
MICRO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> MICRO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-6- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-6).
-
NANO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> NANO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-9- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-9).
-
PICO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> PICO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-12- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-12).
-
FEMTO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> FEMTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-15- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-15).
-
ATTO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> ATTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-18- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-18).
-
ZEPTO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> ZEPTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-21- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-21).
-
YOCTO
public static <Q extends javax.measure.Quantity<Q>> javax.measure.Unit<Q> YOCTO(javax.measure.Unit<Q> unit) Returns the specified unit multiplied by the factor10-24- Type Parameters:
Q- The type of the quantity measured by the unit.- Parameters:
unit- any unit.- Returns:
unit.times(1e-24).
-
getSymbol
Returns the symbol of this prefix. -
getBase
public int getBase()Base part of the associated factor in base^exponent representation. -
getExponent
public int getExponent()Exponent part of the associated factor in base^exponent representation.- Specified by:
getExponentin interfacePrefix
-