remove dead code

This commit is contained in:
Simon Michael 2008-10-09 13:16:57 +00:00
parent 11342db662
commit 81ac9bcaa5

View File

@ -2,10 +2,9 @@
A 'Ledger' stores, for efficiency, a 'RawLedger' plus its tree of account A 'Ledger' stores, for efficiency, a 'RawLedger' plus its tree of account
names, a map from account names to 'Account's, and the display precision. names, a map from account names to 'Account's, and the display precision.
Typically it has also has had the uninteresting 'Entry's and Typically it has also has had the uninteresting 'Entry's filtered out.
'Transaction's filtered out. In addition, it stores the account filter pattern and a second set of fields
providing the filtered entries & transactions.
Also, the account filter pattern is stored.
-} -}
@ -97,8 +96,6 @@ cacheLedger acctpat l =
-- patterns. -- patterns.
filterLedgerEntries :: String -> String -> Regex -> Regex -> RawLedger -> RawLedger filterLedgerEntries :: String -> String -> Regex -> Regex -> RawLedger -> RawLedger
filterLedgerEntries begin end acctpat descpat = filterLedgerEntries begin end acctpat descpat =
-- strace .
-- filterLedgerEntriesByTransactionAccount acctpat .
filterLedgerEntriesByDate begin end . filterLedgerEntriesByDate begin end .
filterLedgerEntriesByDescription descpat filterLedgerEntriesByDescription descpat
@ -127,38 +124,6 @@ filterLedgerEntriesByDate begin end (RawLedger ms ps es f) =
enddate = parsedate end enddate = parsedate end
entrydate = parsedate $ edate e entrydate = parsedate $ edate e
-- | Keep only entries which have at least one transaction with an account
-- whose (leaf) name matches the pattern.
filterLedgerEntriesByTransactionAccount :: Regex -> RawLedger -> RawLedger
filterLedgerEntriesByTransactionAccount acctpat l@(RawLedger _ _ es _) =
l{entries=filter matchentry es}
where
matchentry = any matchtxn . etransactions
matchtxn = containsRegex acctpat . accountLeafName . taccount
-- -- | Remove entries which have no transactions.
-- filterEmptyLedgerEntries :: RawLedger -> RawLedger
-- filterEmptyLedgerEntries (RawLedger ms ps es f) =
-- RawLedger ms ps (filter (not . null . etransactions) es) f
-- -- | In each ledger entry, filter out transactions which do not match the
-- -- matcher. Entries are no longer balanced after this.
-- filterLedgerTransactionsBy :: (RawTransaction -> Bool) -> RawLedger -> RawLedger
-- filterLedgerTransactionsBy matcher (RawLedger ms ps es f) =
-- RawLedger ms ps (map filterentrytxns es) f
-- where
-- filterentrytxns e@(Entry _ _ _ _ _ ts _) = e{etransactions=filter matcher ts}
matchtxnacctname :: Regex -> RawTransaction -> Bool
matchtxnacctname acctpat t = case matchRegex acctpat (taccount t) of
Nothing -> False
otherwise -> True
matchtxnleafname :: Regex -> RawTransaction -> Bool
matchtxnleafname acctpat t = case matchRegex acctpat (accountLeafName $ taccount t) of
Nothing -> False
otherwise -> True
-- | List a 'Ledger' 's account names. -- | List a 'Ledger' 's account names.
accountnames :: Ledger -> [AccountName] accountnames :: Ledger -> [AccountName]
accountnames l = drop 1 $ flatten $ accountnametree l accountnames l = drop 1 $ flatten $ accountnametree l
@ -340,7 +305,7 @@ showAccountTree l maxdepth = showAccountTree' l maxdepth 0 ""
showAccountTree' :: Ledger -> Int -> Int -> String -> Tree Account -> String showAccountTree' :: Ledger -> Int -> Int -> String -> Tree Account -> String
showAccountTree' l maxdepth indentlevel prefix t showAccountTree' l maxdepth indentlevel prefix t
-- prefix boring inner account names to the next line -- merge boring inner account names with the next line
| isBoringInnerAccount l maxdepth acct = subsindented 0 (fullname++":") | isBoringInnerAccount l maxdepth acct = subsindented 0 (fullname++":")
-- ditto with unmatched parent accounts when filtering by account -- ditto with unmatched parent accounts when filtering by account
| filtering && doesnotmatch = subsindented 0 (fullname++":") | filtering && doesnotmatch = subsindented 0 (fullname++":")
@ -377,13 +342,3 @@ isBoringInnerAccount l maxdepth a
isBoringInnerAccountName :: Ledger -> Int -> AccountName -> Bool isBoringInnerAccountName :: Ledger -> Int -> AccountName -> Bool
isBoringInnerAccountName l maxdepth = isBoringInnerAccount l maxdepth . ledgerAccount l isBoringInnerAccountName l maxdepth = isBoringInnerAccount l maxdepth . ledgerAccount l
-- | Remove boring branches (and leaves) from a tree of accounts.
-- A boring branch contains only accounts which have a 0 balance or no
-- transactions.
-- pruneBoringBranches :: Tree Account -> Tree Account
-- pruneBoringBranches =
-- treefilter hastxns . treefilter hasbalance
-- where
-- hasbalance = (/= 0) . abalance
-- hastxns = (> 0) . length . atransactions