org.quartz.impl.calendar
Class WeeklyCalendar

java.lang.Object
  extended by org.quartz.impl.calendar.BaseCalendar
      extended by org.quartz.impl.calendar.WeeklyCalendar
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, Calendar

public class WeeklyCalendar
extends BaseCalendar
implements Calendar, java.io.Serializable

This implementation of the Calendar excludes a set of days of the week. You may use it to exclude weekends for example. But you may define any day of the week. By default it excludes SATURDAY and SUNDAY.

Author:
Juergen Donnerstag
See Also:
Calendar, BaseCalendar, Serialized Form

Field Summary
 
Fields inherited from interface org.quartz.Calendar
MONTH
 
Constructor Summary
WeeklyCalendar()
           
WeeklyCalendar(Calendar baseCalendar)
           
WeeklyCalendar(Calendar baseCalendar, java.util.TimeZone timeZone)
           
WeeklyCalendar(java.util.TimeZone timeZone)
           
 
Method Summary
 boolean areAllDaysExcluded()
           Check if all week days are excluded.
 java.lang.Object clone()
           
 boolean[] getDaysExcluded()
           Get the array with the week days
 long getNextIncludedTime(long timeStamp)
           Determine the next time (in milliseconds) that is 'included' by the Calendar after the given time.
 boolean isDayExcluded(int wday)
           Return true, if wday (see Calendar.get()) is defined to be exluded.
 boolean isTimeIncluded(long timeStamp)
           Determine whether the given time (in milliseconds) is 'included' by the Calendar.
 void setDayExcluded(int wday, boolean exclude)
           Redefine a certain day of the week to be excluded (true) or included (false).
 void setDaysExcluded(boolean[] weekDays)
           Redefine the array of days excluded.
 
Methods inherited from class org.quartz.impl.calendar.BaseCalendar
createJavaCalendar, createJavaCalendar, getBaseCalendar, getDescription, getEndOfDayJavaCalendar, getStartOfDayJavaCalendar, getTimeZone, setBaseCalendar, setDescription, setTimeZone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.quartz.Calendar
getBaseCalendar, getDescription, setBaseCalendar, setDescription
 

Constructor Detail

WeeklyCalendar

public WeeklyCalendar()

WeeklyCalendar

public WeeklyCalendar(Calendar baseCalendar)

WeeklyCalendar

public WeeklyCalendar(java.util.TimeZone timeZone)

WeeklyCalendar

public WeeklyCalendar(Calendar baseCalendar,
                      java.util.TimeZone timeZone)
Method Detail

clone

public java.lang.Object clone()
Specified by:
clone in interface Calendar
Overrides:
clone in class BaseCalendar

getDaysExcluded

public boolean[] getDaysExcluded()

Get the array with the week days


isDayExcluded

public boolean isDayExcluded(int wday)

Return true, if wday (see Calendar.get()) is defined to be exluded. E. g. saturday and sunday.


setDaysExcluded

public void setDaysExcluded(boolean[] weekDays)

Redefine the array of days excluded. The array must of size greater or equal 8. java.util.Calendar's constants like MONDAY should be used as index. A value of true is regarded as: exclude it.


setDayExcluded

public void setDayExcluded(int wday,
                           boolean exclude)

Redefine a certain day of the week to be excluded (true) or included (false). Use java.util.Calendar's constants like MONDAY to determine the wday.


areAllDaysExcluded

public boolean areAllDaysExcluded()

Check if all week days are excluded. That is no day is included.

Returns:
boolean

isTimeIncluded

public boolean isTimeIncluded(long timeStamp)

Determine whether the given time (in milliseconds) is 'included' by the Calendar.

Note that this Calendar is only has full-day precision.

Specified by:
isTimeIncluded in interface Calendar
Overrides:
isTimeIncluded in class BaseCalendar
See Also:
Calendar.isTimeIncluded(long)

getNextIncludedTime

public long getNextIncludedTime(long timeStamp)

Determine the next time (in milliseconds) that is 'included' by the Calendar after the given time. Return the original value if timeStamp is included. Return 0 if all days are excluded.

Note that this Calendar is only has full-day precision.

Specified by:
getNextIncludedTime in interface Calendar
Overrides:
getNextIncludedTime in class BaseCalendar
See Also:
Calendar.getNextIncludedTime(long)


Copyright 2001-2019, Terracotta, Inc.