Deprecated
as a consequence of PluralRules.IFixedDecimal being deprecated. See corresponding docs for further information.
By design, this is NOT IMMUTABLE and NOT THREAD SAFE. It is intended to be an intermediate object holding state during a pass through the decimal formatting pipeline.
Implementations of this interface are free to use any internal storage mechanism.
Todo
Should I change this to an abstract class so that logic for min/max digits doesn't need to be copied to every implementation?
| Modifier and Type | Method and Description |
|---|---|
| public void | adjustExponent(int
The value to adjust the exponent by. delta)Adjusts the value for the (suppressed) exponent stored when using notation with exponents (ex: compact, scientific). |
| public void | adjustMagnitude(int
The number of magnitudes of ten to change by. delta)Scales the number by a power of ten. |
| public void | applyMaxInteger(int
The maximum number of integer digits. maxInt)Truncates digits from the upper magnitude of the number in order to satisfy the specified maximum number of integer digits. |
| public void | copyFrom(DecimalQuantity
The instance to copy from. other)
Deprecated
as a consequence of
Sets this instance to be equal to another instance.
DecimalQuantity being deprecated.
|
| public DecimalQuantity | Returns: A copy of this instance which can be mutated without affecting this instance.
Deprecated
as a consequence of
Like clone, but without the restrictions of the Cloneable interface clone.
DecimalQuantity being deprecated.
|
| public byte | Returns: The digit at the specified magnitude.The magnitude of the digit. magnitude)Gets the digit at the specified magnitude. |
| public int | Returns: The value of the (suppressed) exponent after the number has been put into a notation with exponents (ex: compact, scientific). Ex: given the number 1000 as "1K" / "1E3", the return value will be 3 (positive).
|
| public int | Returns: The lowest-magnitude digit to be displayed.Gets the smallest power of ten that needs to be displayed. |
| public int | |
| public long | |
| public StandardPlural | Returns: TheStandardPlural according to the PluralRules. If the plural form is not in the
set of standard plurals, StandardPlural#OTHER is returned instead.A rules)PluralRules object representing the set of rules.Computes the plural form for this number based on the specified set of rules. |
| public int | Returns: The highest-magnitude digit to be displayed.Gets the largest power of ten that needs to be displayed. |
| public boolean | Returns: Whether the value represented by thisDecimalQuantity is infinite.Redeclares com. |
| public boolean | Returns: Whether the value represented by thisDecimalQuantity is not a number.Redeclares com. |
| public boolean | |
| public boolean | Returns: Whether the value represented by thisDecimalQuantity is
zero, infinity, or NaN.
|
| public int | |
| public void | |
| public void | |
| public void | populateUFieldPosition(FieldPosition
The fp)UFieldPosition to populate.If the given |
| public void | |
| public void | roundToIncrement(BigDecimal
The increment to which to round. roundingInterval, MathContext The mathContext)MathContext to use if rounding is necessary. Undefined behavior if null.Rounds the number to a specified interval, such as 0.05. |
| public void | |
| public void | roundToMagnitude(int
The power of ten to which to round. For example, a value of -2 will round to 2 decimal
places. roundingMagnitude, MathContext The mathContext)MathContext to use if rounding is necessary. Undefined behavior if null.Rounds the number to a specified magnitude (power of ten). |
| public void | roundToNickel(int
The magnitude at which the digit should become either 0 or 5. magnitude, MathContext Rounding strategy. mathContext)Rounds the number to the nearest multiple of 5 at the specified magnitude. |
| public void | setMinFraction(int
The minimum number of fraction digits. minFrac)Sets the minimum fraction digits that this |
| public void | setMinInteger(int
The minimum number of integer digits. minInt)Sets the minimum integer digits that this |
| public void | |
| public Modifier. | |
| public BigDecimal | |
| public double | |
| public String | toExponentString()
Returns the string using ASCII digits and using exponential notation for non-zero exponents, following the UTS 35 specification for plural rule samples. |
| public long | Returns: A 64-bit integer representation of the internal number.if false and the number does NOT fit, fails with an error.
See comment about call site guards in DecimalQuantity_AbstractBCD.java truncateIfOverflow)Returns a long approximating the decimal quantity. |
| public String |
| adjustExponent | back to summary |
|---|---|
| public void adjustExponent(int delta) Adjusts the value for the (suppressed) exponent stored when using notation with exponents (ex: compact, scientific). Adjusting the exponent is decoupled from
| |
| adjustMagnitude | back to summary |
|---|---|
| public void adjustMagnitude(int delta) Scales the number by a power of ten. For example, if the value is currently "1234.56", calling this method with delta=-3 will change the value to "1.23456".
| |
| applyMaxInteger | back to summary |
|---|---|
| public void applyMaxInteger(int maxInt) Truncates digits from the upper magnitude of the number in order to satisfy the specified maximum number of integer digits.
| |
| copyFrom | back to summary |
|---|---|
| public void copyFrom(DecimalQuantity other)
Deprecated as a consequence of Sets this instance to be equal to another instance.
| |
| createCopy | back to summary |
|---|---|
| public DecimalQuantity createCopy()
Deprecated as a consequence of Like clone, but without the restrictions of the Cloneable interface clone.
| |
| getDigit | back to summary |
|---|---|
| public byte getDigit(int magnitude) Gets the digit at the specified magnitude. For example, if the represented number is 12.3, getDigit(-1) returns 3, since 3 is the digit corresponding to 10^-1.
| |
| getExponent | back to summary |
|---|---|
public int getExponent()
| |
| getLowerDisplayMagnitude | back to summary |
|---|---|
| public int getLowerDisplayMagnitude() Gets the smallest power of ten that needs to be displayed. The value returned by this function will be bounded between -minFrac and -maxFrac.
| |
| getMagnitude | back to summary |
|---|---|
public int getMagnitude() throws ArithmeticException
| |
| getPositionFingerprint | back to summary |
|---|---|
| public long getPositionFingerprint() This method is for internal testing only. | |
| getStandardPlural | back to summary |
|---|---|
| public StandardPlural getStandardPlural(PluralRules rules) Computes the plural form for this number based on the specified set of rules.
| |
| getUpperDisplayMagnitude | back to summary |
|---|---|
| public int getUpperDisplayMagnitude() Gets the largest power of ten that needs to be displayed. The value returned by this function will be bounded between minInt and maxInt.
| |
| isInfinite | back to summary |
|---|---|
| public boolean isInfinite() Redeclares com.
| |
| isNaN | back to summary |
|---|---|
| public boolean isNaN() Redeclares com.
| |
| isNegative | back to summary |
|---|---|
public boolean isNegative()
| |
| isZeroish | back to summary |
|---|---|
public boolean isZeroish()
| |
| maxRepresentableDigits | back to summary |
|---|---|
| public int maxRepresentableDigits() | |
| multiplyBy | back to summary |
|---|---|
| public void multiplyBy(BigDecimal multiplicand) Multiply the internal value.
| |
| negate | back to summary |
|---|---|
| public void negate() Flips the sign from positive to negative and back. | |
| populateUFieldPosition | back to summary |
|---|---|
| public void populateUFieldPosition(FieldPosition fp) If the given
| |
| resetExponent | back to summary |
|---|---|
| public void resetExponent() Resets the DecimalQuantity to the value before adjustMagnitude and adjustExponent. | |
| roundToIncrement | back to summary |
|---|---|
| public void roundToIncrement(BigDecimal roundingInterval, MathContext mathContext) Rounds the number to a specified interval, such as 0.05.
If rounding to a power of ten, use the more efficient
| |
| roundToInfinity | back to summary |
|---|---|
| public void roundToInfinity() Rounds the number to an infinite number of decimal points. This has no effect except for forcing
the double in | |
| roundToMagnitude | back to summary |
|---|---|
| public void roundToMagnitude(int roundingMagnitude, MathContext mathContext) Rounds the number to a specified magnitude (power of ten).
| |
| roundToNickel | back to summary |
|---|---|
| public void roundToNickel(int magnitude, MathContext mathContext) Rounds the number to the nearest multiple of 5 at the specified magnitude. For example, when magnitude == -2, this performs rounding to the nearest 0.05.
| |
| setMinFraction | back to summary |
|---|---|
| public void setMinFraction(int minFrac) Sets the minimum fraction digits that this
| |
| setMinInteger | back to summary |
|---|---|
| public void setMinInteger(int minInt) Sets the minimum integer digits that this
| |
| setToBigDecimal | back to summary |
|---|---|
| public void setToBigDecimal(BigDecimal input) | |
| signum | back to summary |
|---|---|
| public Modifier. | |
| toBigDecimal | back to summary |
|---|---|
| public BigDecimal toBigDecimal() | |
| toDouble | back to summary |
|---|---|
public double toDouble()
| |
| toExponentString | back to summary |
|---|---|
| public String toExponentString() Returns the string using ASCII digits and using exponential notation for non-zero exponents, following the UTS 35 specification for plural rule samples. | |
| toLong | back to summary |
|---|---|
| public long toLong(boolean truncateIfOverflow) Returns a long approximating the decimal quantity. A long can only represent the integral part of the number. Note this method incorporates the value of
| |
| toPlainString | back to summary |
|---|---|
| public String toPlainString() Returns the string in "plain" format (no exponential notation) using ASCII digits. | |