Class DayOfWeekInMonthRule

java.lang.Object
org.jfree.date.AnnualDateRule
org.jfree.date.DayOfWeekInMonthRule
All Implemented Interfaces:
Cloneable

public class DayOfWeekInMonthRule extends AnnualDateRule
An annual date rule that specifies the nth day of the week in a given month (for example, the third Wednesday in June, or the last Friday in November).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private int
    FIRST, SECOND, THIRD, FOURTH or LAST.
    private int
    The day of the week (SerialDate.MONDAY, SerialDate.TUESDAY...).
    private int
    The month (1 to 12, or SerialDate.JANUARY, SerialDate.FEBRUARY...).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor: builds a rule for the first Monday in January by default.
    DayOfWeekInMonthRule(int count, int dayOfWeek, int month)
    Standard constructor: builds a rule with the specified attributes.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the 'count' for this rule (one of FIRST, SECOND, THIRD, FOURTH and LAST).
    getDate(int year)
    Return the date for this rule, given the year.
    int
    Returns the day-of-the-week for this rule (SerialDate.MONDAY, SerialDate.TUESDAY, etc.).
    int
    Returns the month for this rule.
    void
    setCount(int count)
    Sets the 'count' for this rule (one of FIRST, SECOND, THIRD, FOURTH and LAST).
    void
    setDayOfWeek(int dayOfWeek)
    Sets the day-of-the-week for this rule.
    void
    setMonth(int month)
    Sets the month for this rule.

    Methods inherited from class org.jfree.date.AnnualDateRule

    clone

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • count

      private int count
      FIRST, SECOND, THIRD, FOURTH or LAST.
    • dayOfWeek

      private int dayOfWeek
      The day of the week (SerialDate.MONDAY, SerialDate.TUESDAY...).
    • month

      private int month
      The month (1 to 12, or SerialDate.JANUARY, SerialDate.FEBRUARY...).
  • Constructor Details

    • DayOfWeekInMonthRule

      public DayOfWeekInMonthRule()
      Default constructor: builds a rule for the first Monday in January by default.
    • DayOfWeekInMonthRule

      public DayOfWeekInMonthRule(int count, int dayOfWeek, int month)
      Standard constructor: builds a rule with the specified attributes.
      Parameters:
      count - one of: FIRST, SECOND, THIRD, FOURTH or LAST.
      dayOfWeek - the day-of-the-week (SerialDate.MONDAY, SerialDate.TUESDAY, etc.).
      month - the month (SerialDate.JANUARY, SerialDate.FEBRUARY, etc.).
  • Method Details

    • getCount

      public int getCount()
      Returns the 'count' for this rule (one of FIRST, SECOND, THIRD, FOURTH and LAST).
      Returns:
      the 'count'.
    • setCount

      public void setCount(int count)
      Sets the 'count' for this rule (one of FIRST, SECOND, THIRD, FOURTH and LAST).
      Parameters:
      count - the 'count'.
    • getDayOfWeek

      public int getDayOfWeek()
      Returns the day-of-the-week for this rule (SerialDate.MONDAY, SerialDate.TUESDAY, etc.).
      Returns:
      the day-of-the-week.
    • setDayOfWeek

      public void setDayOfWeek(int dayOfWeek)
      Sets the day-of-the-week for this rule.
      Parameters:
      dayOfWeek - the day-of-the-week.
    • getMonth

      public int getMonth()
      Returns the month for this rule.
      Returns:
      the month.
    • setMonth

      public void setMonth(int month)
      Sets the month for this rule.
      Parameters:
      month - the month (SerialDate.JANUARY, SerialDate.FEBRUARY, etc.).
    • getDate

      public SerialDate getDate(int year)
      Return the date for this rule, given the year.
      Specified by:
      getDate in class AnnualDateRule
      Parameters:
      year - the year.
      Returns:
      the date generated by the rule for the given year.