Conversion Classes
The Currency Module uses currency exchange objects to convert money of one currency into money of another currency. These objects encapsulate the source and target currency mnemonics, the conversion factors and the exchange algorithm needed for a conversion. Three conversion methods are provided:
A triangular conversion method in which the source currency amount is converted to an intermediate currency amount, then the intermediate currency amount is converted to the target amount. This is the method required by members of the European Monetary Union (EMU), for converting among national currencies that are transitioning to the Euro. The
RWTriangularExchange<T> implements this conversion method.
A conversion method in which the source currency amount is
multiplied by a conversion factor to obtain the target currency amount. The class
RWMultiplicationExchange<T> implements this conversion method.
A conversion method in which the source currency amount is
divided by a conversion factor to obtain the target currency amount. The class
RWDivisionExchange<T> implements this conversion method.
In addition to currency exchange objects, the Currency Module provides
currency exchange groups. A currency exchange group creates an exchange object when it is presented with a source currency, a target currency, and an exchange rate table. The exchange objects associated with a particular exchange group have a common distinguishing characteristic. For example,
RWEuroGroup provides exchange objects for all the currencies that are scheduled to be replaced by the Euro. Similarly,
RWMultiplicationGroup and
RWDivisionGroup provide currencies that implement the conversion by multiplication and conversion by division, respectively.