org.quartz.impl.calendar
Class BaseCalendar

java.lang.Object
  extended byorg.quartz.impl.calendar.BaseCalendar
All Implemented Interfaces:
Calendar, Serializable
Direct Known Subclasses:
AnnualCalendar, CronCalendar, DailyCalendar, HolidayCalendar, MonthlyCalendar, WeeklyCalendar

public class BaseCalendar
extends Object
implements Calendar, Serializable

This implementation of the Calendar may be used (you don't have to) as a base class for more sophisticated one's. It merely implements the base functionality required by each Calendar.

Regarded as base functionality is the treatment of base calendars. Base calendar allow you to chain (stack) as much calendars as you may need. For example to exclude weekends you may use WeeklyCalendar. In order to exclude holidays as well you may define a WeeklyCalendar instance to be the base calendar for HolidayCalendar instance.

Author:
Juergen Donnerstag, James House
See Also:
Calendar, Serialized Form

Field Summary
 
Fields inherited from interface org.quartz.Calendar
MONTH
 
Constructor Summary
BaseCalendar()
           Default Constructor
BaseCalendar(Calendar baseCalendar)
           Constructor
 
Method Summary
static Date buildHoliday(Date excludedDate)
           Utility method.
static long buildHoliday(long timeStamp)
           Utility method.
 Calendar getBaseCalendar()
           Get the base calendar.
 String getDescription()
           Return the description given to the Calendar instance by its creator (if any).
static Calendar getJavaCalendar(long timeStamp)
           Utility method.
 long getNextIncludedTime(long timeStamp)
           Determine the next time (in milliseconds) that is 'included' by the Calendar after the given time.
 boolean isTimeIncluded(long timeStamp)
           Check if date/time represented by timeStamp is included.
 void setBaseCalendar(Calendar baseCalendar)
           Set a new base calendar or remove the existing one
 void setDescription(String description)
           Set a description for the Calendar instance - may be useful for remembering/displaying the purpose of the calendar, though the description has no meaning to Quartz.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseCalendar

public BaseCalendar()

Default Constructor


BaseCalendar

public BaseCalendar(Calendar baseCalendar)

Constructor

Method Detail

setBaseCalendar

public void setBaseCalendar(Calendar baseCalendar)

Set a new base calendar or remove the existing one

Specified by:
setBaseCalendar in interface Calendar

getBaseCalendar

public Calendar getBaseCalendar()

Get the base calendar. Will be null, if not set.

Specified by:
getBaseCalendar in interface Calendar

getDescription

public String getDescription()

Return the description given to the Calendar instance by its creator (if any).

Specified by:
getDescription in interface Calendar
Returns:
null if no description was set.

setDescription

public void setDescription(String description)

Set a description for the Calendar instance - may be useful for remembering/displaying the purpose of the calendar, though the description has no meaning to Quartz.

Specified by:
setDescription in interface Calendar

isTimeIncluded

public boolean isTimeIncluded(long timeStamp)

Check if date/time represented by timeStamp is included. If included return true. The implementation of BaseCalendar simply calls the base calendars isTimeIncluded() method if base calendar is set.

Specified by:
isTimeIncluded in interface Calendar
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.

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

buildHoliday

public static Date buildHoliday(Date excludedDate)

Utility method. Return the date of excludeDate. The time fraction will be reset to 00.00:00.


buildHoliday

public static long buildHoliday(long timeStamp)

Utility method. Return just the date of excludeDate. The time fraction will be reset to 00.00:00.


getJavaCalendar

public static Calendar getJavaCalendar(long timeStamp)

Utility method. Return a java.util.Calendar for timeStamp.

Parameters:
timeStamp -
Returns:
Calendar

Quartz Enterprise Job Scheduler Project Page