Package javax.measure
Enum BinaryPrefix
- All Implemented Interfaces:
Serializable
,Comparable<BinaryPrefix>
,java.lang.constant.Constable
,Prefix
Provides support for common binary prefixes to be used by units. For example:
import static systems.uom.unicode.CLDR.*; // Static import (from Unicode System).
import static javax.measure.BinaryPrefix.*; // Static import.
import javax.measure.*;
import systems.uom.quantity.Information; // (from Systems Quantities)
...
Unit<Information> MEBIT = MEBI(BIT);
Unit<Information> GIBYTE = GIBI(BYTE);
You could also apply Unit.prefix
:
...
Unit<Information> MEBIT = BIT.prefix(MEBI);
Unit<Information> GIBYTE = BYTE.prefix(GIBI);
Do not use ordinal() to obtain the numeric representation of BinaryPrefix. Use getValue() and getExponent() instead.
- Implementation Requirements
- This is an immutable and thread-safe enum.
- Since:
- 2.0
- Version:
- 2.2, May 20, 2023
- Author:
- Werner Keil
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns the specified unit multiplied by the factor10246
(binary prefix).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 factor10243
(binary prefix).Returns the specified unit multiplied by the factor1024
(binary prefix).Returns the specified unit multiplied by the factor10242
(binary prefix).Returns the specified unit multiplied by the factor10245
(binary prefix).Returns the specified unit multiplied by the factor10244
(binary prefix).static BinaryPrefix
Returns the enum constant of this type with the specified name.static BinaryPrefix[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.Returns the specified unit multiplied by the factor10248
(binary prefix).Returns the specified unit multiplied by the factor10247
(binary prefix).
-
Enum Constant Details
-
KIBI
Prefix for 1024. -
MEBI
Prefix for 10242. -
GIBI
Prefix for 10243. -
TEBI
Prefix for 10244. -
PEBI
Prefix for 10245. -
EXBI
Prefix for 10246. -
ZEBI
Prefix for 10247. -
YOBI
Prefix for 10248.
-
-
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
-
KIBI
Returns the specified unit multiplied by the factor1024
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1024)
.
-
MEBI
Returns the specified unit multiplied by the factor10242
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1048576)
.
-
GIBI
Returns the specified unit multiplied by the factor10243
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1073741824)
.
-
TEBI
Returns the specified unit multiplied by the factor10244
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1099511627776L)
.
-
PEBI
Returns the specified unit multiplied by the factor10245
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1125899906842624L)
.
-
EXBI
Returns the specified unit multiplied by the factor10246
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1152921504606846976L)
.
-
ZEBI
Returns the specified unit multiplied by the factor10247
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1152921504606846976d)
.
-
YOBI
Returns the specified unit multiplied by the factor10248
(binary prefix).- Type Parameters:
Q
- type of the quantity measured by the unit.- Parameters:
unit
- any unit.- Returns:
unit.multiply(1208925819614629174706176d)
.
-
getSymbol
Returns the symbol of this prefix. -
getValue
Base part of the associated factor inbase^exponent
representation. For binary prefix, this is always 1024. -
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.
-