jgnash.engine
Class InvestmentAccountProxy

java.lang.Object
  extended by jgnash.engine.AccountProxy
      extended by jgnash.engine.InvestmentAccountProxy

public class InvestmentAccountProxy
extends AccountProxy

Investment Account Proxy class

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
 
Fields inherited from class jgnash.engine.AccountProxy
account
 
Constructor Summary
InvestmentAccountProxy(Account account)
           
 
Method Summary
 java.math.BigDecimal getBalance()
          Returns the cash balance plus the market value of the shares
 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 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.
private  java.math.BigDecimal getCashBalanceAt(int index)
          Get the account's cash balance up to a specified index.
 java.math.BigDecimal getMarketPrice(SecurityNode node, java.util.Date date)
          Returns a market price for the supplied SecurityNode 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
private  java.math.BigDecimal getMarketValueAt(int index)
          Calculates the accounts market value based on the latest security price
 java.math.BigDecimal getOpeningBalanceForReconcile()
          Get the default opening balance for reconciling the account
 java.math.BigDecimal getReconciledBalance()
          Calculates the reconciled balance of the account
private  java.math.BigDecimal getReconciledMarketValue()
           
 
Methods inherited from class jgnash.engine.AccountProxy
getBalanceAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InvestmentAccountProxy

public InvestmentAccountProxy(Account account)
Method Detail

getBalance

public java.math.BigDecimal getBalance(java.util.Date start,
                                       java.util.Date end)
Description copied from class: AccountProxy
Returns the balance of the transactions inclusive of the start and end dates.

Overrides:
getBalance in class AccountProxy
Parameters:
start - The inclusive start date
end - The inclusive end date
Returns:
The ending balance

getBalance

public java.math.BigDecimal getBalance()
Returns the cash balance plus the market value of the shares

Overrides:
getBalance in class AccountProxy
Returns:
cash balance

getBalance

public java.math.BigDecimal getBalance(java.util.Date date)
Description copied from class: AccountProxy
Returns the account balance up to and inclusive of the supplied date

Overrides:
getBalance in class AccountProxy
Parameters:
date - The inclusive ending date
Returns:
The ending balance

getCashBalance

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

Overrides:
getCashBalance in class AccountProxy
Returns:
exception thrown

getCashBalanceAt

private java.math.BigDecimal getCashBalanceAt(int index)
Get the account's cash balance up to a specified index.

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

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 the current market value.

Overrides:
getCashBalance in class AccountProxy
Parameters:
start - The inclusive start date
end - The inclusive end date
Returns:
The ending balance

getCashBalance

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

Overrides:
getCashBalance in class AccountProxy
Parameters:
end - The inclusive ending date
Returns:
The ending cash balance

getMarketPrice

public java.math.BigDecimal getMarketPrice(SecurityNode node,
                                           java.util.Date date)
Returns a market price for the supplied SecurityNode that is closest to the supplied date without exceeding it. The history of the SecurityNode is searched as well as the account's transaction history to find the closest market price without exceeding the supplied date.

Overrides:
getMarketPrice in class AccountProxy
Parameters:
node - security to search against
date - date to search against
Returns:
market price

getMarketValue

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

Overrides:
getMarketValue in class AccountProxy
Returns:
the market value of the account

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.

Overrides:
getMarketValue in class AccountProxy
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)
Description copied from class: AccountProxy
Returns the market value for an account

Overrides:
getMarketValue in class AccountProxy
Parameters:
start - inclusive start date
end - inclusive end date
Returns:
market value

getMarketValueAt

private java.math.BigDecimal getMarketValueAt(int index)
Calculates the accounts market value based on the latest security price

Parameters:
index - index to calculate the balance to
Returns:
market value

getReconciledMarketValue

private java.math.BigDecimal getReconciledMarketValue()

getReconciledBalance

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

Overrides:
getReconciledBalance in class AccountProxy
Returns:
the reconciled balance of this account

getOpeningBalanceForReconcile

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

Overrides:
getOpeningBalanceForReconcile in class AccountProxy
Returns:
Opening balance for reconciling the account