com.moneydance.apps.md.model
Class BudgetItem

java.lang.Object
  extended by com.moneydance.apps.md.model.BudgetItem
All Implemented Interfaces:
java.lang.Comparable

public final class BudgetItem
extends java.lang.Object
implements java.lang.Comparable

Represents one item in a budget


Field Summary
static int INDEFINITE_END_DATE
           
static int INTERVAL_ANNUALLY
           
static int INTERVAL_BI_MONTHLY
           
static int INTERVAL_BI_WEEKLY
           
static int INTERVAL_DAILY
           
static int INTERVAL_MONTHLY
           
static int INTERVAL_NO_REPEAT
           
static int INTERVAL_ONCE_ANNUALLY
           
static int INTERVAL_ONCE_BI_MONTHLY
           
static int INTERVAL_ONCE_BI_WEEKLY
           
static int INTERVAL_ONCE_MONTHLY
           
static int INTERVAL_ONCE_SEMI_ANNUALLY
           
static int INTERVAL_ONCE_SEMI_MONTHLY
           
static int INTERVAL_ONCE_TRI_MONTHLY
           
static int INTERVAL_ONCE_TRI_WEEKLY
           
static int INTERVAL_ONCE_WEEKLY
           
static int INTERVAL_SEMI_ANNUALLY
           
static int INTERVAL_SEMI_MONTHLY
           
static int INTERVAL_TRI_MONTHLY
           
static int INTERVAL_TRI_WEEKLY
           
static int INTERVAL_WEEKLY
           
 
Method Summary
 int compareTo(java.lang.Object itemObj)
           
 boolean conflictsWith(Account acct, Account category, int interval, int intervalStart, int intervalEnd)
          Returns true if the given budget item information overlaps with the budget item specified by this object.
 boolean containsDate(int asOfDate)
          Determine if the given date is within the overall date range of the budget item.
 Account getAccount()
          Returns the specific account, if any, to or from which funds will be moved.
 long getAmount()
          Returns the amount that was budgeted, specified in the currency of the transfer account.
 long getBudgetImpact(AbstractTxn txn)
          Returns the amount that the given transaction has on this budget item, if any.
 CurrencyType getCurrency()
          Returns the currency that applies to this budget item.
 int getInterval()
          Returns the type of repeating interval.
 int getIntervalEnd(int asOfDate)
          Returns the last date of the interval that contains the given date.
 int getIntervalEndDate()
          Returns the ending date for the last interval, if any.
 float getIntervalProration(int asOfDate)
          Return a float from zero to 1 indicating how far through the interval the current date is.
 float getIntervalProration(int startDate, int endDate)
          Return a non-negative float value indicating how much the amount of this budget item should be multiplied by in order to get the budgeted amount for the given period.
 int getIntervalStart(int asOfDate)
          Returns the beginning date of the interval that contains the given date.
 int getIntervalStartDate()
          Returns the starting date for the first interval
 Account getTransferAccount()
          Returns the specific category or account from or to which funds will be moved.
 boolean isIncome()
          Return true if this item is considered an income
 void setAccount(Account acct)
          Sets the specific account, if any, to or from which funds will be moved.
 void setAmount(long amount)
          Sets the amount that was budgeted, specified in the currency of the transfer account.
 void setInterval(int interval)
          Sets the type of repeating interval.
 void setIntervalEndDate(int intervalEnd)
          Sets the ending date for the last interval, if any.
 void setIntervalStartDate(int intervalStart)
          Sets the starting date for the first interval
 void setTransferAccount(Account category)
          Sets the specific category or account from or to which funds will be moved.
 java.lang.String toString()
           
 java.lang.String toString(CustomDateFormat dateFmt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INTERVAL_NO_REPEAT

public static final int INTERVAL_NO_REPEAT
See Also:
Constant Field Values

INTERVAL_DAILY

public static final int INTERVAL_DAILY
See Also:
Constant Field Values

INTERVAL_WEEKLY

public static final int INTERVAL_WEEKLY
See Also:
Constant Field Values

INTERVAL_BI_WEEKLY

public static final int INTERVAL_BI_WEEKLY
See Also:
Constant Field Values

INTERVAL_TRI_WEEKLY

public static final int INTERVAL_TRI_WEEKLY
See Also:
Constant Field Values

INTERVAL_SEMI_MONTHLY

public static final int INTERVAL_SEMI_MONTHLY
See Also:
Constant Field Values

INTERVAL_MONTHLY

public static final int INTERVAL_MONTHLY
See Also:
Constant Field Values

INTERVAL_BI_MONTHLY

public static final int INTERVAL_BI_MONTHLY
See Also:
Constant Field Values

INTERVAL_TRI_MONTHLY

public static final int INTERVAL_TRI_MONTHLY
See Also:
Constant Field Values

INTERVAL_SEMI_ANNUALLY

public static final int INTERVAL_SEMI_ANNUALLY
See Also:
Constant Field Values

INTERVAL_ANNUALLY

public static final int INTERVAL_ANNUALLY
See Also:
Constant Field Values

INTERVAL_ONCE_WEEKLY

public static final int INTERVAL_ONCE_WEEKLY
See Also:
Constant Field Values

INTERVAL_ONCE_BI_WEEKLY

public static final int INTERVAL_ONCE_BI_WEEKLY
See Also:
Constant Field Values

INTERVAL_ONCE_TRI_WEEKLY

public static final int INTERVAL_ONCE_TRI_WEEKLY
See Also:
Constant Field Values

INTERVAL_ONCE_SEMI_MONTHLY

public static final int INTERVAL_ONCE_SEMI_MONTHLY
See Also:
Constant Field Values

INTERVAL_ONCE_MONTHLY

public static final int INTERVAL_ONCE_MONTHLY
See Also:
Constant Field Values

INTERVAL_ONCE_BI_MONTHLY

public static final int INTERVAL_ONCE_BI_MONTHLY
See Also:
Constant Field Values

INTERVAL_ONCE_TRI_MONTHLY

public static final int INTERVAL_ONCE_TRI_MONTHLY
See Also:
Constant Field Values

INTERVAL_ONCE_SEMI_ANNUALLY

public static final int INTERVAL_ONCE_SEMI_ANNUALLY
See Also:
Constant Field Values

INTERVAL_ONCE_ANNUALLY

public static final int INTERVAL_ONCE_ANNUALLY
See Also:
Constant Field Values

INDEFINITE_END_DATE

public static final int INDEFINITE_END_DATE
See Also:
Constant Field Values
Method Detail

conflictsWith

public boolean conflictsWith(Account acct,
                             Account category,
                             int interval,
                             int intervalStart,
                             int intervalEnd)
Returns true if the given budget item information overlaps with the budget item specified by this object.


getCurrency

public CurrencyType getCurrency()
Returns the currency that applies to this budget item. Basically just the currency of the transfer account, or the currency of the account if there is no transfer account. If there is account or transfer account then this returns null.


getAccount

public Account getAccount()
Returns the specific account, if any, to or from which funds will be moved. If this is null, then the budgeted amount applies to all transfers to or from the transfer account.


setAccount

public void setAccount(Account acct)
Sets the specific account, if any, to or from which funds will be moved. If this is null, then the budgeted amount applies to all transfers to or from the transfer account.


getBudgetImpact

public long getBudgetImpact(AbstractTxn txn)
Returns the amount that the given transaction has on this budget item, if any.


getIntervalStart

public int getIntervalStart(int asOfDate)
Returns the beginning date of the interval that contains the given date. If the given date does not fall within the range for this item then return zero.


compareTo

public int compareTo(java.lang.Object itemObj)
Specified by:
compareTo in interface java.lang.Comparable

containsDate

public boolean containsDate(int asOfDate)
Determine if the given date is within the overall date range of the budget item.

Parameters:
asOfDate - The integer date to test.
Returns:
True if the item is in date, false if it falls outside of the items date range.

getIntervalEnd

public int getIntervalEnd(int asOfDate)
Returns the last date of the interval that contains the given date. If the given date does not fall within the range for this item then return zero.


getIntervalProration

public float getIntervalProration(int startDate,
                                  int endDate)
Return a non-negative float value indicating how much the amount of this budget item should be multiplied by in order to get the budgeted amount for the given period.


getIntervalProration

public float getIntervalProration(int asOfDate)
Return a float from zero to 1 indicating how far through the interval the current date is.


getTransferAccount

public Account getTransferAccount()
Returns the specific category or account from or to which funds will be moved.


isIncome

public boolean isIncome()
Return true if this item is considered an income


setTransferAccount

public void setTransferAccount(Account category)
Sets the specific category or account from or to which funds will be moved.


getAmount

public long getAmount()
Returns the amount that was budgeted, specified in the currency of the transfer account.


setAmount

public void setAmount(long amount)
Sets the amount that was budgeted, specified in the currency of the transfer account.


getInterval

public int getInterval()
Returns the type of repeating interval. Can be any one of the INTERVAL_ constants.


setInterval

public void setInterval(int interval)
Sets the type of repeating interval. Can be any one of the INTERVAL_ constants.


getIntervalStartDate

public int getIntervalStartDate()
Returns the starting date for the first interval


setIntervalStartDate

public void setIntervalStartDate(int intervalStart)
Sets the starting date for the first interval


getIntervalEndDate

public int getIntervalEndDate()
Returns the ending date for the last interval, if any. If the interval is INTERVAL_NO_REPEAT, then this is the ending date for the manually specified interval


setIntervalEndDate

public void setIntervalEndDate(int intervalEnd)
Sets the ending date for the last interval, if any. If the interval is INTERVAL_NO_REPEAT, then this is the ending date for the manually specified interval


toString

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

toString

public java.lang.String toString(CustomDateFormat dateFmt)