Class TransactionSet
- java.lang.Object
-
- com.infinitekind.moneydance.model.TransactionSet
-
- All Implemented Interfaces:
java.lang.Iterable<AbstractTxn>
public class TransactionSet extends java.lang.Object implements java.lang.Iterable<AbstractTxn>
The set of transactions that are associated with a data file or RootAccount
-
-
Constructor Summary
Constructors Constructor Description TransactionSet(AccountBook book)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addNewTxn(ParentTxn t)
Add a new transaction to the transaction set.void
addTransactionListener(TransactionListener listener)
Register an object that would like to receive notification when transactions have been modified, added, or removed.ParentTxn
findBestMatch(java.lang.String payee, long amount, Account acct)
Find the most recent transaction that has the closest payee to the given value.TxnSet
getAllTxns()
Return a TxnSet containing all of the transactionsjava.util.List<Txn>
getListOfTxnNodes(TxnSearch search)
Returns a list of Txn objects, which are the nodes that affect each account.long
getTransactionCount()
TxnSet
getTransactions(TxnSearch filter)
java.util.Collection<AbstractTxn>
getTransactions(TxnSearch filter, java.util.Collection<AbstractTxn> ts)
Puts all transactions matching the given filter into the provided collection.TxnSet
getTransactionsForAccount(Account acct)
Get all of the transactions that are in the specified accountAbstractTxn
getTxnByID(java.lang.String txnID)
AbstractTxn
getTxnByLegacyID(long txnID)
java.util.List<AbstractTxn>
getTxnsForAccount(Account acct)
Get all of the transactions that are in the specified accountboolean
hasTxnsForAccount(Account acct)
boolean
isDirty()
java.lang.Iterable<AbstractTxn>
iterableTxns()
Return a reference to an iterable list of transactions.java.util.Iterator<AbstractTxn>
iterator()
Return an Enumeration containing all of the transactions.void
loadTxn(ParentTxn t)
Add the specified transaction to the txn set.ParentTxn[]
matchPayee(Account account, java.lang.String description, boolean caseSensitive, int numMatches)
Return the most recently entered 'numMatches' transactions that match the given description.SplitTxn[]
matchSplitPayee(Account account, java.lang.String description, boolean caseSensitive, int numMatches)
Return the most recently entered 'numMatches' split transactions that match the given description.void
removeAll()
Good gravy, don't call this.void
removeTransactionListener(TransactionListener listener)
void
removeTxn(AbstractTxn txn)
Remove the specified transaction.void
resetDirtyFlags()
void
setDirty()
void
txnModified(AbstractTxn t)
Record that the specified transaction has been modified, notifying all listeners that this txn and all of its splits have been modified.
-
-
-
Constructor Detail
-
TransactionSet
public TransactionSet(AccountBook book)
-
-
Method Detail
-
setDirty
public void setDirty()
-
isDirty
public boolean isDirty()
-
resetDirtyFlags
public void resetDirtyFlags()
-
loadTxn
public void loadTxn(ParentTxn t)
Add the specified transaction to the txn set. This should only be called when loading transactions into the set from a file or database. This should *NOT* be called by normal code to add a transaction.
-
addNewTxn
public void addNewTxn(ParentTxn t)
Add a new transaction to the transaction set. If this is a ParentTxn, all of it's associated SplitTxns are also added to the set.
-
removeTxn
public void removeTxn(AbstractTxn txn)
Remove the specified transaction. This is new as of build 600. Before build 600 this only accepted a ParentTxn
-
txnModified
public void txnModified(AbstractTxn t)
Record that the specified transaction has been modified, notifying all listeners that this txn and all of its splits have been modified.
-
addTransactionListener
public void addTransactionListener(TransactionListener listener)
Register an object that would like to receive notification when transactions have been modified, added, or removed.
-
removeTransactionListener
public void removeTransactionListener(TransactionListener listener)
-
iterator
public java.util.Iterator<AbstractTxn> iterator()
Return an Enumeration containing all of the transactions. Callers should synchronize on this TransactionSet while iterating to avoid ConcurrentModificationExceptions when the background syncing changes the set of transactions.- Specified by:
iterator
in interfacejava.lang.Iterable<AbstractTxn>
-
iterableTxns
public java.lang.Iterable<AbstractTxn> iterableTxns()
Return a reference to an iterable list of transactions. Please note that anything calling this should synchronize on this TransactionSet while the iteration is in progress to avoid concurrency exceptions
-
getAllTxns
public TxnSet getAllTxns()
Return a TxnSet containing all of the transactions
-
getTransactionCount
public long getTransactionCount()
-
findBestMatch
public ParentTxn findBestMatch(java.lang.String payee, long amount, Account acct)
Find the most recent transaction that has the closest payee to the given value. If no transactions are a close enough match, return null. This currently only scans parent transactions.
-
getTxnByID
public final AbstractTxn getTxnByID(java.lang.String txnID)
-
getTxnByLegacyID
public final AbstractTxn getTxnByLegacyID(long txnID)
-
hasTxnsForAccount
public final boolean hasTxnsForAccount(Account acct)
-
getTransactions
public java.util.Collection<AbstractTxn> getTransactions(TxnSearch filter, java.util.Collection<AbstractTxn> ts)
Puts all transactions matching the given filter into the provided collection. Returns the same collection, for your convenience.- Since:
- build 1200
-
getTransactionsForAccount
public TxnSet getTransactionsForAccount(Account acct)
Get all of the transactions that are in the specified account
-
getTxnsForAccount
public java.util.List<AbstractTxn> getTxnsForAccount(Account acct)
Get all of the transactions that are in the specified account
-
matchSplitPayee
public SplitTxn[] matchSplitPayee(Account account, java.lang.String description, boolean caseSensitive, int numMatches)
Return the most recently entered 'numMatches' split transactions that match the given description. If the caseSensitive flag is true then the matching transactions must start with the exact string in description.
-
matchPayee
public ParentTxn[] matchPayee(Account account, java.lang.String description, boolean caseSensitive, int numMatches)
Return the most recently entered 'numMatches' transactions that match the given description. If the caseSensitive flag is true then the matching transactions must start with the exact string in description.
-
removeAll
public void removeAll()
Good gravy, don't call this. Are you MAD???
-
-