com.silverpeas.calendar
Class DayOfWeekOccurrence

java.lang.Object
  extended by com.silverpeas.calendar.DayOfWeekOccurrence

public class DayOfWeekOccurrence
extends Object

The day of week occurrence represents an nth occurrence of the day in a week, a month or in a year. Such objects are mainly used to represent a rule in an event recurrence.


Field Summary
static int ALL_OCCURRENCES
          A constant that defines a specific value for all the occurrences of the represented day in a week, a month or a year.
 
Method Summary
static DayOfWeekOccurrence allOccurrences(DayOfWeek dayOfWeek)
          Creates an instance of DayOfWeekOccurrence representing all the occurrences of the specified day of week in a week, a month or a year.
 DayOfWeek dayOfWeek()
          Gets the day of week of this occurrence.
 int nth()
          Gets the nth this occurrence is.
static DayOfWeekOccurrence nthOccurrence(int nth, DayOfWeek dayOfWeek)
          Creates an instance of DayOfWeekOccurrence representing the nth occurrence of the specified day of week in a month or a year.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_OCCURRENCES

public static final int ALL_OCCURRENCES
A constant that defines a specific value for all the occurrences of the represented day in a week, a month or a year.

See Also:
Constant Field Values
Method Detail

nthOccurrence

public static DayOfWeekOccurrence nthOccurrence(int nth,
                                                DayOfWeek dayOfWeek)
Creates an instance of DayOfWeekOccurrence representing the nth occurrence of the specified day of week in a month or a year.

Parameters:
nth - the nth occurrence of the specified day of week. It accepts negative numbers. A positive value means the nth occurrence of the day of week encountered in the month or in the year, whereas a negative value means the nth occurrence back from the end of the month or of the year.
dayOfWeek - the day of week.
Returns:
a DayOfWeekOccurrence instance.

allOccurrences

public static DayOfWeekOccurrence allOccurrences(DayOfWeek dayOfWeek)
Creates an instance of DayOfWeekOccurrence representing all the occurrences of the specified day of week in a week, a month or a year.

Parameters:
dayOfWeek - the day of week.
Returns:
a DayOfWeekOccurrence instance.

dayOfWeek

public DayOfWeek dayOfWeek()
Gets the day of week of this occurrence.

Returns:
the day of week.

nth

public int nth()
Gets the nth this occurrence is.

Returns:
the nth occurrence or ALL_OCCURRENCES if all of the underlying day of week are considered.


Copyright © 2016 Silverpeas. All Rights Reserved.