All Packages Class Hierarchy This Package Previous Next Index
Class com.roguewave.money.currency.v1_0.Exchange
java.lang.Object
|
+----com.roguewave.money.currency.v1_0.Exchange
- public abstract class Exchange
- extends Object
Currency exchange objects are responsible for converting money of one currency into money
of another currency. They encapsulate the source and target currency mnemonics, an
exchange algorithm and any required exchange rates. Exchange
is an abstract
base class from which all exchange implementation classes must derive. Money.h++ provides
three types of currency exchange objects. The first type implements a triangular exchange
algorithm required for converting between local currencies through an intermediate
currency, such as the EMU requires for the Euro transition. The second type of exchange
object multiplies the source currency amount by the exchange factor to obtain a target
amount. The third type of exchange object divides the source currency amount by the
exchange factor to obtain the target currency amount. All of the exchange objects share
a common API for performing the actual conversion of money.
- Author:
- Trevor Misfeldt
- See Also:
- BilateralExchange, MultiplicationExchange, DivisionExchange, TriangularExchange, FactoryExample, GroupExample, USDollarGroup, USDollarExchange
-
name
-
-
source
-
-
target
-
-
Exchange(String, String, String)
- Creates a new exchange with desired source, target and conversion method name.
-
exchange(Money)
- Converts the money in the source currency to a new money with the target
currency.
-
getName()
- Returns the name of the conversion method.
-
getSource()
- Returns the source currency mnemonic.
-
getTarget()
- Returns the target currency mnemonic.
-
setName(String)
- Sets the name of the conversion method.
-
setSource(String)
- Sets the source currency mnemonic.
-
setTarget(String)
- Sets the target currency mnemonic.
source
protected String source
target
protected String target
name
protected String name
Exchange
protected Exchange(String source,
String target,
String name)
- Creates a new exchange with desired source, target and conversion method name.
- Parameters:
- source - the original currency
- target - the converted currency
- name - the name of this conversion method
setName
public void setName(String name)
- Sets the name of the conversion method.
- Parameters:
- name - the desired name
getName
public String getName()
- Returns the name of the conversion method.
- Returns:
- the name
setSource
public void setSource(String source)
- Sets the source currency mnemonic.
- Parameters:
- source - the original currency
getSource
public String getSource()
- Returns the source currency mnemonic.
- Returns:
- the source
setTarget
public void setTarget(String target)
- Sets the target currency mnemonic.
- Parameters:
- target - the desired currency
getTarget
public String getTarget()
- Returns the target currency mnemonic.
- Returns:
- the target
exchange
public abstract Money exchange(Money money)
- Converts the money in the source currency to a new money with the target
currency.
- Parameters:
- money - the source money
- Returns:
- the target money
- See Also:
- exchange, exchange, exchange
All Packages Class Hierarchy This Package Previous Next Index