Package com.ibm.icu.number
Class ScientificNotation
- java.lang.Object
-
- com.ibm.icu.number.Notation
-
- com.ibm.icu.number.ScientificNotation
-
public class ScientificNotation extends Notation
A class that defines the scientific notation style to be used when formatting numbers in NumberFormatter.To create a ScientificNotation, use one of the factory methods in
Notation
.- See Also:
NumberFormatter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ScientificNotation.ScientificHandler
private static class
ScientificNotation.ScientificModifier
-
Field Summary
Fields Modifier and Type Field Description (package private) int
engineeringInterval
(package private) NumberFormatter.SignDisplay
exponentSignDisplay
(package private) int
minExponentDigits
(package private) boolean
requireMinInt
-
Constructor Summary
Constructors Constructor Description ScientificNotation(int engineeringInterval, boolean requireMinInt, int minExponentDigits, NumberFormatter.SignDisplay exponentSignDisplay)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) ScientificNotation
createCopy()
Package-private clone methodScientificNotation
withExponentSignDisplay(NumberFormatter.SignDisplay exponentSignDisplay)
Sets whether to show the sign on positive and negative exponents in scientific notation.(package private) MicroPropsGenerator
withLocaleData(DecimalFormatSymbols symbols, boolean build, MicroPropsGenerator parent)
ScientificNotation
withMinExponentDigits(int minExponentDigits)
Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary.-
Methods inherited from class com.ibm.icu.number.Notation
compactLong, compactShort, engineering, scientific, simple
-
-
-
-
Field Detail
-
engineeringInterval
int engineeringInterval
-
requireMinInt
boolean requireMinInt
-
minExponentDigits
int minExponentDigits
-
exponentSignDisplay
NumberFormatter.SignDisplay exponentSignDisplay
-
-
Constructor Detail
-
ScientificNotation
ScientificNotation(int engineeringInterval, boolean requireMinInt, int minExponentDigits, NumberFormatter.SignDisplay exponentSignDisplay)
-
-
Method Detail
-
withMinExponentDigits
public ScientificNotation withMinExponentDigits(int minExponentDigits)
Sets the minimum number of digits to show in the exponent of scientific notation, padding with zeros if necessary. Useful for fixed-width display.For example, with minExponentDigits=2, the number 123 will be printed as "1.23E02" in en-US instead of the default "1.23E2".
- Parameters:
minExponentDigits
- The minimum number of digits to show in the exponent.- Returns:
- A ScientificNotation, for chaining.
- Throws:
java.lang.IllegalArgumentException
- if minExponentDigits is too big or smaller than 1- See Also:
NumberFormatter
-
withExponentSignDisplay
public ScientificNotation withExponentSignDisplay(NumberFormatter.SignDisplay exponentSignDisplay)
Sets whether to show the sign on positive and negative exponents in scientific notation. The default is AUTO, showing the minus sign but not the plus sign.For example, with exponentSignDisplay=ALWAYS, the number 123 will be printed as "1.23E+2" in en-US instead of the default "1.23E2".
- Parameters:
exponentSignDisplay
- The strategy for displaying the sign in the exponent.- Returns:
- A ScientificNotation, for chaining.
- See Also:
NumberFormatter
-
createCopy
ScientificNotation createCopy()
Package-private clone method
-
withLocaleData
MicroPropsGenerator withLocaleData(DecimalFormatSymbols symbols, boolean build, MicroPropsGenerator parent)
-
-