Class CapitalGainResult
java.lang.Object
com.infinitekind.moneydance.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.
-
Constructor Summary
Constructors Constructor Description 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
Modifier and Type Method Description long
getBasis()
java.lang.String
getErrorMessageKey()
long
getLongTermAvailableShares()
long
getLongTermBasis()
long
getLongTermShares()
long
getShortTermAvailableShares()
long
getShortTermBasis()
long
getShortTermShares()
boolean
isValid()
java.lang.String
toString()
-
Constructor Details
-
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 Details
-
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.
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-