org.homeunix.thecave.buddi.model
Class BudgetCategoryType

java.lang.Object
  extended by org.homeunix.thecave.buddi.model.BudgetCategoryType
Direct Known Subclasses:
BudgetCategoryTypeMonthly, BudgetCategoryTypeQuarterly, BudgetCategoryTypeWeekly, BudgetCategoryTypeYearly

public abstract class BudgetCategoryType
extends java.lang.Object

Abstract definition of BudgetCategoryType. Extend this object to define new BudgetCategoryType classes. (Note that it is highly recommended to not create new classes of this type yourself, as it will render data files which use it incompatible with other Buddi versions. If you wish to define a new budget period type, please send the resulting class to Wyatt Olson to add into a future Buddi version)

Author:
wyatt

Constructor Summary
BudgetCategoryType()
           
 
Method Summary
 boolean equals(java.lang.Object obj)
           
abstract  java.util.Date getBudgetPeriodOffset(java.util.Date date, int offset)
          Method to move forwards or backwards by the given number of periods.
abstract  java.lang.String getDateFormat()
          Returns the date format associated with this budget period type.
abstract  long getDaysInPeriod(java.util.Date date)
          Returns the number of days in the period specified by date.
abstract  java.util.Date getEndOfBudgetPeriod(java.util.Date date)
          Returns the end of the budget period which contains the given date.
abstract  java.lang.String getName()
          Returns the name of this budget period.
abstract  java.util.Date getStartOfBudgetPeriod(java.util.Date date)
          Returns the start of the budget period which contains the given date.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BudgetCategoryType

public BudgetCategoryType()
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getBudgetPeriodOffset

public abstract java.util.Date getBudgetPeriodOffset(java.util.Date date,
                                                     int offset)
Method to move forwards or backwards by the given number of periods. This must conform to the following statements: If offset is 0, return the same date If offset is positive, add that many budget periods. For instance, if the value 3 is given, MONTHLY period is selected, and the current date is August 1, the return date will be November 1 (August + 3). If offset is negative, subtract that many budget periods. The inverse of this must be the same as positive; for instance, if you are given a date and you add '-3' to it, and then add '3' again, you must arrive at the same date as you started with.

Parameters:
date -
offset -
Returns:

getDateFormat

public abstract java.lang.String getDateFormat()
Returns the date format associated with this budget period type. This is used in the My Budgets window to format the date spinner and the column names. For information on how to display the format, please see the SimpleDateFormatter javadocs. For instance, for Monthly type, the value would be "MMM yyyy" (to show Aug 2007). For the Weekly type, since we want to show days as well, the format would be "dd MMM yyyy".

Returns:

getDaysInPeriod

public abstract long getDaysInPeriod(java.util.Date date)
Returns the number of days in the period specified by date. The given date can be any date within the budget period. For instance, if this class defines a Monthly type, passing in a date of August 4 2007 would return the value 31; passing in the date of September 20 2009 would return the value 30.

Parameters:
date -
Returns:

getEndOfBudgetPeriod

public abstract java.util.Date getEndOfBudgetPeriod(java.util.Date date)
Returns the end of the budget period which contains the given date.

Parameters:
date -
Returns:

getName

public abstract java.lang.String getName()
Returns the name of this budget period. It will be filtered through the translator before displaying it, do this can be a translation key if desired.

Returns:

getStartOfBudgetPeriod

public abstract java.util.Date getStartOfBudgetPeriod(java.util.Date date)
Returns the start of the budget period which contains the given date.

Parameters:
date -
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

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