Venice 0.751beta

nz.org.venice.portfolio
Class CashAccount

java.lang.Object
  extended bynz.org.venice.portfolio.AbstractAccount
      extended bynz.org.venice.portfolio.CashAccount
All Implemented Interfaces:
Account, java.lang.Cloneable, java.lang.Comparable

public class CashAccount
extends AbstractAccount
implements java.lang.Cloneable

Representation of a cash account in a portfolio.

Author:
Andrew Leppard

Field Summary
 
Fields inherited from interface nz.org.venice.portfolio.Account
CASH_ACCOUNT, SHARE_ACCOUNT
 
Constructor Summary
CashAccount(java.lang.String name)
          Create a new cash account with the default currency.
CashAccount(java.lang.String name, Currency currency)
          Create a new cash account with the given currency.
 
Method Summary
 java.lang.Object clone()
          Create a clone of this account.
 boolean equals(java.lang.Object object)
          Compares this cash account to another.
 Currency getCurrency()
          Return the currency of the account.
 java.lang.String getName()
          Return the name of this account.
 int getType()
          Return the type of this account.
 Money getValue()
          Return the value of this account.
 Money getValue(EODQuoteBundle quoteBundle, int dateOffset)
          Return the value of this account on the given day.
 Money getValue(EODQuoteBundle quoteBundle, TradingDate date)
          Return the value of this account on the given day.
 void removeAllTransactions()
          Remove all transactions from account.
 void transaction(Transaction transaction)
          Perform a transaction on this account.
 
Methods inherited from class nz.org.venice.portfolio.AbstractAccount
compareTo
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CashAccount

public CashAccount(java.lang.String name,
                   Currency currency)
Create a new cash account with the given currency.

Parameters:
name - the name of the new cash account
currency - the currency of the cash account

CashAccount

public CashAccount(java.lang.String name)
Create a new cash account with the default currency.

Parameters:
name - the name of the new cash account
Method Detail

transaction

public void transaction(Transaction transaction)
Description copied from interface: Account
Perform a transaction on this account.

Specified by:
transaction in interface Account
Parameters:
transaction - transaction to occur

clone

public java.lang.Object clone()
Create a clone of this account.

Returns:
the clone

equals

public boolean equals(java.lang.Object object)
Compares this cash account to another.

Parameters:
object - another cash account
Returns:
true if the cash accounts are equal; false otherwise

getName

public java.lang.String getName()
Description copied from interface: Account
Return the name of this account.

Specified by:
getName in interface Account
Returns:
name of the account

getValue

public Money getValue(EODQuoteBundle quoteBundle,
                      int dateOffset)
Description copied from interface: Account
Return the value of this account on the given day.

Specified by:
getValue in interface Account
Parameters:
quoteBundle - the quote bundle
dateOffset - fast date offset

getValue

public Money getValue(EODQuoteBundle quoteBundle,
                      TradingDate date)
Description copied from interface: Account
Return the value of this account on the given day.

Specified by:
getValue in interface Account
Parameters:
quoteBundle - the quote bundle
date - the date

getValue

public Money getValue()
Return the value of this account. Since the value does not depend on any stock price, the cache and date can be omitted.


getCurrency

public Currency getCurrency()
Description copied from interface: Account
Return the currency of the account.

Specified by:
getCurrency in interface Account
Returns:
default currency.

removeAllTransactions

public void removeAllTransactions()
Description copied from interface: Account
Remove all transactions from account.

Specified by:
removeAllTransactions in interface Account

getType

public int getType()
Description copied from interface: Account
Return the type of this account.

Specified by:
getType in interface Account
Returns:
type of the account, either Account.CASH_ACCOUNT or Account.SHARE_ACCOUNT

Venice 0.751beta