Deprecated
as a consequence of DecimalQuantity being deprecated. See corresponding docs for further information.
| Modifier and Type | Field and Description |
|---|---|
| private static final double[] | |
| public boolean | explicitExactDouble
Whether this |
| protected int | exponent
The value of the (suppressed) exponent after the number has been put into a notation with exponents (ex: compact, scientific). |
| protected byte | flags
A bitmask of properties relating to the number represented by this object. |
| protected static final int | |
| pack-priv static final byte[] | |
| protected boolean | isApproximate
Whether the value in the BCD comes from the double fast path without having been rounded to ensure correctness |
| protected int | |
| protected static final int | |
| protected static final int | |
| protected int | origDelta
The change in magnitude relative to the original double. |
| protected double | origDouble
The original number provided by the user and which is represented in BCD. |
| protected int | precision
The number of digits in the BCD. |
| protected int | |
| protected int | scale
The power of ten corresponding to the least significant digit in the BCD. |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| private void | _setToDoubleFast(double n)
Uses double multiplication and division to get the number into integer space before converting to digits. |
| private void | |
| private void | |
| public void | adjustExponent(int
The value to adjust the exponent by. delta)Implements com. |
| public void | adjustMagnitude(int
The number of magnitudes of ten to change by. delta)Implements com. |
| public void | appendDigit(byte
The digit to append. value, int The number of zeros to append before the digit. For example, if the value in this
instance starts as 12.3, and you append a 4 with 1 leading zero, the value becomes
12.304. leadingZeros, boolean If true, increase the magnitude of existing digits to make room for the new digit. If
false, append to the end like a fraction digit. If true, there must not be any fraction
digits already in the number. appendAsInteger)
Deprecated
This API is ICU internal only.
Appends a digit, optionally with one or more leading zeros, to the end of the value represented by
this DecimalQuantity.
|
| public void | applyMaxInteger(int
The maximum number of integer digits. maxInt)Implements com. |
| protected abstract BigDecimal | Returns: A BigDecimal representation of the internal BCD.Returns a BigDecimal encoding the internal BCD value. |
| public DecimalQuantity_AbstractBCD | |
| protected abstract void | compact()
Removes trailing zeros from the BCD (adjusting the scale as required) and then computes the precision. |
| private void | convertToAccurateDouble()
Uses Double.toString() to obtain an exact accurate representation of the double, overwriting it into the BCD. |
| protected abstract void | copyBcdFrom(DecimalQuantity _other)
Deprecated
as a consequence of
DecimalQuantity being deprecated.
|
| public void | copyFrom(DecimalQuantity
The instance to copy from. _other)Implements com.
Deprecated
as a consequence of
Sets this instance to be equal to another instance.
DecimalQuantity being deprecated.
|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides java. |
| public boolean | fitsInLong()
Returns whether or not a Long can fully represent the value stored in this DecimalQuantity. |
| private int | |
| private int | |
| public byte | getDigit(int
The magnitude of the digit. magnitude)Implements com. |
| protected abstract byte | Returns: The digit at the specified location.The position of the digit to pop, counted in BCD units from the least significant
digit. If outside the range supported by the implementation, zero is returned. position)Returns a single digit from the BCD list. |
| public int | |
| public int | getLowerDisplayMagnitude()
Implements com. |
| public int | |
| public double | getPluralOperand(PluralRules.
Implements com.
Deprecated
as a consequence of
Returns the value corresponding to the specified operand (n, i, f, t, v, or w).
PluralRules.Operand being deprecated.
|
| public long | getPositionFingerprint()
Implements com. |
| public StandardPlural | getStandardPlural(PluralRules
A rules)PluralRules object representing the set of rules.Implements com. |
| public int | getUpperDisplayMagnitude()
Implements com. |
| public boolean | isHasIntegerValue()
Implements com. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | |
| public void | multiplyBy(BigDecimal
The value by which to multiply. multiplicand)Implements com. |
| public void | negate()
Implements com. |
| protected abstract void | |
| public void | populateUFieldPosition(FieldPosition
The fp)UFieldPosition to populate.Implements com. FieldPosition is a UFieldPosition, populates it with the fraction
length and fraction long value.
|
| protected abstract void | readBigIntegerToBcd(BigInteger
The value to consume. input)Sets the internal BCD state to represent the value in the given BigInteger. |
| protected abstract void | readIntToBcd(int
The value to consume. input)Sets the internal BCD state to represent the value in the given int. |
| protected abstract void | readLongToBcd(long
The value to consume. input)Sets the internal BCD state to represent the value in the given long. |
| public void | resetExponent()
Implements com. |
| public void | roundToIncrement(BigDecimal
The increment to which to round. roundingIncrement, MathContext The mathContext)MathContext to use if rounding is necessary. Undefined behavior if null.Implements com. |
| public void | roundToInfinity()
Implements com. |
| public void | roundToMagnitude(int
The power of ten to which to round. For example, a value of -2 will round to 2 decimal
places. magnitude, MathContext The mathContext)MathContext to use if rounding is necessary. Undefined behavior if null.Implements com. |
| private void | |
| public void | roundToNickel(int
The magnitude at which the digit should become either 0 or 5. magnitude, MathContext Rounding strategy. mathContext)Implements com. |
| private static int | |
| protected abstract void | |
| protected abstract void | setDigitPos(int
The position of the digit to pop, counted in BCD units from the least significant
digit. If outside the range supported by the implementation, an AssertionError is
thrown. position, byte The digit to set at the specified location. value)Sets the digit in the BCD list. |
| public void | setMinFraction(int
The minimum number of fraction digits. minFrac)Implements com. DecimalQuantity should generate.
|
| public void | setMinInteger(int
The minimum number of integer digits. minInt)Implements com. DecimalQuantity should generate.
|
| public void | setToBigDecimal(BigDecimal
The value to consume. n)Implements com. |
| public void | |
| public void | setToDouble(double
The value to consume. n)Sets the internal BCD state to represent the value in the given double. |
| public void | |
| public void | |
| protected abstract void | |
| protected abstract void | shiftRight(int
The number of digits to remove. numDigits)Removes digits from the end of the BCD list. |
| public Modifier. | |
| public BigDecimal | |
| public double | Returns: A double representation of the internal BCD.Implements com. |
| public String | toExponentString()
Implements com. |
| private void | |
| public long | toFractionLong(boolean includeTrailingZeros)
This returns a long representing the fraction digits of the number, as required by PluralRules. |
| public long | toLong(boolean
if false and the number does NOT fit, fails with an error.
See comment about call site guards in DecimalQuantity_AbstractBCD.java truncateIfOverflow)Implements com. |
| public String | toPlainString()
Implements com. |
| public void | |
| public String | |
| public void | |
| public void |
| DOUBLE_MULTIPLIERS | back to summary |
|---|---|
| private static final double[] DOUBLE_MULTIPLIERS | |
| explicitExactDouble | back to summary |
|---|---|
| public boolean explicitExactDouble
Deprecated This API is ICU internal only. Whether this
| |
| exponent | back to summary |
|---|---|
| protected int exponent The value of the (suppressed) exponent after the number has been put into a notation with exponents (ex: compact, scientific). | |
| flags | back to summary |
|---|---|
| protected byte flags A bitmask of properties relating to the number represented by this object.
| |
| INFINITY_FLAG | back to summary |
|---|---|
| protected static final int INFINITY_FLAG | |
| INT64_BCD | back to summary |
|---|---|
| pack-priv static final byte[] INT64_BCD | |
| isApproximate | back to summary |
|---|---|
| protected boolean isApproximate Whether the value in the BCD comes from the double fast path without having been rounded to ensure correctness | |
| lReqPos | back to summary |
|---|---|
| protected int lReqPos | |
| NAN_FLAG | back to summary |
|---|---|
| protected static final int NAN_FLAG | |
| NEGATIVE_FLAG | back to summary |
|---|---|
| protected static final int NEGATIVE_FLAG | |
| origDelta | back to summary |
|---|---|
| protected int origDelta The change in magnitude relative to the original double. Used when we need to re-compute the BCD for an exact double representation. | |
| origDouble | back to summary |
|---|---|
| protected double origDouble The original number provided by the user and which is represented in BCD. Used when we need to re-compute the BCD for an exact double representation. | |
| precision | back to summary |
|---|---|
| protected int precision The number of digits in the BCD. For example, "1007" has BCD "0x1007" and precision 4. A long cannot represent precisions greater than 16.
This value must be re-calculated whenever the value in bcd changes by using
| |
| rReqPos | back to summary |
|---|---|
| protected int rReqPos | |
| scale | back to summary |
|---|---|
| protected int scale The power of ten corresponding to the least significant digit in the BCD. For example, if this object represents the number "3.14", the BCD will be "0x314" and the scale will be -2.
Note that in | |
| SECTION_LOWER_EDGE | back to summary |
|---|---|
| private static final int SECTION_LOWER_EDGE | |
| SECTION_UPPER_EDGE | back to summary |
|---|---|
| private static final int SECTION_UPPER_EDGE | |
| DecimalQuantity_AbstractBCD | back to summary |
|---|---|
| public DecimalQuantity_AbstractBCD() | |
| _setToBigDecimal | back to summary |
|---|---|
| private void _setToBigDecimal(BigDecimal n) | |
| _setToBigInteger | back to summary |
|---|---|
| private void _setToBigInteger(BigInteger n) | |
| _setToDoubleFast | back to summary |
|---|---|
| private void _setToDoubleFast(double n) Uses double multiplication and division to get the number into integer space before converting to digits. Since double arithmetic is inexact, the resulting digits may not be accurate. | |
| _setToInt | back to summary |
|---|---|
| private void _setToInt(int n) | |
| _setToLong | back to summary |
|---|---|
| private void _setToLong(long n) | |
| adjustExponent | back to summary |
|---|---|
| public void adjustExponent(int delta) Implements com. Doc from com. 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) Implements com. Doc from com. 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".
| |
| appendDigit | back to summary |
|---|---|
| public void appendDigit(byte value, int leadingZeros, boolean appendAsInteger)
Deprecated This API is ICU internal only. Appends a digit, optionally with one or more leading zeros, to the end of the value represented by this DecimalQuantity. The primary use of this method is to construct numbers during a parsing loop. It allows parsing to take advantage of the digit list infrastructure primarily designed for formatting.
| |
| applyMaxInteger | back to summary |
|---|---|
| public void applyMaxInteger(int maxInt) Implements com. Doc from com. Truncates digits from the upper magnitude of the number in order to satisfy the specified maximum number of integer digits.
| |
| bcdToBigDecimal | back to summary |
|---|---|
| protected abstract BigDecimal bcdToBigDecimal() Returns a BigDecimal encoding the internal BCD value.
| |
| clear | back to summary |
|---|---|
| public DecimalQuantity_AbstractBCD clear()
Deprecated as a consequence of | |
| compact | back to summary |
|---|---|
| protected abstract void compact() Removes trailing zeros from the BCD (adjusting the scale as required) and then computes the precision. The precision is the number of digits in the number up through the greatest nonzero digit.
This method must always be called when bcd changes in order for assumptions to be correct in
methods like | |
| convertToAccurateDouble | back to summary |
|---|---|
| private void convertToAccurateDouble() Uses Double.toString() to obtain an exact accurate representation of the double, overwriting it
into the BCD. This method can be called at any point after | |
| copyBcdFrom | back to summary |
|---|---|
| protected abstract void copyBcdFrom(DecimalQuantity _other)
Deprecated as a consequence of | |
| copyFrom | back to summary |
|---|---|
| public void copyFrom(DecimalQuantity _other) Implements com. Doc from com. Deprecated as a consequence of Sets this instance to be equal to another instance.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| fitsInLong | back to summary |
|---|---|
| public boolean fitsInLong() Returns whether or not a Long can fully represent the value stored in this DecimalQuantity. | |
| fractionCount | back to summary |
|---|---|
| private int fractionCount() | |
| fractionCountWithoutTrailingZeros | back to summary |
|---|---|
| private int fractionCountWithoutTrailingZeros() | |
| getDigit | back to summary |
|---|---|
| public byte getDigit(int magnitude) Implements com. Doc from com. 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.
| |
| getDigitPos | back to summary |
|---|---|
| protected abstract byte getDigitPos(int position) Returns a single digit from the BCD list. No internal state is changed by calling this method.
| |
| getExponent | back to summary |
|---|---|
| public int getExponent() Implements com.
| |
| getLowerDisplayMagnitude | back to summary |
|---|---|
| public int getLowerDisplayMagnitude() Implements com. Doc from com. 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 Implements com.
| |
| getPluralOperand | back to summary |
|---|---|
| public double getPluralOperand(PluralRules. Implements com. Doc from com. Deprecated as a consequence of Returns the value corresponding to the specified operand (n, i, f, t, v, or w). If the operand is 'n', returns a double; otherwise, returns an integer.
| |
| getPositionFingerprint | back to summary |
|---|---|
| public long getPositionFingerprint() Implements com. Doc from com. This method is for internal testing only.
| |
| getStandardPlural | back to summary |
|---|---|
| public StandardPlural getStandardPlural(PluralRules rules) Implements com. Doc from com. Computes the plural form for this number based on the specified set of rules.
| |
| getUpperDisplayMagnitude | back to summary |
|---|---|
| public int getUpperDisplayMagnitude() Implements com. Doc from com. Gets the largest power of ten that needs to be displayed. The value returned by this function will be bounded between minInt and maxInt.
| |
| isHasIntegerValue | back to summary |
|---|---|
| public boolean isHasIntegerValue() Implements com. Doc from com. Whether the number has no nonzero fraction digits.
| |
| isInfinite | back to summary |
|---|---|
| public boolean isInfinite() Implements com.
| |
| isNaN | back to summary |
|---|---|
| public boolean isNaN() Implements com.
| |
| isNegative | back to summary |
|---|---|
| public boolean isNegative() Implements com.
| |
| isZeroish | back to summary |
|---|---|
| public boolean isZeroish() Implements com.
| |
| multiplyBy | back to summary |
|---|---|
| public void multiplyBy(BigDecimal multiplicand) Implements com. Doc from com. Multiply the internal value.
| |
| negate | back to summary |
|---|---|
| public void negate() Implements com. Doc from com. Flips the sign from positive to negative and back.
| |
| popFromLeft | back to summary |
|---|---|
| protected abstract void popFromLeft(int numDigits) Directly removes digits from the front of the BCD list. Updates precision. Caution it is the caller's responsibility to call | |
| populateUFieldPosition | back to summary |
|---|---|
| public void populateUFieldPosition(FieldPosition fp) Implements com. Doc from com. If the given
| |
| readBigIntegerToBcd | back to summary |
|---|---|
| protected abstract void readBigIntegerToBcd(BigInteger input) Sets the internal BCD state to represent the value in the given BigInteger. The BigInteger is guaranteed to be positive, and it is guaranteed to be larger than Long.MAX_VALUE. The internal state is guaranteed to be empty when this method is called.
| |
| readIntToBcd | back to summary |
|---|---|
| protected abstract void readIntToBcd(int input) Sets the internal BCD state to represent the value in the given int. The int is guaranteed to be either positive. The internal state is guaranteed to be empty when this method is called.
| |
| readLongToBcd | back to summary |
|---|---|
| protected abstract void readLongToBcd(long input) Sets the internal BCD state to represent the value in the given long. The long is guaranteed to be either positive. The internal state is guaranteed to be empty when this method is called.
| |
| resetExponent | back to summary |
|---|---|
| public void resetExponent() Implements com. Doc from com. Resets the DecimalQuantity to the value before adjustMagnitude and adjustExponent.
| |
| roundToIncrement | back to summary |
|---|---|
| public void roundToIncrement(BigDecimal roundingIncrement, MathContext mathContext) Implements com. Doc from com. 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() Implements com. Doc from com. 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 magnitude, MathContext mathContext) Implements com. Doc from com. Rounds the number to a specified magnitude (power of ten).
| |
| roundToMagnitude | back to summary |
|---|---|
| private void roundToMagnitude(int magnitude, MathContext mathContext, boolean nickel) | |
| roundToNickel | back to summary |
|---|---|
| public void roundToNickel(int magnitude, MathContext mathContext) Implements com. Doc from com. 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.
| |
| safeSubtract | back to summary |
|---|---|
| private static int safeSubtract(int a, int b) | |
| setBcdToZero | back to summary |
|---|---|
| protected abstract void setBcdToZero() Sets the internal representation to zero. Clears any values stored in scale, precision, hasDouble, origDouble, origDelta, exponent, and BCD data. | |
| setDigitPos | back to summary |
|---|---|
| protected abstract void setDigitPos(int position, byte value) Sets the digit in the BCD list. This method only sets the digit; it is the caller's
responsibility to call
| |
| setMinFraction | back to summary |
|---|---|
| public void setMinFraction(int minFrac) Implements com. Doc from com. Sets the minimum fraction digits that this
| |
| setMinInteger | back to summary |
|---|---|
| public void setMinInteger(int minInt) Implements com. Doc from com. Sets the minimum integer digits that this
| |
| setToBigDecimal | back to summary |
|---|---|
| public void setToBigDecimal(BigDecimal n) Implements com. Sets the internal BCD state to represent the value in the given BigDecimal.
| |
| setToBigInteger | back to summary |
|---|---|
| public void setToBigInteger(BigInteger n) | |
| setToDouble | back to summary |
|---|---|
| public void setToDouble(double n) Sets the internal BCD state to represent the value in the given double.
| |
| setToInt | back to summary |
|---|---|
| public void setToInt(int n) | |
| setToLong | back to summary |
|---|---|
| public void setToLong(long n) | |
| shiftLeft | back to summary |
|---|---|
| protected abstract void shiftLeft(int numDigits) Adds zeros to the end of the BCD list. This will result in an invalid BCD representation; it is
the caller's responsibility to do further manipulation and then call
| |
| shiftRight | back to summary |
|---|---|
| protected abstract void shiftRight(int numDigits) Removes digits from the end of the BCD list. This may result in an invalid BCD representation; it
is the caller's responsibility to follow-up with a call to
| |
| signum | back to summary |
|---|---|
| public Modifier. Implements com.
| |
| toBigDecimal | back to summary |
|---|---|
| public BigDecimal toBigDecimal() Implements com.
| |
| toDouble | back to summary |
|---|---|
| public double toDouble() Implements com. Returns a double approximating the internal BCD. The double may not retain all of the information encoded in the BCD if the BCD represents a number out of range of a double.
| |
| toExponentString | back to summary |
|---|---|
| public String toExponentString() Implements com. Doc from com. Returns the string using ASCII digits and using exponential notation for non-zero exponents, following the UTS 35 specification for plural rule samples.
| |
| toExponentString | back to summary |
|---|---|
| private void toExponentString(StringBuilder result) | |
| toFractionLong | back to summary |
|---|---|
| public long toFractionLong(boolean includeTrailingZeros) This returns a long representing the fraction digits of the number, as required by PluralRules. For example, if we represent the number "1.20" (including optional and required digits), then this function returns "20" if includeTrailingZeros is true or "2" if false. Note this method incorporates the value of | |
| toLong | back to summary |
|---|---|
| public long toLong(boolean truncateIfOverflow) Implements com. Doc from com. 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() Implements com. Doc from com. Returns the string in "plain" format (no exponential notation) using ASCII digits.
| |
| toPlainString | back to summary |
|---|---|
| public void toPlainString(StringBuilder result) | |
| toScientificString | back to summary |
|---|---|
| public String toScientificString() | |
| toScientificString | back to summary |
|---|---|
| public void toScientificString(StringBuilder result) | |
| truncate | back to summary |
|---|---|
| public void truncate() Removes all fraction digits. | |