Venice 0.751beta

nz.org.venice.util
Class ExchangeRate

java.lang.Object
  extended bynz.org.venice.util.ExchangeRate

public class ExchangeRate
extends java.lang.Object

An immutable representation of an Exchange Rate. An exchange rate is the conversion rate when converting one currency into another.

Author:
Andrew Leppard

Constructor Summary
ExchangeRate(TradingDate date, Currency source, Currency destination, double rate)
          Create a new exchange rate that converts the source currency into the destination currency.
 
Method Summary
 TradingDate getDate()
          Return the date of the exchange rate.
 Currency getDestinationCurrency()
          Return the currency that this exchange rate is converting into.
 double getRate()
          Return the exchange rate when converting between the two currencies.
 Currency getSourceCurrency()
          Return the currency that this exchange rate is converting from.
 java.lang.String toString()
          Return a string representation of this exchange rate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExchangeRate

public ExchangeRate(TradingDate date,
                    Currency source,
                    Currency destination,
                    double rate)
Create a new exchange rate that converts the source currency into the destination currency.

Parameters:
date - the date of the exchange rate
source - the currency we are converting from
destination - the currency we are converting to
rate - the exchange rate
Method Detail

getDate

public TradingDate getDate()
Return the date of the exchange rate.

Returns:
the date

getSourceCurrency

public Currency getSourceCurrency()
Return the currency that this exchange rate is converting from.

Returns:
the source currency

getDestinationCurrency

public Currency getDestinationCurrency()
Return the currency that this exchange rate is converting into.

Returns:
the destination currency

getRate

public double getRate()
Return the exchange rate when converting between the two currencies. If you were converting from USD to AUD, and the exchange rate was 1.33, you would get AUD $1.33 for every USD $1.00.

Returns:
the exchange rate

toString

public java.lang.String toString()
Return a string representation of this exchange rate.

Returns:
string representation

Venice 0.751beta