Package org.jscience.economics.money

Examples of org.jscience.economics.money.Currency


      if (!rates.base.equalsIgnoreCase("usd")) {
        log.warning("We assume base rate of USD, but it is " + rates.base);
      }
      final Map<String, Currency> currencies = Maps.newHashMap();
      for (final Entry<String, Double> e : rates.rates.entrySet()) {
        final Currency currency = new Currency(e.getKey());
        currency.setExchangeRate(1.0 / e.getValue());
        currencies.put(e.getKey(), currency);
      }

      currenciesByCode = currencies;
    } catch (final Exception e) {
View Full Code Here


            final Amount<?> amount = (Amount<?>) obj;
            final Element amountSpan = renderTo.appendElement("span");
            final double estimatedValue = amount.getEstimatedValue();
            if (amount.getUnit() instanceof Currency) {
                final Element currencySpan = amountSpan.appendElement("span").addClass("currency");
                final Currency currency = (Currency) amount.getUnit();
                if (currency.getCode().equalsIgnoreCase("USD")) {
                    currencySpan.html("US$" + currencyFormat.format(estimatedValue));
                } else if (currency.getCode().equalsIgnoreCase("GBP")) {
                    currencySpan.html("&pound;" + currencyFormat.format(estimatedValue));
                } else if (currency.getCode().equalsIgnoreCase("EUR")) {
                    currencySpan.html("&euro;" + currencyFormat.format(estimatedValue));
                } else if (currency.getCode().equalsIgnoreCase("JPY")) {
                    currencySpan.html("&yen;" + currencyFormat.format(estimatedValue));
                } else {
                    currencySpan.text(currencyFormat.format(estimatedValue) + currency.getCode());
                }
            } else {
                final String numStr = Misc.numberFormat.format(estimatedValue);
                amountSpan.appendElement("span").addClass("number").text(numStr);
                amountSpan.appendText(" ");
View Full Code Here

TOP

Related Classes of org.jscience.economics.money.Currency

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.