|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.holidays.IsHoliday
public final class IsHoliday
Find out if there is any holiday/celebration on a given date.
Lets you easily define a set of holidays, then rapidly determine if any given date is a holiday. It is quite easy to specify which days you want considered holidays using methods like addHoliday where you specify the date or the name of the Holiday, addAmericanFederalHolidays and addWeekDaysAsHolidays.
Field Summary | |
---|---|
(package private) static boolean |
DEBUGGING
true if debugging |
protected int |
firstOrd
ordinal of Jan 1 of first year to compute holidays. |
protected int |
firstYear
First year in range to compute holidays. |
protected java.util.BitSet |
holidayBits
corresponding bit is true means day is a holiday. |
protected int |
lastOrd
ordinal of Dec 31 of last year to compute holidays. |
protected int |
lastYear
Last year in range to compute holidays. |
Constructor Summary | |
---|---|
IsHoliday(int firstYear,
int lastYear)
Constructor to define range of years over which we wish to compute holidays. |
Method Summary | |
---|---|
void |
addAmericanFederalHolidays(boolean shift)
add all American Federal holidays To get a list of US Federal Statutory holidays see: http://www.opm.gov/fedhol/1999.htm or http://aa.usno.navy.mil/AA/faq/docs/holidays.html. |
void |
addCanadianFederalHolidays(boolean shift)
add all Canadian Federal holidays To get a list of US Federal Statutory holidays see: http://www.opm.gov/fedhol/1999.htm or http://aa.usno.navy.mil/AA/faq/docs/holidays.html. |
void |
addHoliday(int ordinal)
add another holiday to the holiday table. |
void |
addWeekendsAsHolidays()
add all Saturdays and Sundays in the year range as holidays |
int |
getFirstYear()
get first year in range to compute the holidays. |
int |
getLastYear()
Get last year in range to compute holidays. |
boolean |
isHoliday(com.mindprod.common11.BigDate bigDate)
Is the given day a holiday? What constitutes a holiday is determined by the setHoliday calls |
boolean |
isHoliday(int ordinal)
Is the given day a holiday? What constitutes a holiday is determined by the setHoliday calls |
static void |
main(java.lang.String[] args)
test driver |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final boolean DEBUGGING
protected int firstOrd
protected int firstYear
protected int lastOrd
protected int lastYear
protected java.util.BitSet holidayBits
Constructor Detail |
---|
public IsHoliday(int firstYear, int lastYear)
firstYear
- first year to cover, must be > 0lastYear
- last year to coverMethod Detail |
---|
public void addAmericanFederalHolidays(boolean shift)
shift
- shift ACTUAL = false if you want the actual date of the holiday. SHIFTED = true if you want the date
taken off work, usually the nearest weekday.public void addCanadianFederalHolidays(boolean shift)
shift
- shift ACTUAL = false if you want the actual date of the holiday. SHIFTED = true if you want the date
taken off work, usually the nearest weekday.public void addHoliday(int ordinal)
ordinal
- day to add as a holiday measured in days since 1970-01-01. Note you must add it once for each
year in the range. We do not presume it falls the same day each year.public void addWeekendsAsHolidays()
public int getFirstYear()
public int getLastYear()
public boolean isHoliday(com.mindprod.common11.BigDate bigDate)
bigDate
- date to test
public boolean isHoliday(int ordinal)
ordinal
- days since 1970-01-01
public static void main(java.lang.String[] args)
args
- not used
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |