Class BudgetItem

  • All Implemented Interfaces:
    com.infinitekind.tiksync.SyncableItem, java.lang.Comparable

    public final class BudgetItem
    extends MoneydanceSyncableItem
    implements java.lang.Comparable
    Represents one item in a budget
    • Method Detail

      • getSyncItemType

        public final java.lang.String getSyncItemType()
        Description copied from class: MoneydanceSyncableItem
        Subclasses should override this to return a static string identifying their type of object
        Specified by:
        getSyncItemType in interface com.infinitekind.tiksync.SyncableItem
        Overrides:
        getSyncItemType in class MoneydanceSyncableItem
      • getBudget

        public Budget getBudget()
      • setBudget

        public void setBudget​(Budget b)
      • 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 newAccount)
        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.
      • getAmountRelativeToPeriod

        public long getAmountRelativeToPeriod​(BudgetPeriod budgetPeriod)
        Get the amount of this budget item relative to the give BudgetPeriod
        Parameters:
        budgetPeriod -
        Returns:
      • getAmountRelativeToPeriod

        public long getAmountRelativeToPeriod​(BudgetPeriod budgetPeriod,
                                              CurrencyType inCurrency)
        Get the amount of this budget item relative to the give BudgetPeriod
        Parameters:
        budgetPeriod -
        inCurrency - the currency to which the result should be converted, or null to not convert
        Returns:
      • getAmount

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

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

        public void setBudgetPeriod​(BudgetPeriod budgetPeriod)
        Sets the interval based on the given BudgetPeriod
        Parameters:
        budgetPeriod -
      • 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
      • getDateRange

        public DateRange getDateRange()