Package org.jfree.date
Class DayAndMonthRule
java.lang.Object
org.jfree.date.AnnualDateRule
org.jfree.date.DayAndMonthRule
- All Implemented Interfaces:
Cloneable
An annual date rule where the generated date always falls on the same day
and month each year.
An example is ANZAC Day in Australia and New Zealand: it is observed on 25 April of every year.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
The day of the month.private int
The month (uses 1 to 12 in the obvious way). -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor: builds a DayAndMonthRule for 1 January.DayAndMonthRule
(int dayOfMonth, int month) Standard constructor: builds a DayAndMonthRule for the given day-of-the-month and month. -
Method Summary
Modifier and TypeMethodDescriptiongetDate
(int yyyy) Returns the date, given the year.int
Returns the day of the month.int
getMonth()
Returns an integer code representing the month.void
setDayOfMonth
(int dayOfMonth) Sets the day-of-the-month for this rule.void
setMonth
(int month) Sets the month for this rule.Methods inherited from class org.jfree.date.AnnualDateRule
clone
-
Field Details
-
dayOfMonth
private int dayOfMonthThe day of the month. -
month
private int monthThe month (uses 1 to 12 in the obvious way).
-
-
Constructor Details
-
DayAndMonthRule
public DayAndMonthRule()Default constructor: builds a DayAndMonthRule for 1 January. -
DayAndMonthRule
public DayAndMonthRule(int dayOfMonth, int month) Standard constructor: builds a DayAndMonthRule for the given day-of-the-month and month.For the month parameter, use SerialDate.JANUARY, etc. Note that there are no checks to prevent you from entering an invalid combination (such as 31 February).
- Parameters:
dayOfMonth
- the day of the month (in the range 1 to 31).month
- the month (use SerialDate.JANUARY, SerialDate.FEBRUARY etc.);
-
-
Method Details
-
getDayOfMonth
public int getDayOfMonth()Returns the day of the month.- Returns:
- the day of the month.
-
setDayOfMonth
public void setDayOfMonth(int dayOfMonth) Sets the day-of-the-month for this rule.- Parameters:
dayOfMonth
- the day-of-the-month.
-
getMonth
public int getMonth()Returns an integer code representing the month.The codes JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER and DECEMBER are defined in the SerialDate class.
- Returns:
- an integer code representing the month.
-
setMonth
public void setMonth(int month) Sets the month for this rule.- Parameters:
month
- the month for this rule.
-
getDate
Returns the date, given the year.- Specified by:
getDate
in classAnnualDateRule
- Parameters:
yyyy
- the year.- Returns:
- the date generated by this rule for the specified year (null permitted).
-