Package javax.measure
Enum Class BinaryPrefix
- All Implemented Interfaces:
Serializable,Comparable<BinaryPrefix>,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
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final intExponent part of the associated factor in base^exponent representation.private final StringThe symbol of this prefix, as returned bygetSymbol(). -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBinaryPrefix(String symbol, int exponent) Creates a new prefix. -
Method Summary
Modifier and TypeMethodDescriptionReturns the specified unit multiplied by the factor10246(binary prefix).intExponent part of the associated factor inbase^exponentrepresentation.getName()Returns the name of this prefix.Returns the symbol of this prefix.getValue()Base part of the associated factor inbase^exponentrepresentation.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 BinaryPrefixReturns the enum constant of this class with the specified name.static BinaryPrefix[]values()Returns an array containing the constants of this enum class, 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.
-
-
Field Details
-
symbol
The symbol of this prefix, as returned bygetSymbol().- See Also:
-
exponent
private final int exponentExponent part of the associated factor in base^exponent representation.
-
-
Constructor Details
-
BinaryPrefix
Creates a new prefix.- Parameters:
symbol- the symbol of this prefix.exponent- part of the associated factor in base^exponent representation.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class 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^exponentrepresentation. For binary prefix, this is always 1024. -
getExponent
public int getExponent()Exponent part of the associated factor inbase^exponentrepresentation.- Specified by:
getExponentin interfacePrefix- Returns:
- the exponent part of this prefix.
-
getName
Returns the name of this prefix.
-