Class CurrencyTable
- java.lang.Object
-
- com.infinitekind.moneydance.model.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 Summary
Constructors Constructor Description CurrencyTable(AccountBook book)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCurrencyListener(CurrencyListener listener)
void
addCurrencyType(CurrencyType newType)
void
addCurrencyType(CurrencyType newType, boolean isLoading)
Add the given currency to the table.boolean
contains(CurrencyType curr)
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, int 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.void
dumpCurrencies()
void
fireCurrencyTableModified()
java.util.List<CurrencyType>
getAllCurrencies()
CurrencyType
getBaseType()
AccountBook
getBook()
CurrencyType
getCurrencyByID(int id)
CurrencyType
getCurrencyByIDString(java.lang.String typeID)
CurrencyType
getCurrencyByName(java.lang.String name)
CurrencyType
getCurrencyByTickerSymbol(java.lang.String ticker)
CurrencyType
getCurrencyByUUID(java.lang.String uuid)
long
getCurrencyCount()
CurrencyType
getFallbackCurrency()
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.double
getRelativePriceInt(CurrencyType curr1, CurrencyType curr2, int date)
Get the price (going rate) for currency curr1 in terms of curr2 on the given date.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.boolean
isDirty()
java.util.Iterator<CurrencyType>
iterator()
void
removeCurrencyListener(CurrencyListener listener)
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.
-
-
-
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 interfacejava.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!!!
-
getBaseType
public CurrencyType getBaseType()
-
getBook
public AccountBook getBook()
-
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.
-
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, 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()
-
-