All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.roguewave.money.currency.v1_0.DivisionGroup

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

public class DivisionGroup
extends Object
implements ExchangeGroup
Currency exchange groups are collections of currencies that have a common distinguishing characteristic for converting money from one currency to money of another currency. DivisionGroup is made up of objects that convert a source currency to a target currency by dividing the amount of the source currency by a conversion factor.

NOTE -- Currencies that use the triangular conversion method required by the European Monetary Union are available in class EuroGroup. Currencies that convert a source currency to a target currency by multiplying the amount of the source by a conversion factor are available in MultiplicationGroup.

The division exchange group overrides the base class method:

Exchange getExchange(String source, String target, ExchangeRateTable rates);

so that it looks in exchange rate table rates for an exchange rate that converts the target currency to the source currency. If it finds one, it creates and returns an Exchange object with a DivisionExchange implementation. If it does not find one, it returns a null value.

Author:
Trevor Misfeldt
See Also:
DivisionExchange, MultiplicationGroup, EuroGroup, ExchangeGroup, FactoryExample, GroupExample

Variable Index

 o NAME
The name of this conversion group is "Bilateral Division"

Constructor Index

 o DivisionGroup()
Creates an empty group.

Method Index

 o getExchange(String, String, ExchangeRateTable)
Returns an exchange object which can exchange source amounts to target amounts.
 o getName()
Returns the name of this group.

Variables

 o NAME
 public static final String NAME
The name of this conversion group is "Bilateral Division"

Constructors

 o DivisionGroup
 public DivisionGroup()
Creates an empty group.

Methods

 o getExchange
 public Exchange getExchange(String source,
                             String target,
                             ExchangeRateTable rates)
Returns an exchange object which can exchange source amounts to target amounts. The exchange rate table contains multiplication 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

The division exchange group creates exchange objects that divide the source amounts by the exchange rate to obtain the target amount. Thus this division exchange rate for a given source/target pair is found by searching the exchange rate table for a multiplicative rate for the target/source pair

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:
DivisionExchange, BilateralExchange, Exchange
 o getName
 public String getName()
Returns the name of this group.

Returns:
the name
See Also:
NAME

All Packages  Class Hierarchy  This Package  Previous  Next  Index