com.moneydance.apps.md.model
Class CurrencyTable

java.lang.Object
  extended by com.moneydance.apps.md.model.CurrencyTable

public class CurrencyTable
extends java.lang.Object

A table containing the set of currencies in a moneydance data set


Constructor Summary
CurrencyTable()
           
 
Method Summary
 void addCurrencyListener(CurrencyListener listener)
           
 void addCurrencyType(CurrencyType newType)
           
 boolean contains(CurrencyType curr)
           
static double convertToBasePrice(double priceFromCurr, CurrencyType curr, long date)
          Convert the given price (in terms of the given currency) to a price in terms of the base currency.
static long convertValue(long value, CurrencyType fromCurrency, CurrencyType toCurrency)
          Return the amount of toCurrency that the given value of fromCurrency is currently worth.
static long convertValue(long value, CurrencyType fromCurrency, CurrencyType toCurrency, double userRate)
          Return the amount of 'toCurrency' obtained by exchanging 'value' of 'fromCurrency' at the rate 'rate'
static long convertValue(long value, CurrencyType fromCurrency, CurrencyType toCurrency, long effectiveDate)
          Return the amount of toCurrency that the given value of fromCurrency was worth on the given date.
 long convertValueXXX(long value, CurrencyType currentType, CurrencyType newType)
          Convert value in one currency to the same value in another currency.
static CurrencyTable createDefaultTable(java.lang.String primaryCurrency)
           
static CurrencyTable createDefaultTable(java.lang.String primaryCurrency, boolean singleCurrency)
           
 void dumpCurrencies()
           
 void fireCurrencyTableModified()
           
 CurrencyType[] getAllCurrencies()
           
 java.util.Enumeration getAllValues()
           
 CurrencyType getBaseType()
           
 CurrencyType getCurrencyByID(int id)
           
 CurrencyType getCurrencyByIDString(java.lang.String typeID)
           
 CurrencyType getCurrencyByName(java.lang.String name)
           
 CurrencyType getCurrencyByTickerSymbol(java.lang.String ticker)
           
 long getCurrencyCount()
           
 int getNextID()
           
static double getRawRate(CurrencyType fromCurrency, CurrencyType toCurrency)
          Deprecated. use CurrencyUtil.getRawRate(CurrencyType, CurrencyType) instead
static double getRawRate(CurrencyType fromCurrency, CurrencyType toCurrency, double userRate)
          Convert the given user-identifiable rate to the 'raw' rate used to exchange amounts between the given two currencies.
static double getRawRate(CurrencyType fromCurrency, CurrencyType toCurrency, long effectiveDate)
          Deprecated. use CurrencyUtil.getRawRate(CurrencyType, CurrencyType, int) instead
 double getRelativePrice(CurrencyType curr1, CurrencyType curr2, long date)
          Deprecated. use getRelativePrice(CurrencyType, CurrencyType, int) instead
 double getRelativePriceInt(CurrencyType curr1, CurrencyType curr2, int date)
          Get the price (going rate) for currency curr1 in terms of curr2 on the given date.
 double getSplitAdjustedRelativePrice(CurrencyType curr1, CurrencyType curr2, long date)
          Deprecated. use CurrencyUtil.getSplitAdjustedRelativePrice(...) instead
 java.lang.String getUniqueCurrId(java.lang.String ticker)
           
static double getUserRate(CurrencyType fromCurrency, CurrencyType toCurrency)
           
static double getUserRate(CurrencyType fromCurrency, CurrencyType toCurrency, double rawRate)
          Convert the given raw rate to the user-identifiable rate used to exchange amounts between the given two currencies.
static double getUserRate(CurrencyType fromCurrency, CurrencyType toCurrency, long effectiveDate)
          Deprecated. use CurrencyUtil.getUserRate(CurrencyType, CurrencyType, int) instead
 boolean isDirty()
           
 void removeCurrencyListener(CurrencyListener listener)
           
 void removeCurrencyType(CurrencyType type)
           
 void resetDirtyFlags()
           
 void setBaseType(CurrencyType newBaseType)
           
 void setFireNotifications(boolean doNotifications)
          Tells the model whether or not notifications should be sent or delayed for a little while.
 void setRootAccount(RootAccount rootAccount)
           
static void sortCurrencyList(CurrencyType[] list)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CurrencyTable

public CurrencyTable()
Method Detail

addCurrencyListener

public void addCurrencyListener(CurrencyListener listener)

removeCurrencyListener

public void removeCurrencyListener(CurrencyListener listener)

fireCurrencyTableModified

public void fireCurrencyTableModified()

setFireNotifications

public void setFireNotifications(boolean doNotifications)
Tells the model whether or not notifications should be sent or delayed for a little while. This is useful to turn off notifications during batch processing (for example when importing from a QIF file). NOTE: Don't forget to turn this back on!!!


getBaseType

public CurrencyType getBaseType()

contains

public final boolean contains(CurrencyType curr)

setBaseType

public void setBaseType(CurrencyType newBaseType)

getAllCurrencies

public CurrencyType[] getAllCurrencies()

getNextID

public int getNextID()

getCurrencyByID

public CurrencyType getCurrencyByID(int id)

getCurrencyByIDString

public CurrencyType getCurrencyByIDString(java.lang.String typeID)

getCurrencyByTickerSymbol

public CurrencyType getCurrencyByTickerSymbol(java.lang.String ticker)

getCurrencyByName

public CurrencyType getCurrencyByName(java.lang.String name)

addCurrencyType

public void addCurrencyType(CurrencyType newType)

removeCurrencyType

public void removeCurrencyType(CurrencyType type)

setRootAccount

public void setRootAccount(RootAccount rootAccount)

getCurrencyCount

public long getCurrencyCount()

getUniqueCurrId

public java.lang.String getUniqueCurrId(java.lang.String ticker)

resetDirtyFlags

public void resetDirtyFlags()

getRawRate

public static final double getRawRate(CurrencyType fromCurrency,
                                      CurrencyType toCurrency,
                                      long effectiveDate)
Deprecated. use CurrencyUtil.getRawRate(CurrencyType, CurrencyType, int) instead

Get the raw (adjusted for decimal place differences) rate between the two currencies. The rate that is used is the one effective on the given date.


getUserRate

public static final double getUserRate(CurrencyType fromCurrency,
                                       CurrencyType toCurrency,
                                       long effectiveDate)
Deprecated. use CurrencyUtil.getUserRate(CurrencyType, CurrencyType, int) instead

Get the raw (adjusted for decimal place differences) rate between the two currencies. The rate that is used is the one effective on the given date.


getRawRate

public static final double getRawRate(CurrencyType fromCurrency,
                                      CurrencyType toCurrency)
Deprecated. use CurrencyUtil.getRawRate(CurrencyType, CurrencyType) instead

Get the raw (adjusted for decimal place differences) rate between the two currencies.


getRelativePrice

public final double getRelativePrice(CurrencyType curr1,
                                     CurrencyType curr2,
                                     long date)
Deprecated. use getRelativePrice(CurrencyType, CurrencyType, int) instead

Get the price (going rate) for currency curr1 in terms of curr2 on the given date.


getRelativePriceInt

public final double getRelativePriceInt(CurrencyType curr1,
                                        CurrencyType curr2,
                                        int date)
Get the price (going rate) for currency curr1 in terms of curr2 on the given date. In this method the date must be passed as an int with value YYYYMMDD.


getSplitAdjustedRelativePrice

public final double getSplitAdjustedRelativePrice(CurrencyType curr1,
                                                  CurrencyType curr2,
                                                  long date)
Deprecated. use CurrencyUtil.getSplitAdjustedRelativePrice(...) instead

Get the price (going rate) for currency curr1 in terms of curr2 on the given date. This adjusts the price to be in terms of splits in either currency so that the price is in terms of today's units of each currency.


convertToBasePrice

public static final double convertToBasePrice(double priceFromCurr,
                                              CurrencyType curr,
                                              long date)
Convert the given price (in terms of the given currency) to a price in terms of the base currency.


getRawRate

public static final double getRawRate(CurrencyType fromCurrency,
                                      CurrencyType toCurrency,
                                      double userRate)
Convert the given user-identifiable rate to the 'raw' rate used to exchange amounts between the given two currencies.


getUserRate

public static final double getUserRate(CurrencyType fromCurrency,
                                       CurrencyType toCurrency,
                                       double rawRate)
Convert the given raw rate to the user-identifiable rate used to exchange amounts between the given two currencies.


getUserRate

public static final double getUserRate(CurrencyType fromCurrency,
                                       CurrencyType toCurrency)

convertValue

public static final long convertValue(long value,
                                      CurrencyType fromCurrency,
                                      CurrencyType toCurrency)
Return the amount of toCurrency that the given value of fromCurrency is currently worth.


convertValue

public static final long convertValue(long value,
                                      CurrencyType fromCurrency,
                                      CurrencyType toCurrency,
                                      double userRate)
Return the amount of 'toCurrency' obtained by exchanging 'value' of 'fromCurrency' at the rate 'rate'


convertValue

public static final long convertValue(long value,
                                      CurrencyType fromCurrency,
                                      CurrencyType toCurrency,
                                      long effectiveDate)
Return the amount of toCurrency that the given value of fromCurrency was worth on the given date.


dumpCurrencies

public void dumpCurrencies()

convertValueXXX

public long convertValueXXX(long value,
                            CurrencyType currentType,
                            CurrencyType newType)
Convert value in one currency to the same value in another currency.


getAllValues

public java.util.Enumeration getAllValues()

isDirty

public boolean isDirty()

createDefaultTable

public static CurrencyTable createDefaultTable(java.lang.String primaryCurrency)

createDefaultTable

public static CurrencyTable createDefaultTable(java.lang.String primaryCurrency,
                                               boolean singleCurrency)

sortCurrencyList

public static final void sortCurrencyList(CurrencyType[] list)