com.ibm.icu.util
Class Holiday
- DateRule
public abstract class Holiday
An abstract class representing a holiday.
Date | firstAfter(Date start) - Return the first occurrance of this holiday on or after the given date
|
Date | firstBetween(Date start, Date end) - Return the first occurrance of this holiday that is on or after
the given start date and before the given end date.
|
String | getDisplayName() - Return the name of this holiday in the language of the default locale
|
String | getDisplayName(Locale locale) - Return the name of this holiday in the language of the specified locale
The
name parameter passed to this object's constructor is used
as a key to look up the holiday's localized name in a ResourceBundle object
named HolidayBundle.
|
String | getDisplayName(ULocale locale) - Return the name of this holiday in the language of the specified locale
The
name parameter passed to this object's constructor is used
as a key to look up the holiday's localized name in a ResourceBundle object
named HolidayBundle.
|
static Holiday[] | getHolidays()
|
static Holiday[] | getHolidays(Locale locale)
|
static Holiday[] | getHolidays(ULocale locale)
|
DateRule | getRule()
|
boolean | isBetween(Date start, Date end) - Check whether this holiday occurs at least once between the two
dates given.
|
boolean | isOn(Date date) - Checks whether this holiday falls on the given date.
|
void | setRule(DateRule rule)
|
Holiday
protected Holiday(String name,
DateRule rule)
Construct a new Holiday object. This is for use by subclasses only.
This constructs a new holiday with the given name and date rules.
name
- The name of this holiday. The getDisplayName method
uses this string as a key to look up the holiday's name a
resource bundle object named HolidayBundle.rule
- The date rules used for determining when this holiday
falls. Holiday's implementation of the DateRule inteface
simply delegates to this DateRule object.
firstAfter
public Date firstAfter(Date start)
Return the first occurrance of this holiday on or after the given date
- firstAfter in interface DateRule
start
- Only holidays on or after this date are returned.
- The date on which this holiday occurs, or null if it
does not occur on or after the start date.
firstBetween
public Date firstBetween(Date start,
Date end)
Return the first occurrance of this holiday that is on or after
the given start date and before the given end date.
- firstBetween in interface DateRule
start
- Only occurrances on or after this date are returned.end
- Only occurrances before this date are returned.
- The date on which this event occurs, or null if it
does not occur between the start and end dates.
getDisplayName
public String getDisplayName()
Return the name of this holiday in the language of the default locale
getDisplayName
public String getDisplayName(Locale locale)
Return the name of this holiday in the language of the specified locale
The name
parameter passed to this object's constructor is used
as a key to look up the holiday's localized name in a ResourceBundle object
named HolidayBundle.
locale
- A locale specifying the language in which the name is desired.
getDisplayName
public String getDisplayName(ULocale locale)
Return the name of this holiday in the language of the specified locale
The name
parameter passed to this object's constructor is used
as a key to look up the holiday's localized name in a ResourceBundle object
named HolidayBundle.
locale
- A locale specifying the language in which the name is desired.
getHolidays
public static Holiday[] getHolidays()
getHolidays
public static Holiday[] getHolidays(Locale locale)
isBetween
public boolean isBetween(Date start,
Date end)
Check whether this holiday occurs at least once between the two
dates given.
- isBetween in interface DateRule
isOn
public boolean isOn(Date date)
Checks whether this holiday falls on the given date. This does
not take time of day into account; instead it checks
whether the holiday and the given date are on the same day.
- isOn in interface DateRule
date
- The date to check.
- true if this holiday occurs on the given date.
setRule
public void setRule(DateRule rule)
Copyright (c) 2006 IBM Corporation and others.