Package com.ibm.icu.util

Examples of com.ibm.icu.util.Currency$CurrencyStringInfo


                        intl = false;
                        ++i;
                    }
                }
                String s = null;
                Currency currency = getCurrency();
                if (currency != null) {
                    // plural name is only needed when pluralCount != null, which means
                    // when formatting currency plural names.  For other cases,
                    // pluralCount == null, and plural names are not needed.
                    if (plural && pluralCount != null) {
                        boolean isChoiceFormat[] = new boolean[1];
                        s = currency.getName(symbols.getULocale(), Currency.PLURAL_LONG_NAME,
                                             pluralCount, isChoiceFormat);
                    } else if (!intl) {
                        boolean isChoiceFormat[] = new boolean[1];
                        s = currency.getName(symbols.getULocale(), Currency.SYMBOL_NAME,
                                             isChoiceFormat);
                        if (isChoiceFormat[0]) {
                            // Two modes here: If doFormat is false, we set up
                            // currencyChoice. If doFormat is true, we use the previously
                            // created currencyChoice to format the value in digitList.
                            if (!doFormat) {
                                // If the currency is handled by a ChoiceFormat, then
                                // we're not going to use the expanded
                                // patterns. Instantiate the ChoiceFormat and return.
                                if (currencyChoice == null) {
                                    currencyChoice = new ChoiceFormat(s);
                                }
                                // We could almost return null or "" here, since the
                                // expanded affixes are almost not used at all in this
                                // situation. However, one method -- toPattern() -- still
                                // does use the expanded affixes, in order to set up a
                                // padding pattern. We use the CURRENCY_SIGN as a
                                // placeholder.
                                s = String.valueOf(CURRENCY_SIGN);
                            } else {
                                FieldPosition pos = new FieldPosition(0); // ignored
                                currencyChoice.format(digitList.getDouble(), buffer, pos);
                                continue;
                            }
                        }
                    } else {
                        s = currency.getCurrencyCode();
                    }
                } else {
                    s = intl ? symbols.getInternationalCurrencySymbol() :
                        symbols.getCurrencySymbol();
                }
View Full Code Here


     *
     * @internal
     * @deprecated This API is ICU internal only.
     */
    protected Currency getEffectiveCurrency() {
        Currency c = getCurrency();
        if (c == null) {
            c = Currency.getInstance(symbols.getInternationalCurrencySymbol());
        }
        return c;
    }
View Full Code Here


        // Get currency pattern/separator overrides if they exist.
        monetarySeparator = decimalSeparator;
        monetaryGroupingSeparator = groupingSeparator;
        Currency curr = Currency.getInstance(locale);
        if (curr != null){
            CurrencyFormatInfo fmtInfo = info.getFormatInfo(curr.getCurrencyCode());
            if (fmtInfo != null) {
                currencyPattern = fmtInfo.currencyPattern;
                monetarySeparator = fmtInfo.monetarySeparator;
                monetaryGroupingSeparator = fmtInfo.monetaryGroupingSeparator;
            }
View Full Code Here

     */
    public StringBuffer format(CurrencyAmount currAmt,
                               StringBuffer toAppendTo,
                               FieldPosition pos) {
        // Default implementation -- subclasses may override
        Currency save = getCurrency(), curr = currAmt.getCurrency();
        boolean same = curr.equals(save);
        if (!same) setCurrency(curr);
        format(currAmt.getNumber(), toAppendTo, pos);
        if (!same) setCurrency(save);
        return toAppendTo;
View Full Code Here

     * @return a non-null Currency
     * @internal
     * @deprecated This API is ICU internal only.
     */
    protected Currency getEffectiveCurrency() {
        Currency c = getCurrency();
        if (c == null) {
            ULocale uloc = getLocale(ULocale.VALID_LOCALE);
            if (uloc == null) {
                uloc = ULocale.getDefault(Category.FORMAT);
            }
View Full Code Here

            currencySymbol = "\u00A4"; // 'OX' currency symbol
        }
        // If there is a currency decimal, use it.
        monetarySeparator = decimalSeparator;
        monetaryGroupingSeparator = groupingSeparator;
        Currency curr = Currency.getInstance(locale);
        if(curr!=null){
            String currencyCode = curr.getCurrencyCode();
            if(currencyCode != null) {
                /* An explicit currency was requested */
                ICUResourceBundle resource = (ICUResourceBundle)UResourceBundle.getBundleInstance(ICUResourceBundle.ICU_BASE_NAME, locale);
                ICUResourceBundle currencyRes = resource.getWithFallback("Currencies");
                try{
View Full Code Here

     */
    public StringBuffer format(CurrencyAmount currAmt,
                               StringBuffer toAppendTo,
                               FieldPosition pos) {
        // Default implementation -- subclasses may override
        Currency save = getCurrency(), curr = currAmt.getCurrency();
        boolean same = curr.equals(save);
        if (!same) setCurrency(curr);
        format(currAmt.getNumber(), toAppendTo, pos);
        if (!same) setCurrency(save);
        return toAppendTo;
View Full Code Here

     * @return a non-null Currency
     * @internal
     * @deprecated This API is ICU internal only.
     */
    protected Currency getEffectiveCurrency() {
        Currency c = getCurrency();
        if (c == null) {
            ULocale uloc = getLocale(ULocale.VALID_LOCALE);
            if (uloc == null) {
                uloc = ULocale.getDefault();
            }
View Full Code Here

            currency[0] = Currency.getInstance(iso);
          } else {
            // The formatter is currency-style but the client has not requested
            // the value of the parsed currency. In this case, if that value does
            // not match the formatter's current value, then the parse fails.
            Currency effectiveCurr = getEffectiveCurrency();
            if (iso.compareTo(effectiveCurr.getCurrencyCode()) != 0) {
              pos = -1;
              continue;
            }
          }
          pos = ppos.getIndex();
View Full Code Here

            intl = false;
            ++i;
          }
        }
        String s = null;
        Currency currency = getCurrency();
        if (currency != null) {
          // plural name is only needed when pluralCount != null, which means
          // when formatting currency plural names.  For other cases,
          // pluralCount == null, and plural names are not needed.
          if (plural && pluralCount != null) {
            boolean isChoiceFormat[] = new boolean[1];
            s = currency.getName(symbols.getULocale(), Currency.PLURAL_LONG_NAME, pluralCount, isChoiceFormat);
          } else if (!intl) {
            boolean isChoiceFormat[] = new boolean[1];
            s = currency.getName(symbols.getULocale(), Currency.SYMBOL_NAME, isChoiceFormat);
            if (isChoiceFormat[0]) {
              // Two modes here: If doFormat is false, we set up
              // currencyChoice. If doFormat is true, we use the previously
              // created currencyChoice to format the value in digitList.
              if (!doFormat) {
                // If the currency is handled by a ChoiceFormat, then
                // we're not going to use the expanded
                // patterns. Instantiate the ChoiceFormat and return.
                if (currencyChoice == null) {
                  currencyChoice = new ChoiceFormat(s);
                }
                // We could almost return null or "" here, since the
                // expanded affixes are almost not used at all in this
                // situation. However, one method -- toPattern() -- still
                // does use the expanded affixes, in order to set up a
                // padding pattern. We use the CURRENCY_SIGN as a
                // placeholder.
                s = String.valueOf(CURRENCY_SIGN);
              } else {
                FieldPosition pos = new FieldPosition(0); // ignored
                currencyChoice.format(digitList.getDouble(), buffer, pos);
                continue;
              }
            }
          } else {
            s = currency.getCurrencyCode();
          }
        } else {
          s = intl ? symbols.getInternationalCurrencySymbol() : symbols.getCurrencySymbol();
        }
        buffer.append(s);
View Full Code Here

TOP

Related Classes of com.ibm.icu.util.Currency$CurrencyStringInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.