com.ibm.icu.util

Class SimpleDateRule

public class SimpleDateRule extends Object implements DateRule

Simple implementation of DateRule.

UNKNOWN: ICU 2.8 (retainAll) This API might change or be removed in a future release.

Constructor Summary
SimpleDateRule(int month, int dayOfMonth)
Construct a rule for a fixed date within a month
SimpleDateRule(int month, int dayOfMonth, int dayOfWeek, boolean after)
Construct a rule for a weekday within a month, e.g. the first Monday.
Method Summary
DatefirstAfter(Date start)
Return the first occurrance of the event represented by this rule that is on or after the given start date.
DatefirstBetween(Date start, Date end)
Return the first occurrance of the event represented by this rule that is on or after the given start date and before the given end date.
booleanisBetween(Date start, Date end)
Check whether this event occurs at least once between the two dates given.
booleanisOn(Date date)
Checks whether this event occurs on the given date.

Constructor Detail

SimpleDateRule

public SimpleDateRule(int month, int dayOfMonth)
Construct a rule for a fixed date within a month

Parameters: month The month in which this rule occurs (0-based). dayOfMonth The date in that month (1-based).

UNKNOWN: ICU 2.8 This API might change or be removed in a future release.

SimpleDateRule

public SimpleDateRule(int month, int dayOfMonth, int dayOfWeek, boolean after)
Construct a rule for a weekday within a month, e.g. the first Monday.

Parameters: month The month in which this rule occurs (0-based). dayOfMonth A date within that month (1-based). dayOfWeek The day of the week on which this rule occurs. after If true, this rule selects the first dayOfWeek on or after dayOfMonth. If false, the rule selects the first dayOfWeek on or before dayOfMonth.

UNKNOWN: ICU 2.8 This API might change or be removed in a future release.

Method Detail

firstAfter

public Date firstAfter(Date start)
Return the first occurrance of the event represented by this rule that is on or after the given start date.

Parameters: start Only occurrances on or after this date are returned.

Returns: The date on which this event occurs, or null if it does not occur on or after the start date.

See Also: SimpleDateRule

UNKNOWN: ICU 2.8 This API might change or be removed in a future release.

firstBetween

public Date firstBetween(Date start, Date end)
Return the first occurrance of the event represented by this rule that is on or after the given start date and before the given end date.

Parameters: start Only occurrances on or after this date are returned. end Only occurrances before this date are returned.

Returns: The date on which this event occurs, or null if it does not occur between the start and end dates.

See Also: SimpleDateRule

UNKNOWN: ICU 2.8 This API might change or be removed in a future release.

isBetween

public boolean isBetween(Date start, Date end)
Check whether this event occurs at least once between the two dates given.

UNKNOWN: ICU 2.8 This API might change or be removed in a future release.

isOn

public boolean isOn(Date date)
Checks whether this event occurs on the given date. This does not take time of day into account; instead it checks whether this event and the given date are on the same day. This is useful for applications such as determining whether a given day is a holiday.

Parameters: date The date to check.

Returns: true if this event occurs on the given date.

UNKNOWN: ICU 2.8 This API might change or be removed in a future release.

Copyright (c) 2006 IBM Corporation and others.