/*
* ExchangeList.java
*
* Created on: 22-Mar-2010
*
*/
package netukar.exchange;
import java.text.DecimalFormat;
/**
*
* @author radovan
*/
public class ExchangeList {
private ExchangeRateCalculator calculator;
private DecimalFormat formatter;
/**
* Creates a new instance of ExchangeList.
*/
public ExchangeList() {
calculator = new ExchangeRateCalculator();
formatter = new DecimalFormat("0.000");
}
public double calculate(double amount, Currency in, Currency out) {
return calculator.calculate(amount, in, out);
}
/**
* @throw IllegalArgumentException
* if either parameter from
or to
cannot
* be mapped to any Currency
enumeration type
*/
public double calculate(double amount, String from, String to) {
return calculator.calculate(amount, from, to);
}
public String format(double amount) {
return formatter.format(amount);
}
public Currency[] getAvailableCurrencies() {
return ExchangeRateTable.getInstance().getAvailableCurrencies();
}
}