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

Variable Index

 o name
 o source
 o target

Constructor Index

 o Exchange(String, String, String)
Creates a new exchange with desired source, target and conversion method name.

Method Index

 o exchange(Money)
Converts the money in the source currency to a new money with the target currency.
 o getName()
Returns the name of the conversion method.
 o getSource()
Returns the source currency mnemonic.
 o getTarget()
Returns the target currency mnemonic.
 o setName(String)
Sets the name of the conversion method.
 o setSource(String)
Sets the source currency mnemonic.
 o setTarget(String)
Sets the target currency mnemonic.

Variables

 o source
 protected String source
 o target
 protected String target
 o name
 protected String name

Constructors

 o 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

Methods

 o setName
 public void setName(String name)
Sets the name of the conversion method.

Parameters:
name - the desired name
 o getName
 public String getName()
Returns the name of the conversion method.

Returns:
the name
 o setSource
 public void setSource(String source)
Sets the source currency mnemonic.

Parameters:
source - the original currency
 o getSource
 public String getSource()
Returns the source currency mnemonic.

Returns:
the source
 o setTarget
 public void setTarget(String target)
Sets the target currency mnemonic.

Parameters:
target - the desired currency
 o getTarget
 public String getTarget()
Returns the target currency mnemonic.

Returns:
the target
 o 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