All Packages  Class Hierarchy  This Package  Previous  Next  Index

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

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

public class FactoryExample
extends Object
An example illustrating the use of the class ExchangeFactory. An instance of ExchangeFactory contains an exchange rate table and 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 an invalid object is returned by the factory.

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

Constructor Index

 o FactoryExample()

Method Index

 o initialize()
Function to initialize the global exchange factory.
 o main(String[])
This example must be run from the directory containing the data text files.

Constructors

 o FactoryExample
 public FactoryExample()

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.FactoryExample

Output should appear as follows:

 exchanging Belgian Francs to Canadian Dollars using Bilateral Multiplication
 BEF: 12348.21, CAD: 563.6957865
 BEF: 8900.54, CAD: 406.3096510000001
 BEF: 373095.0, CAD: 17031.786750000003
 BEF: 4343.33, CAD: 198.27301450000002
 BEF: 43439.7, CAD: 1983.022305
 exchanging Belgian Francs to French Francs using Triangular
 BEF: 12348.21, CAD: 2005.4099087116565
 BEF: 8900.54, CAD: 1445.491379631902
 BEF: 373095.0, CAD: 60592.4591411043
 BEF: 4343.33, CAD: 705.3781089570552
 BEF: 43439.7, CAD: 7054.820480981595
 exchanging Belgian Francs to Euro's using Bilateral Division
 BEF: 12348.21, EUR: 303.02355828220857
 BEF: 8900.54, EUR: 218.41815950920247
 BEF: 373095.0, EUR: 9155.705521472393 
 BEF: 4343.33, EUR: 106.58478527607362
 BEF: 43439.7, EUR: 1066.0049079754601
 

 o initialize
 protected static boolean initialize()
Function to initialize the global exchange factory. The factory must contain an exchange rate table object and at least one exchange group.

Returns:
whether the initialize from file succeeded or not

All Packages  Class Hierarchy  This Package  Previous  Next  Index