KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > quartz > Calendar


1
2 /*
3  * Copyright 2004-2005 OpenSymphony
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
6  * use this file except in compliance with the License. You may obtain a copy
7  * of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14  * License for the specific language governing permissions and limitations
15  * under the License.
16  *
17  */

18
19 /*
20  * Previously Copyright (c) 2001-2004 James House
21  */

22
23
24 package org.quartz;
25
26 /**
27  * <p>
28  * An interface to be implemented by objects that define spaces of time during
29  * which an associated <code>{@link Trigger}</code> may fire. Calendars do not
30  * define actual fire times, but rather are used to limit a <code>Trigger</code>
31  * from firing on its normal schedule if necessary. Most Calendars include all
32  * times by default and allow the user to specify times to exclude. As such, it
33  * is often useful to think of Calendars as being used to <I>exclude</I> a block
34  * of time &mdash; as opposed to <I>include</I> a block of time. (i.e. the
35  * schedule &quot;fire every five minutes except on Sundays&quot; could be
36  * implemented with a <code>SimpleTrigger</code> and a
37  * <code>WeeklyCalendar</code> which excludes Sundays)
38  * </p>
39  *
40  * @author James House
41  * @author Juergen Donnerstag
42  */

43 public interface Calendar extends java.io.Serializable JavaDoc {
44
45     /*
46      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47      *
48      * Constants.
49      *
50      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
51      */

52
53     int MONTH = 0;
54
55     /*
56      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57      *
58      * Interface.
59      *
60      * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61      */

62
63     /**
64      * <p>
65      * Set a new base calendar or remove the existing one.
66      * </p>
67      */

68     void setBaseCalendar(Calendar baseCalendar);
69
70     /**
71      * <p>
72      * Get the base calendar. Will be null, if not set.
73      * </p>
74      */

75     Calendar getBaseCalendar();
76
77     /**
78      * <p>
79      * Determine whether the given time (in milliseconds) is 'included' by the
80      * Calendar.
81      * </p>
82      */

83     boolean isTimeIncluded(long timeStamp);
84
85     /**
86      * <p>
87      * Determine the next time (in milliseconds) that is 'included' by the
88      * Calendar after the given time.
89      * </p>
90      */

91     long getNextIncludedTime(long timeStamp);
92
93     /**
94      * <p>
95      * Return the description given to the <code>Calendar</code> instance by
96      * its creator (if any).
97      * </p>
98      *
99      * @return null if no description was set.
100      */

101     String JavaDoc getDescription();
102
103     /**
104      * <p>
105      * Set a description for the <code>Calendar</code> instance - may be
106      * useful for remembering/displaying the purpose of the calendar, though
107      * the description has no meaning to Quartz.
108      * </p>
109      */

110     void setDescription(String JavaDoc description);
111 }
112
Popular Tags