Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.quartz.impl.calendar
Class BaseCalendar

    java.lang.Object
      org.quartz.impl.calendar.BaseCalendar

All Implemented Interfaces:
  Serializable, Cloneable, Calendar

Direct Known Subclasses:
  AnnualCalendar, CronCalendar, DailyCalendar, HolidayCalendar, MonthlyCalendar, WeeklyCalendar

    public class BaseCalendar

extends Object
implements Calendar, Serializable, Cloneable

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()`
`BaseCalendar(Calendar baseCalendar)`
`BaseCalendar(Calendar baseCalendar, TimeZone timeZone)`
`BaseCalendar(TimeZone timeZone)`

Method Summary
`Object` | `clone()`
`protected Calendar` | `createJavaCalendar()` Build a ``Calendar`` with the current time.
`protected Calendar` | `createJavaCalendar(long timeStamp)` Build a ``Calendar`` for the given timeStamp.
`Calendar` | `getBaseCalendar()` Get the base calendar.
`String` | `getDescription()` Return the description given to the `Calendar` instance by its creator (if any).
`protected Calendar` | `getEndOfDayJavaCalendar(long timeInMillis)` Returns the end of the given day ``Calendar``.
`long` | `getNextIncludedTime(long timeStamp)` Determine the next time (in milliseconds) that is 'included' by the Calendar after the given time.
`protected Calendar` | `getStartOfDayJavaCalendar(long timeInMillis)` Returns the start of the given day as a ``Calendar``.
`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(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(TimeZone timeZone)` Sets the time zone for which this `Calendar` will be resolved.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### BaseCalendar

    public BaseCalendar()

### BaseCalendar

    public BaseCalendar(Calendar baseCalendar)

### BaseCalendar

    public BaseCalendar(TimeZone timeZone)

Parameters:
  `timeZone` - The time zone to use for this Calendar, `null` if ``TimeZone.getDefault()`` should be used

### BaseCalendar

    public BaseCalendar(Calendar baseCalendar,
                        TimeZone timeZone)

Parameters:
  `timeZone` - The time zone to use for this Calendar, `null` if ``TimeZone.getDefault()`` should be used

Method Detail

### clone

    public Object clone()

  Specified by:
    `clone` in interface `Calendar`
  Overrides:
    `clone` in class `Object`

### 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`

### getTimeZone

    public TimeZone getTimeZone()

  Returns the time zone for which this `Calendar` will be resolved.

  Returns:
    This Calendar's timezone, `null` if Calendar should use the ``TimeZone.getDefault()``

### setTimeZone

    public void setTimeZone(TimeZone timeZone)

  Sets the time zone for which this `Calendar` will be resolved.

  Parameters:
    `timeZone` - The time zone to use for this Calendar, `null` if ``TimeZone.getDefault()`` should be used

### 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)`

### createJavaCalendar

    protected Calendar createJavaCalendar(long timeStamp)

  Build a ``Calendar`` for the given timeStamp. The new Calendar will use the `BaseCalendar` time zone if it is not `null`.

### createJavaCalendar

    protected Calendar createJavaCalendar()

  Build a ``Calendar`` with the current time. The new Calendar will use the `BaseCalendar` time zone if it is not `null`.

### getStartOfDayJavaCalendar

    protected Calendar getStartOfDayJavaCalendar(long timeInMillis)

  Returns the start of the given day as a ``Calendar``. This calculation will take the `BaseCalendar` time zone into account if it is not `null`.

  Parameters:
    `timeInMillis` - A time containing the desired date for the start-of-day time
  Returns:
    A ``Calendar`` set to the start of the given day.

### getEndOfDayJavaCalendar

    protected Calendar getEndOfDayJavaCalendar(long timeInMillis)

  Returns the end of the given day ``Calendar``. This calculation will take the `BaseCalendar` time zone into account if it is not `null`.

  Parameters:
    `timeInMillis` - a time containing the desired date for the end-of-day time.
  Returns:
    A ``Calendar`` set to the end of the given day.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001-2016, Terracotta, Inc.