1 // 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html#License 3 /* 4 ******************************************************************************* 5 * Copyright (C) 1996-2010, International Business Machines Corporation and * 6 * others. All Rights Reserved. * 7 ******************************************************************************* 8 */ 9 10 package com.ibm.icu.util; 11 12 import java.util.Date; 13 14 /** 15 * <b>Note:</b> The Holiday framework is a technology preview. 16 * Despite its age, is still draft API, and clients should treat it as such. 17 * 18 * DateRule is an interface for calculating the date of an event. 19 * It supports both recurring events and those which occur only once. 20 * DateRule is useful for storing information about holidays, 21 * Daylight Savings Time rules, and other events such as meetings. 22 * 23 * @see SimpleDateRule 24 * @draft ICU 2.8 (retainAll) 25 * @provisional This API might change or be removed in a future release. 26 */ 27 public interface DateRule 28 { 29 /** 30 * Return the first occurrance of the event represented by this rule 31 * that is on or after the given start date. 32 * 33 * @param start Only occurrances on or after this date are returned. 34 * 35 * @return The date on which this event occurs, or null if it 36 * does not occur on or after the start date. 37 * 38 * @see #firstBetween 39 * @draft ICU 2.8 40 * @provisional This API might change or be removed in a future release. 41 */ 42 abstract public Date firstAfter(Date start); 43 44 /** 45 * Return the first occurrance of the event represented by this rule 46 * that is on or after the given start date and before the given 47 * end date. 48 * 49 * @param start Only occurrances on or after this date are returned. 50 * @param end Only occurrances before this date are returned. 51 * 52 * @return The date on which this event occurs, or null if it 53 * does not occur between the start and end dates. 54 * 55 * @see #firstAfter 56 * @draft ICU 2.8 57 * @provisional This API might change or be removed in a future release. 58 */ 59 abstract public Date firstBetween(Date start, Date end); 60 61 /** 62 * Checks whether this event occurs on the given date. This does 63 * <em>not</em> take time of day into account; instead it checks 64 * whether this event and the given date are on the same day. 65 * This is useful for applications such as determining whether a given 66 * day is a holiday. 67 * 68 * @param date The date to check. 69 * @return true if this event occurs on the given date. 70 * @draft ICU 2.8 71 * @provisional This API might change or be removed in a future release. 72 */ 73 abstract public boolean isOn(Date date); 74 75 /** 76 * Check whether this event occurs at least once between the two 77 * dates given. 78 * @draft ICU 2.8 79 * @provisional This API might change or be removed in a future release. 80 */ 81 abstract public boolean isBetween(Date start, Date end); 82 } 83