org.jscience.economics.money
Class CurrencyConverter
Object
UnitConverter
CurrencyConverter
- All Implemented Interfaces:
- Serializable
public class CurrencyConverter
- extends UnitConverter
This class represents a converter between two currencies.
Currency converters convert values based upon the current
exchange rate exchange rate.
If the exchange rate from the
target currency to the source currency is not set, conversion
fails. In others words, the converter from a currency A
to a currency B is independant from the converter from
B to A.
- Version:
- 5.0, January 2, 2010
- Author:
- Jean-Marie Dautelle
- See Also:
Currency.setExchangeRate(java.lang.Number, org.jscience.economics.money.Currency),
Serialized Form
| Nested classes/interfaces inherited from class UnitConverter |
UnitConverter.Compound |
| Fields inherited from class UnitConverter |
IDENTITY |
| Methods inherited from class UnitConverter |
concatenate |
CurrencyConverter
public CurrencyConverter(Currency source,
Currency target)
- Creates the currency converter from the source currency to the target
currency.
- Parameters:
source - the source currency.target - the target currency.factor - the multiplier factor from source to target.
getSource
public Currency getSource()
- Returns the source currency.
- Returns:
- the source currency.
getTarget
public Currency getTarget()
- Returns the target currency.
- Returns:
- the target currency.
inverse
public CurrencyConverter inverse()
- Specified by:
inverse in class UnitConverter
convert
public double convert(double x)
- Specified by:
convert in class UnitConverter
convert
public BigDecimal convert(BigDecimal value,
MathContext ctx)
throws ArithmeticException
- Specified by:
convert in class UnitConverter
- Throws:
ArithmeticException
equals
public boolean equals(Object cvtr)
- Specified by:
equals in class UnitConverter
hashCode
public int hashCode()
- Specified by:
hashCode in class UnitConverter
toString
public final String toString()
- Overrides:
toString in class Object
isLinear
public boolean isLinear()
- Specified by:
isLinear in class UnitConverter
Copyright © 2005-2010 JScience. All Rights Reserved.