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
-
EURO
- The currency mnemonic for the Euro is "EUR".
-
NAME
- The name of this conversion group is "Euro Triangular"
-
EuroGroup()
- Creates an empty group.
-
EuroGroup(String[])
- Constructs a Euro exchange group containing these currency mnemonics.
-
EuroGroup(Vector)
- Constructs a Euro exchange group containing these currency mnemonics.
-
addCurrency(String)
- Adds the currency to the list of Euro currencies.
-
clearCurrencies()
- Removes all currencies from the collection.
-
containsCurrency(String)
- Returns true if the given currency is in the Euro exchange group.
-
getCurrencies()
- Returns the collection of currencies in a vector.
-
getExchange(String, String, ExchangeRateTable)
- Generates
TriangularExchange
objects for the Euro conversion.
-
getName()
- Returns the name of this group.
-
initialize(Reader)
- Initializes the Euro group currencies from a reader.
-
numberOfCurrencies()
- Returns the number of currencies in the Euro group.
-
read(Reader)
- Creates a new Euro group with initialized values from a reader.
-
removeCurrency(String)
- Removes the currency from the list of Euro currencies.
-
setCurrencies(String[])
- Sets the collection of Euro currencies.
-
setCurrencies(Vector)
- Sets the collection of Euro currencies.
-
write(Writer)
- Persists the group's collection of currency mnemonics.
NAME
public static final String NAME
- The name of this conversion group is "Euro Triangular"
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.
EuroGroup
public EuroGroup()
- Creates an empty group.
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
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
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
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
getName
public String getName()
- Returns the name of this group.
- Returns:
- the name
- See Also:
- NAME
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
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
clearCurrencies
public void clearCurrencies()
- Removes all currencies from the collection.
getCurrencies
public Vector getCurrencies()
- Returns the collection of currencies in a vector. Note: Does not copy them.
- Returns:
- the Euro currency collection
setCurrencies
public void setCurrencies(String currencies[])
- Sets the collection of Euro currencies.
- Parameters:
- currencies - An array of the desired currencies' mnemonics.
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.
numberOfCurrencies
public int numberOfCurrencies()
- Returns the number of currencies in the Euro group.
- Returns:
- the number of currencies
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.
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.
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