Class CurrencyTable

  • All Implemented Interfaces:
    java.lang.Iterable<CurrencyType>

    public class CurrencyTable
    extends java.lang.Object
    implements java.lang.Iterable<CurrencyType>
    A table containing the set of currencies in a moneydance data set
    • Constructor Detail

      • CurrencyTable

        public CurrencyTable​(AccountBook book)
    • Method Detail

      • addCurrencyListener

        public void addCurrencyListener​(CurrencyListener listener)
      • removeCurrencyListener

        public void removeCurrencyListener​(CurrencyListener listener)
      • iterator

        public java.util.Iterator<CurrencyType> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<CurrencyType>
      • 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!!!
      • getFallbackCurrency

        public CurrencyType getFallbackCurrency()
      • contains

        public final boolean contains​(CurrencyType curr)
      • setBaseType

        public void setBaseType​(CurrencyType newBaseType)
      • getCurrencyByUUID

        public CurrencyType getCurrencyByUUID​(java.lang.String uuid)
      • 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)
      • addCurrencyType

        public void addCurrencyType​(CurrencyType newType,
                                    boolean isLoading)
        Add the given currency to the table. Do not specify isLoading=true.
      • getCurrencyCount

        public long getCurrencyCount()
      • getUniqueCurrId

        public java.lang.String getUniqueCurrId​(java.lang.String ticker)
      • resetDirtyFlags

        public void resetDirtyFlags()
      • 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.
      • 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.
      • 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,
                                              int 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.
      • getAllCurrencies

        public java.util.List<CurrencyType> getAllCurrencies()
      • isDirty

        public boolean isDirty()