All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.money.currency.v1_0.EuroGroup

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

public class EuroGroup
extends Object
implements ExchangeGroup
Currency exchange groups are collections of currencies that have a common distinguishing characteristic when it comes to converting money from one currency to money of another currency. EuroGroup is a currency exchange group class that consists of all currencies that will be replaced by the Euro. EuroGroup objects create and return Exchange objects with the TriangularExchange implementation.

NOTE: The Euro itself is not in the Euro exchange group because the triangular exchange algorithm is not used when converting to or from Euros.

Author:
Trevor Misfeldt
See Also:
TriangularExchange, MultiplicationGroup, DivisionGroup, ExchangeGroup, Currency, FactoryExample, GroupExample

Variable Index

 o EURO
The currency mnemonic for the Euro is "EUR".
 o NAME
The name of this conversion group is "Euro Triangular"

Constructor Index

 o EuroGroup()
Creates an empty group.
 o EuroGroup(String[])
Constructs a Euro exchange group containing these currency mnemonics.
 o EuroGroup(Vector)
Constructs a Euro exchange group containing these currency mnemonics.

Method Index

 o addCurrency(String)
Adds the currency to the list of Euro currencies.
 o clearCurrencies()
Removes all currencies from the collection.
 o containsCurrency(String)
Returns true if the given currency is in the Euro exchange group.
 o getCurrencies()
Returns the collection of currencies in a vector.
 o getExchange(String, String, ExchangeRateTable)
Generates TriangularExchange objects for the Euro conversion.
 o getName()
Returns the name of this group.
 o initialize(Reader)
Initializes the Euro group currencies from a reader.
 o numberOfCurrencies()
Returns the number of currencies in the Euro group.
 o read(Reader)
Creates a new Euro group with initialized values from a reader.
 o removeCurrency(String)
Removes the currency from the list of Euro currencies.
 o setCurrencies(String[])
Sets the collection of Euro currencies.
 o setCurrencies(Vector)
Sets the collection of Euro currencies.
 o write(Writer)
Persists the group's collection of currency mnemonics.

Variables

 o NAME
 public static final String NAME
The name of this conversion group is "Euro Triangular"

 o EURO
 public static String EURO
The currency mnemonic for the Euro is "EUR". It is used to look up the Euro currency in the exchange rate table.

Constructors

 o EuroGroup
 public EuroGroup()
Creates an empty group.

 o EuroGroup
 public EuroGroup(String currencies[])
Constructs a Euro exchange group containing these currency mnemonics.

Parameters:
currencies - an array of Euro currency mnemonics
See Also:
Currency
 o EuroGroup
 public EuroGroup(Vector currencies)
Constructs a Euro exchange group containing these currency mnemonics.

Parameters:
currencies - a vector of Euro currency mnemonics
See Also:
Currency

Methods

 o containsCurrency
 public boolean containsCurrency(String currency)
Returns true if the given currency is in the Euro exchange group.

Parameters:
currency - the mnemonic of the desired currency
Returns:
whether the currency is in the list of Euro currencies or not
See Also:
Currency
 o getExchange
 public Exchange getExchange(String source,
                             String target,
                             ExchangeRateTable rates)
Generates TriangularExchange objects for the Euro conversion. The exchange rate table contains multiplicative exchange rates. In other words to convert an amount s in the source currency to an amount t in the target currency you would find the rate r for the source/target pair in the exchange rate table and multiply

t = s*t

This method looks for these factors for Euro->source conversion and Euro->target conversion and combines them into a TriangularExchange.

Parameters:
source - the original currency
target - the desired currency
rates - a table of exchange rates
Returns:
An exchange object which can convert values from the source currency to the target currency. If none could be found, a null value is returned.
See Also:
Exchange, TriangularExchange
 o getName
 public String getName()
Returns the name of this group.

Returns:
the name
See Also:
NAME
 o addCurrency
 public boolean addCurrency(String currency)
Adds the currency to the list of Euro currencies.

Parameters:
currency - The currency mnemonic for the new currency
Returns:
whether the currency currently exists in the collection
See Also:
Currency
 o removeCurrency
 public boolean removeCurrency(String currency)
Removes the currency from the list of Euro currencies.

Parameters:
currency - The currency mnemonic
Returns:
whether the currency currently exists in the collection
See Also:
Currency
 o clearCurrencies
 public void clearCurrencies()
Removes all currencies from the collection.

 o getCurrencies
 public Vector getCurrencies()
Returns the collection of currencies in a vector. Note: Does not copy them.

Returns:
the Euro currency collection
 o setCurrencies
 public void setCurrencies(String currencies[])
Sets the collection of Euro currencies.

Parameters:
currencies - An array of the desired currencies' mnemonics.
 o setCurrencies
 public void setCurrencies(Vector currencies)
Sets the collection of Euro currencies.

Parameters:
currencies - A vector of the desired currencies' mnemonics. Note: Does not copy the contents.
 o numberOfCurrencies
 public int numberOfCurrencies()
Returns the number of currencies in the Euro group.

Returns:
the number of currencies
 o initialize
 public void initialize(Reader reader) throws IOException
Initializes the Euro group currencies from a reader. NOTE: The previous contents of this Euro group are deleted when this method is invoked.

The format is a list of currency mnemonics. For example:

 ATS
 BEF
 FIM
 FRF
 DEM
 IEP
 ITL
 LUF
 NLG
 ESP
 PTE
 

Parameters:
reader - The reader from which data will be read. Note: The reader is not closed.
 o read
 public static EuroGroup read(Reader reader) throws IOException
Creates a new Euro group with initialized values from a reader.

The format is a list of currency mnemonics. For example:

 ATS
 BEF
 FIM
 FRF
 DEM
 IEP
 ITL
 LUF
 NLG
 ESP
 PTE
 

Parameters:
reader - The reader from which data will be read. Note: The reader is not closed.
 o write
 public Writer write(Writer writer) throws IOException
Persists the group's collection of currency mnemonics.

Parameters:
writer - The writer to which the data will be persisted.
Returns:
The writer. Note: The writer is not flused or closed.

All Packages  Class Hierarchy  This Package  Previous  Next  Index