Search in sources :

Example 1 with CurrencyDigits

use of android.icu.text.CurrencyMetaInfo.CurrencyDigits in project j2objc by google.

the class Currency method getDefaultFractionDigits.

/**
 * Returns the number of the number of fraction digits that should
 * be displayed for this currency with Usage.
 * @param Usage the usage of currency(Standard or Cash)
 * @return a non-negative number of fraction digits to be
 * displayed
 */
public int getDefaultFractionDigits(CurrencyUsage Usage) {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    CurrencyDigits digits = info.currencyDigits(subType, Usage);
    return digits.fractionDigits;
}
Also used : CurrencyMetaInfo(android.icu.text.CurrencyMetaInfo) CurrencyDigits(android.icu.text.CurrencyMetaInfo.CurrencyDigits)

Example 2 with CurrencyDigits

use of android.icu.text.CurrencyMetaInfo.CurrencyDigits in project j2objc by google.

the class Currency method getRoundingIncrement.

/**
 * Returns the rounding increment for this currency, or 0.0 if no
 * rounding is done by this currency with the Usage.
 * @param Usage the usage of currency(Standard or Cash)
 * @return the non-negative rounding increment, or 0.0 if none
 */
public double getRoundingIncrement(CurrencyUsage Usage) {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    CurrencyDigits digits = info.currencyDigits(subType, Usage);
    int data1 = digits.roundingIncrement;
    // This is the high-runner case, by far.
    if (data1 == 0) {
        return 0.0;
    }
    int data0 = digits.fractionDigits;
    // If the meta data is invalid, return 0.0 to indicate no rounding.
    if (data0 < 0 || data0 >= POW10.length) {
        return 0.0;
    }
    // as of this writing, is CHF { 2, 25 }.
    return (double) data1 / POW10[data0];
}
Also used : CurrencyMetaInfo(android.icu.text.CurrencyMetaInfo) CurrencyDigits(android.icu.text.CurrencyMetaInfo.CurrencyDigits)

Aggregations

CurrencyMetaInfo (android.icu.text.CurrencyMetaInfo)2 CurrencyDigits (android.icu.text.CurrencyMetaInfo.CurrencyDigits)2