Package com.ibm.icu.text

Examples of com.ibm.icu.text.CurrencyMetaInfo$CurrencyDigits


   * @return The set of available currencies. The returned set could be empty if there is no currency data available.
   *
   * @stable ICU 49
   */
  public static Set<Currency> getAvailableCurrencies() {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    List<String> list = info.currencies(CurrencyFilter.all());
    HashSet<Currency> resultSet = new HashSet<Currency>(list.size());
    for (String code : list) {
      resultSet.add(new Currency(code));
    }
    return resultSet;
View Full Code Here


    String code = currencyCodeCache.get(loc);
    if (code == null) {
      String country = loc.getCountry();

      CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
      List<String> list = info.currencies(CurrencyFilter.onRegion(country));
      if (list.size() > 0) {
        code = list.get(0);
        boolean isPreEuro = "PREEURO".equals(variant);
        if (isPreEuro && EUR_STR.equals(code)) {
          if (list.size() < 2) {
View Full Code Here

   *
   * @return a non-negative number of fraction digits to be displayed
   * @stable ICU 2.2
   */
  public int getDefaultFractionDigits() {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    CurrencyDigits digits = info.currencyDigits(isoCode);
    return digits.fractionDigits;
  }
View Full Code Here

   *
   * @return the non-negative rounding increment, or 0.0 if none
   * @stable ICU 2.2
   */
  public double getRoundingIncrement() {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    CurrencyDigits digits = info.currencyDigits(isoCode);

    int data1 = digits.roundingIncrement;

    // If there is no rounding return 0.0 to indicate no rounding.
    // This is the high-runner case, by far.
View Full Code Here

  }

  private static synchronized Set<String> getAllCurrenciesAsSet() {
    Set<String> all = (ALL_CODES_AS_SET == null) ? null : ALL_CODES_AS_SET.get();
    if (all == null) {
      CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
      all = Collections.unmodifiableSet(new HashSet<String>(info.currencies(CurrencyFilter.all())));
      ALL_CODES_AS_SET = new SoftReference<Set<String>>(all);
    }
    return all;
  }
View Full Code Here

    } else if (from == null && to == null) {
      return true;
    }

    // If caller passed a date range, we cannot rely solely on the cache
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    List<String> allActive = info.currencies(CurrencyFilter.onDateRange(from, to).withCurrency(code));
    return allActive.contains(code);
  }
View Full Code Here

   * @param filter
   *            the filter to apply to the tender currencies
   * @return a list of tender currencies
   */
  private static List<String> getTenderCurrencies(final CurrencyFilter filter) {
    CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
    return info.currencies(filter.withTender());
  }
View Full Code Here

     * @param d the date for which to retrieve currency codes for the given locale.
     * @return The array of ISO currency codes.
     * @stable ICU 4.0
     */
    public static String[] getAvailableCurrencyCodes(ULocale loc, Date d) {
        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
        CurrencyFilter filter = CurrencyFilter.onDate(d).withRegion(loc.getCountry());
        List<String> list = info.currencies(filter);
        // Note: Prior to 4.4 the spec didn't say that we return null if there are no results, but
        // the test assumed it did.  Kept the behavior and amended the spec.
        if (list.isEmpty()) {
            return null;
        }
View Full Code Here

            return new Currency(EUR_STR);
        }
       
        String country = loc.getCountry();
       
        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
        List<String> list = info.currencies(CurrencyFilter.onRegion(country));
        if (list.size() > 0) {
            String code = list.get(0);
            boolean isPreEuro = "PREEURO".equals(variant);
            if (isPreEuro && EUR_STR.equals(code)) {
                if (list.size() < 2) {
View Full Code Here

        // The only keyword we recognize is 'currency'
        if (!"currency".equals(key)) {
            return EMPTY_STRING_ARRAY;
        }
       
        CurrencyMetaInfo info = CurrencyMetaInfo.getInstance();
        if (!commonlyUsed) {
            // Behavior change from 4.3.3, no longer sort the currencies
            List<String> result = info.currencies(null);
            return result.toArray(new String[result.size()]);
        }
       
        // Don't resolve region if the requested locale is 'und', it will resolve to US
        // which we don't want.
        String prefRegion = locale.getCountry();
        if (prefRegion.length() == 0) {
            if (UND.equals(locale)) {
                return EMPTY_STRING_ARRAY;
            }
            ULocale loc = ULocale.addLikelySubtags(locale);
            prefRegion = loc.getCountry();
       }

        CurrencyFilter filter = CurrencyFilter.now().withRegion(prefRegion);
       
        // currencies are in region's preferred order when we're filtering on region, which
        // matches our spec
        List<String> result = info.currencies(filter);
       
        // No fallback anymore (change from 4.3.3)
        if (result.size() == 0) {
            return EMPTY_STRING_ARRAY;
        }
View Full Code Here

TOP

Related Classes of com.ibm.icu.text.CurrencyMetaInfo$CurrencyDigits

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.