All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.examples.money.currency.v1_0.GroupExample

java.lang.Object
   |
   +----com.roguewave.examples.money.currency.v1_0.GroupExample

public class GroupExample
extends Object
Example illustrating the use of the class ExchangeFactory and exchange groups.

An instance of ExchangeFactory contains an exchange rate table and at at least one exchange group. Exchange groups can construct exchange objects which are used to perform currency conversions. When presented with a source/target currency pair the exchange factory searches its list of exchange groups until it finds one that can create an exchange object given the source/target pair and the factory's associated exchange rate table. If no group can create such an object a null value is returned by the factory.

In this example an exchange factory object is created and three exchange groups are added. Several currency exchanges are performed.

Author:
Trevor Misfeldt
See Also:
ExchangeFactory, ExchangeRateTable, ExchangeRate, Exchange, MultiplicationExchange, DivisionExchange, TriangularExchange, ExchangeGroup, MultiplicationGroup, DivisionGroup, EuroGroup

Constructor Index

 o GroupExample()

Method Index

 o doConversion(Money, Exchange)
Method to perform the conversion from the given source currency to the desired target currency using the given exchange object.
 o main(String[])
This example must be run from the directory containing the data text files.

Constructors

 o GroupExample
 public GroupExample()

Methods

 o main
 public static void main(String args[])
This example must be run from the directory containing the data text files. Run program by using this command:

java com.roguewave.examples.money.currency.v1_0.GroupExample

Output should appear as follows:

 Factory Groups
 ==============
 0 -- BilateralMultiplication
 1 -- BilateralDivision
 2 -- Euro Triangular
 3 -- USDollarGroup
 Using exchange method: USDollar Method
 ARP 8976.80 = AUD 14223.35 
 Using exchange method: Triangular
 FRF 8976.80 = DEM 2678.93
 Using exchange method: Bilateral Multiplication
 USD 8976.80 = DEM 14733.80
 

 o doConversion
 protected static Money doConversion(Money source,
                                     Exchange exchanger)
Method to perform the conversion from the given source currency to the desired target currency using the given exchange object. Prints out information as it happens.


All Packages  Class Hierarchy  This Package  Previous  Next  Index