KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ibm > icu > util > DateRule


1 /*
2  *******************************************************************************
3  * Copyright (C) 1996-2006, International Business Machines Corporation and *
4  * others. All Rights Reserved. *
5  *******************************************************************************
6  */

7
8 package com.ibm.icu.util;
9
10 import java.util.Date JavaDoc;
11
12 /**
13  * DateRule is an interface for calculating the date of an event.
14  * It supports both recurring events and those which occur only once.
15  * DateRule is useful for storing information about holidays,
16  * Daylight Savings Time rules, and other events such as meetings.
17  *
18  * @see SimpleDateRule
19  * @draft ICU 2.8 (retainAll)
20  * @provisional This API might change or be removed in a future release.
21  */

22 public interface DateRule
23 {
24     /**
25      * Return the first occurrance of the event represented by this rule
26      * that is on or after the given start date.
27      *
28      * @param start Only occurrances on or after this date are returned.
29      *
30      * @return The date on which this event occurs, or null if it
31      * does not occur on or after the start date.
32      *
33      * @see #firstBetween
34      * @draft ICU 2.8
35      * @provisional This API might change or be removed in a future release.
36      */

37     abstract public Date JavaDoc firstAfter(Date JavaDoc start);
38
39     /**
40      * Return the first occurrance of the event represented by this rule
41      * that is on or after the given start date and before the given
42      * end date.
43      *
44      * @param start Only occurrances on or after this date are returned.
45      * @param end Only occurrances before this date are returned.
46      *
47      * @return The date on which this event occurs, or null if it
48      * does not occur between the start and end dates.
49      *
50      * @see #firstAfter
51      * @draft ICU 2.8
52      * @provisional This API might change or be removed in a future release.
53      */

54     abstract public Date JavaDoc firstBetween(Date JavaDoc start, Date JavaDoc end);
55
56     /**
57      * Checks whether this event occurs on the given date. This does
58      * <em>not</em> take time of day into account; instead it checks
59      * whether this event and the given date are on the same day.
60      * This is useful for applications such as determining whether a given
61      * day is a holiday.
62      *
63      * @param date The date to check.
64      * @return true if this event occurs on the given date.
65      * @draft ICU 2.8
66      * @provisional This API might change or be removed in a future release.
67      */

68     abstract public boolean isOn(Date JavaDoc date);
69
70     /**
71      * Check whether this event occurs at least once between the two
72      * dates given.
73      * @draft ICU 2.8
74      * @provisional This API might change or be removed in a future release.
75      */

76     abstract public boolean isBetween(Date JavaDoc start, Date JavaDoc end);
77 };
78
Popular Tags