public class BaseCalendar extends java.lang.Object implements Calendar, java.io.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.
Calendar
,
Serialized FormConstructor and Description |
---|
BaseCalendar() |
BaseCalendar(Calendar baseCalendar) |
BaseCalendar(Calendar baseCalendar,
java.util.TimeZone timeZone) |
BaseCalendar(java.util.TimeZone timeZone) |
Modifier and Type | Method and Description |
---|---|
static java.util.Date |
buildHoliday(java.util.Date excludedDate)
Deprecated.
Always uses the default time zone.
|
static long |
buildHoliday(long timeStamp)
Deprecated.
Always uses the default time zone.
|
Calendar |
getBaseCalendar()
Get the base calendar.
|
java.lang.String |
getDescription()
Return the description given to the
Calendar instance by
its creator (if any). |
static java.util.Calendar |
getJavaCalendar(long timeStamp)
Deprecated.
Always uses the default time zone.
|
long |
getNextIncludedTime(long timeStamp)
Determine the next time (in milliseconds) that is 'included' by the
Calendar after the given time.
|
java.util.TimeZone |
getTimeZone()
Returns the time zone for which this
Calendar will be
resolved. |
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(java.lang.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. |
void |
setTimeZone(java.util.TimeZone timeZone)
Sets the time zone for which this
Calendar will be resolved. |
public BaseCalendar()
public BaseCalendar(Calendar baseCalendar)
public BaseCalendar(java.util.TimeZone timeZone)
timeZone
- The time zone to use for this Calendar, null
if TimeZone.getDefault()
should be usedpublic BaseCalendar(Calendar baseCalendar, java.util.TimeZone timeZone)
timeZone
- The time zone to use for this Calendar, null
if TimeZone.getDefault()
should be usedpublic void setBaseCalendar(Calendar baseCalendar)
Set a new base calendar or remove the existing one
setBaseCalendar
in interface Calendar
public Calendar getBaseCalendar()
Get the base calendar. Will be null, if not set.
getBaseCalendar
in interface Calendar
public java.lang.String getDescription()
Return the description given to the Calendar
instance by
its creator (if any).
getDescription
in interface Calendar
public void setDescription(java.lang.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.
setDescription
in interface Calendar
public java.util.TimeZone getTimeZone()
Calendar
will be
resolved.null
if Calendar should
use the TimeZone.getDefault()
public void setTimeZone(java.util.TimeZone timeZone)
Calendar
will be resolved.timeZone
- The time zone to use for this Calendar, null
if TimeZone.getDefault()
should be usedpublic 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.
isTimeIncluded
in interface Calendar
Calendar.isTimeIncluded(long)
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.
getNextIncludedTime
in interface Calendar
Calendar.getNextIncludedTime(long)
public static java.util.Date buildHoliday(java.util.Date excludedDate)
public static long buildHoliday(long timeStamp)
public static java.util.Calendar getJavaCalendar(long timeStamp)