com.mindprod.holidays
Class HolInfo

java.lang.Object
  extended by com.mindprod.holidays.HolInfo
Direct Known Subclasses:
AboriginalDay, AlbertaFamilyDay, AmericanThanksgiving, ANZACDay, AprilFoolsDay, ArmedForcesDay, AshWednesday, AustraliaDay, AutumnalEquinox, BlackFriday, BoxingDay, CanadaCivicDay, CanadaDay, CanadianThanksgiving, ChangeYourPasswordsDay, Christmas, ChristmasEve, ChristmasUSA, CincoDeMayo, ColumbusDay, CommonwealthDay, CongressSessionStartDay, CreationismDay, DaylightSavingEnd, DaylightSavingStart, EarthDay, EarthHour, EasterMonday, EasterSunday, EuropeDay, FamilyDay, FathersDay, FlagDay, GeneralElectionDay, GoodFriday, GrandparentsDay, GroundhogDay, Halloween, HumanRightsDay, InaugurationDay, IndependenceDay, LaborDay, LabourDay, LincolnsBirthday, MardiGras, MartinLutherKingDay, MemorialDay, MothersDay, NewYearsDay, NewYearsEve, PalmSunday, ParentsDay, PresidentsDay, QueensBirthday, RemembranceDay, RobbieBurnsDay, StAndrewsDay, StJeanBaptisteDay, StPatricksDay, SummerSolstice, UtahPioneerDay, ValentinesDay, VernalEquinox, VeteransDay, VictoriaDay, WashingtonsBirthday, WinterSolstice, WorldAIDSDay

public abstract class HolInfo
extends java.lang.Object

Information about a single holiday. base class for various holiday calculators.

See class com.mindprod.holidays.Christmas for sample implementation of HolInfo.

For rules about how various holidays are computed see: http://www.mnsinc.com/utopia/Calendar/Holiday_Dates/Holiday_Determinations.html 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. To get a list of US Federal Observances (not holidays) see: http://www4.law.cornell.edu/uscode/unframed/36/ch9.html http://www.askjeeves.com/ was very helpful in tracking down information about the various holidays. For a list of Canadian Bank holidays see: http://infoservice.gc.ca/canadiana/bochol-99_e.html For a list of Canadian provincial holidays see: http://www.pch.gc.ca/ceremonial-symb/english/day_prv.html For a list of Canadian Federal Holidays see: http://www.pch.gc.ca/ceremonial-symb/english/day.html Calendrical Calculations by Dershowitz and Reingold handles Chinese New Year. http://emr.cs.uiuc.edu/home/reingold/calendar-book/index.shtml For astronomical calculations see: http://www.ccs.neu.edu/home/ramsdell/jdk1.1/lunisolar/lunisolar.html For C Calendar code see: http://www.magnet.ch/serendipity/hermetic/index.html For a large collection of calendar code see: http://www.hiline.net/users/rms/ section 4.2 Cool Stuff in SCDTL For various calendar links see: http://www.calendarzone.com/ For various calendar links see: http://dir.yahoo.com/Reference/Calendars/ For a global list of holidays see: http://holidayfestival.com/

Since:
1999
Version:
1.0 1999-09-09 initial version
Author:
Roedy Green, Canadian Mind Products

Field Summary
static boolean ACTUAL
          base calculations on the actual date the holiday is observed.
static boolean DEBUGGING
          true if debugging.
static int OBSERVED
          base calculations on date holiday was first celebrated.
static int PROCLAIMED
          base calculations on date holiday was first officially proclaimed.
static boolean SHIFTED
          base calculations on the nearest weekday to the holiday.
 
Constructor Summary
HolInfo()
           
 
Method Summary
abstract  java.lang.String getAuthority()
          authority who provided the information about the holiday.
abstract  int getFirstYear(int base)
          Get year holiday first proclaimed or first celebrated.
abstract  java.lang.String getName()
          Get name of holiday e.g.
abstract  java.lang.String getRule()
          Get rule in English for how the holiday is calculated.
protected  boolean isYearValid(int year, int base)
          Is year valid for this holiday?
 int when(int year)
          When was this holiday in a given year?, based on PROCLAIMED date.
 int when(int year, boolean shift)
          When was this holiday in a given year?, based on PROCLAIMED date.
abstract  int when(int year, boolean shift, int base)
          When was this holiday in a given year?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTUAL

public static final boolean ACTUAL
base calculations on the actual date the holiday is observed.

See Also:
Constant Field Values

DEBUGGING

public static final boolean DEBUGGING
true if debugging. May turn on extra logging information.

See Also:
Constant Field Values

SHIFTED

public static final boolean SHIFTED
base calculations on the nearest weekday to the holiday.

See Also:
Constant Field Values

OBSERVED

public static final int OBSERVED
base calculations on date holiday was first celebrated.

See Also:
Constant Field Values

PROCLAIMED

public static final int PROCLAIMED
base calculations on date holiday was first officially proclaimed.

See Also:
Constant Field Values
Constructor Detail

HolInfo

public HolInfo()
Method Detail

getAuthority

public abstract java.lang.String getAuthority()
authority who provided the information about the holiday.

Returns:
name of person, email address, website etc. that describes the rules about the holiday. "" if no one in particular.

getFirstYear

public abstract int getFirstYear(int base)
Get year holiday first proclaimed or first celebrated.

Parameters:
base - PROCLAIMED=based on date holiday was officially proclaimed. CELEBRATED=based on date holiday was first celebrated.
Returns:
year first proclaimed, or first celebrated.

getName

public abstract java.lang.String getName()
Get name of holiday e.g. "Christmas"

Returns:
English language name of the holiday.

getRule

public abstract java.lang.String getRule()
Get rule in English for how the holiday is calculated. e.g. "Always on Dec 25." or "Third Monday in March." may contain embedded \n characters.

Returns:
rule for how holiday is computed.

when

public final int when(int year)
When was this holiday in a given year?, based on PROCLAIMED date.

Parameters:
year - must be 1583 or later.
Returns:
ordinal days since 1970-01-01.

when

public final int when(int year,
                      boolean shift)
When was this holiday in a given year?, based on PROCLAIMED date.

Parameters:
year - must be 1583 or later.
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.
Returns:
ordinal days since 1970-01-01, suitabl for feeding to BigDate.

when

public abstract int when(int year,
                         boolean shift,
                         int base)
When was this holiday in a given year?

Parameters:
year - (-ve means BC, +ve means AD, 0 not permitted.)
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.
base - PROCLAIMED=based on date holiday was officially proclaimed CELEBRATED=based on date holiday was first celebrated
Returns:
ordinal days since 1970-01-01. return NULL_ORDINAL if the holiday was not celebrated in that year.

isYearValid

protected final boolean isYearValid(int year,
                                    int base)
Is year valid for this holiday?

Parameters:
year - The year you want to test.
base - PROCLAIMED=based on date holiday was officially proclaimed . CELEBRATED=based on date holiday was first celebrated.
Returns:
true if the holiday was celebrated/proclained by that year.