jgnash.engine
Class AbstractInvestmentTransactionEntry

java.lang.Object
  extended by jgnash.engine.TransactionEntry
      extended by jgnash.engine.AbstractInvestmentTransactionEntry
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable<TransactionEntry>
Direct Known Subclasses:
TransactionEntryAbstractIncrease, TransactionEntryBuyX, TransactionEntryDividendX, TransactionEntryMergeX, TransactionEntryRemoveX, TransactionEntryRocX, TransactionEntrySellX

public abstract class AbstractInvestmentTransactionEntry
extends TransactionEntry

Investment Transaction Entry

Version:
$Id$
Author:
Craig Cavanaugh

Field Summary
private  java.math.BigDecimal price
          share price
private  java.math.BigDecimal quantity
          number of shares
private  SecurityNode securityNode
          Security for this entry
 
Constructor Summary
AbstractInvestmentTransactionEntry()
          Creates a new instance of InvestmentTransactionEntry
 
Method Summary
 java.math.BigDecimal getPrice()
           
 java.math.BigDecimal getQuantity()
          Returns the number of shares assigned to this transaction.
 SecurityNode getSecurityNode()
           
abstract  java.math.BigDecimal getSignedQuantity()
          Returns the number of shares as it would impact the sum of the investment accounts shares.
 java.math.BigDecimal getTotal()
          Calculates the total of the value of the shares, gains, fees, etc.
abstract  TransactionType getTransactionType()
          Returns the type of this transaction entry
(package private)  void setPrice(java.math.BigDecimal price)
           
(package private)  void setQuantity(java.math.BigDecimal quantity)
          Assigns the number of shares for this transaction.
(package private)  void setSecurityNode(SecurityNode securityNode)
           
 java.lang.String toString()
           
 
Methods inherited from class jgnash.engine.TransactionEntry
clone, compareTo, equals, equals, getAmount, getCreditAccount, getCreditAmount, getCreditReconciled, getDebitAccount, getDebitAmount, getDebitReconciled, getMemo, getReconciled, getTransactionTag, hashCode, isSingleEntry, setAmount, setCreditAccount, setCreditAmount, setCreditReconciled, setDebitAccount, setDebitAmount, setDebitReconciled, setMemo, setReconciled, setTransactionTag
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

securityNode

private SecurityNode securityNode
Security for this entry


price

private java.math.BigDecimal price
share price


quantity

private java.math.BigDecimal quantity
number of shares

Constructor Detail

AbstractInvestmentTransactionEntry

AbstractInvestmentTransactionEntry()
Creates a new instance of InvestmentTransactionEntry

Method Detail

getTotal

public java.math.BigDecimal getTotal()
Calculates the total of the value of the shares, gains, fees, etc. as it pertains to an account.

Not intended for use to calculate account balances

Returns:
total resulting total for this entry
See Also:
InvestmentTransaction.getTotal(jgnash.engine.Account)

getSecurityNode

public SecurityNode getSecurityNode()

setSecurityNode

void setSecurityNode(SecurityNode securityNode)

getPrice

public java.math.BigDecimal getPrice()

setPrice

void setPrice(java.math.BigDecimal price)

setQuantity

void setQuantity(java.math.BigDecimal quantity)
Assigns the number of shares for this transaction. The value should be always be a positive value.

Parameters:
quantity - the quantity of securities to assign to this account
See Also:
getSignedQuantity()

getQuantity

public java.math.BigDecimal getQuantity()
Returns the number of shares assigned to this transaction.

Returns:
the quantity of securities for this transaction
See Also:
getSignedQuantity()

getSignedQuantity

public abstract java.math.BigDecimal getSignedQuantity()
Returns the number of shares as it would impact the sum of the investment accounts shares. Useful for summing share quantities

Returns:
the quantity of securities for this transaction

getTransactionType

public abstract TransactionType getTransactionType()
Returns the type of this transaction entry

Returns:
the transaction type

toString

public java.lang.String toString()
Overrides:
toString in class TransactionEntry