com.jrefinery.date
Class DayAndMonthRule

java.lang.Object
  extended by com.jrefinery.date.AnnualDateRule
      extended by com.jrefinery.date.DayAndMonthRule
All Implemented Interfaces:
java.lang.Cloneable

public class DayAndMonthRule
extends AnnualDateRule
implements java.lang.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
protected  int dayOfMonth
          The day of the month.
protected  int month
          The month (uses 1 to 12 in the obvious way).
 
Constructor Summary
DayAndMonthRule()
          Default 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
 SerialDate getDate(int yyyy)
          Returns the date, given the year.
 int getDayOfMonth()
          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 com.jrefinery.date.AnnualDateRule
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dayOfMonth

protected int dayOfMonth
The day of the month.


month

protected int month
The month (uses 1 to 12 in the obvious way).

Constructor Detail

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 Detail

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

public SerialDate getDate(int yyyy)
Returns the date, given the year.

Specified by:
getDate in class AnnualDateRule
Parameters:
yyyy - The year.
Returns:
The date generated by this rule for the specified year (null permitted).


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.