jgnash.engine
Class AccountProxy

java.lang.Object
  extended by jgnash.engine.AccountProxy
Direct Known Subclasses:
EquityAccountProxy, InvestmentAccountProxy

public class AccountProxy
extends java.lang.Object

Proxy class to locate account balance behaviors. Depending on account type, summation of transaction types are handled differently.

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
(package private)  Account account
           
 
Constructor Summary
AccountProxy(Account account)
           
 
Method Summary
 java.math.BigDecimal getBalance()
           
 java.math.BigDecimal getBalance(java.util.Date date)
          Returns the account balance up to and inclusive of the supplied date
 java.math.BigDecimal getBalance(java.util.Date start, java.util.Date end)
          Returns the balance of the transactions inclusive of the start and end dates.
 java.math.BigDecimal getBalanceAt(int index)
          Get the account balance up to a specified index.
 java.math.BigDecimal getCashBalance()
          Returns the cash balance of this account
 java.math.BigDecimal getCashBalance(java.util.Date end)
          Returns the cash account balance up to and inclusive of the supplied date
 java.math.BigDecimal getCashBalance(java.util.Date start, java.util.Date end)
          Returns the balance of the transactions inclusive of the start and end dates.
 java.math.BigDecimal getMarketPrice(SecurityNode node, java.util.Date date)
          Returns a market price for the commodity that is closest to the supplied date without exceeding it.
 java.math.BigDecimal getMarketValue()
          Returns the market value of this account
 java.math.BigDecimal getMarketValue(java.util.Date date)
          Returns the market value of the account at a specified date.
 java.math.BigDecimal getMarketValue(java.util.Date start, java.util.Date end)
          Returns the market value for an account
 java.math.BigDecimal getOpeningBalanceForReconcile()
          Get the default opening balance for reconciling the account
 java.math.BigDecimal getReconciledBalance()
          Calculates the reconciled balance of the account
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

account

final Account account
Constructor Detail

AccountProxy

AccountProxy(Account account)
Method Detail

getBalance

public java.math.BigDecimal getBalance()

getBalanceAt

public java.math.BigDecimal getBalanceAt(int index)
Get the account balance up to a specified index.

Parameters:
index - the balance of this account at the specified index.
Returns:
the balance of this account at the specified index.

getBalance

public java.math.BigDecimal getBalance(java.util.Date start,
                                       java.util.Date end)
Returns the balance of the transactions inclusive of the start and end dates.

Parameters:
start - The inclusive start date
end - The inclusive end date
Returns:
The ending balance

getBalance

public java.math.BigDecimal getBalance(java.util.Date date)
Returns the account balance up to and inclusive of the supplied date

Parameters:
date - The inclusive ending date
Returns:
The ending balance

getCashBalance

public java.math.BigDecimal getCashBalance()
Returns the cash balance of this account

Returns:
exception thrown

getCashBalance

public java.math.BigDecimal getCashBalance(java.util.Date end)
Returns the cash account balance up to and inclusive of the supplied date

Parameters:
end - The inclusive ending date
Returns:
The ending cash balance

getCashBalance

public java.math.BigDecimal getCashBalance(java.util.Date start,
                                           java.util.Date end)
Returns the balance of the transactions inclusive of the start and end dates.

The balance includes the cash transactions and is based on current market value.

Parameters:
start - The inclusive start date
end - The inclusive end date
Returns:
The ending balance

getMarketPrice

public java.math.BigDecimal getMarketPrice(SecurityNode node,
                                           java.util.Date date)
Returns a market price for the commodity that is closest to the supplied date without exceeding it.

Parameters:
node - commodity to search against
date - date to search against
Returns:
share price

getMarketValue

public java.math.BigDecimal getMarketValue()
Returns the market value of this account

Returns:
exception thrown

getMarketValue

public java.math.BigDecimal getMarketValue(java.util.Date date)
Returns the market value of the account at a specified date. The closest market price is used and only investment transactions earlier and inclusive of the specified date are considered.

Parameters:
date - the end date to calculate the market value
Returns:
the ending balance

getMarketValue

public java.math.BigDecimal getMarketValue(java.util.Date start,
                                           java.util.Date end)
Returns the market value for an account

Parameters:
start - inclusive start date
end - inclusive end date
Returns:
market value

getReconciledBalance

public java.math.BigDecimal getReconciledBalance()
Calculates the reconciled balance of the account

Returns:
the reconciled balance of this account

getOpeningBalanceForReconcile

public java.math.BigDecimal getOpeningBalanceForReconcile()
Get the default opening balance for reconciling the account

Returns:
Opening balance for reconciling the account