com.moneydance.apps.md.model
Class CapitalGainResult

java.lang.Object
  extended by com.moneydance.apps.md.model.CapitalGainResult

public class CapitalGainResult
extends java.lang.Object

Tracks the result of a capital gain computation, including both short term and long term gains. The class is immutable.

Author:
Kevin Menningen - Mennē Software Solutions, LLC

Constructor Summary
CapitalGainResult(long basis, long shortTermBasis, long longTermBasis, long shortTermShares, long longTermShares, long shortTermAvailShares, long longTermAvailShares, java.lang.String errorKey)
           
CapitalGainResult(java.lang.String errorKey)
          Constructor - invalid result with an error message.
 
Method Summary
 long getBasis()
           
 java.lang.String getErrorMessageKey()
           
 long getLongTermAvailableShares()
           
 long getLongTermBasis()
           
 long getLongTermShares()
           
 long getShortTermAvailableShares()
           
 long getShortTermBasis()
           
 long getShortTermShares()
           
 boolean isValid()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CapitalGainResult

public CapitalGainResult(java.lang.String errorKey)
Constructor - invalid result with an error message.

Parameters:
errorKey - Resource key for message to display to the user (localized).

CapitalGainResult

public CapitalGainResult(long basis,
                         long shortTermBasis,
                         long longTermBasis,
                         long shortTermShares,
                         long longTermShares,
                         long shortTermAvailShares,
                         long longTermAvailShares,
                         java.lang.String errorKey)
Parameters:
basis - Total combined basis for the sale transaction.
shortTermBasis - Short term gain basis - cost of short term portion of the sale.
longTermBasis - Long term gain basis - cost of long term portion of the sale.
shortTermShares - Number of short term shares sold.
longTermShares - Number of long term shares sold.
shortTermAvailShares - Total number of available short term shares.
longTermAvailShares - Total number of available long term shares.
errorKey - Resource key for message to display to the user (localized).
Method Detail

getBasis

public long getBasis()
Returns:
Total basis for the sale transaction, with long term and short term combined.

getShortTermBasis

public long getShortTermBasis()
Returns:
Short term gain basis - cost of short term portion of the sale.

getLongTermBasis

public long getLongTermBasis()
Returns:
Long term gain basis - cost of long term portion of the sale.

getShortTermShares

public long getShortTermShares()
Returns:
Number of short term shares sold.

getLongTermShares

public long getLongTermShares()
Returns:
Number of long term shares sold.

getShortTermAvailableShares

public long getShortTermAvailableShares()
Returns:
Total number of available short term shares. In other words, all shares purchased less than a year prior to the sale date.

getLongTermAvailableShares

public long getLongTermAvailableShares()
Returns:
Total number of available long term shares. In other words, all shares purchased more than a year prior to the sale date.

isValid

public boolean isValid()
Returns:
True if a valid capital gain was computed, false otherwise.

getErrorMessageKey

public java.lang.String getErrorMessageKey()
Returns:
Any error message associated with an invalid capital gain result.