net.sf.nachocalendar.holidays
Class HoliDayModel

java.lang.Object
  extended bynet.sf.nachocalendar.holidays.HoliDayModel
All Implemented Interfaces:
DataModel

public class HoliDayModel
extends java.lang.Object
implements DataModel

Default implementation for HoliDayModel. It has a collection to contain the holidays and convenient accesor methods.

Author:
Ignacio Merani

Constructor Summary
HoliDayModel()
          Creates a new instance of DefaultHoliDayModel.
 
Method Summary
 void addHoliDay(HoliDay day)
          Adds a new holiday to the Collection.
 void clear()
          Removes all holidays from the Collection.
 java.util.Collection getAll()
          Returns a Collection with the Holidays.
 java.lang.Object getData(java.util.Date date)
          Returns the data asociated with the provided date.
 HoliDay getHoliDay(java.util.Date date)
          Checks if the date provided is holiday.
 int getSize()
          Returns the quantity of holidays in the Collection.
 void removeHoliDay(HoliDay day)
          Removes the provided holiday from the Collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HoliDayModel

public HoliDayModel()
Creates a new instance of DefaultHoliDayModel.

Method Detail

addHoliDay

public void addHoliDay(HoliDay day)
Adds a new holiday to the Collection.

Parameters:
day - the new holiday

removeHoliDay

public void removeHoliDay(HoliDay day)
Removes the provided holiday from the Collection.

Parameters:
day - holiday to be removed

getSize

public int getSize()
Returns the quantity of holidays in the Collection.

Returns:
the size of the Collection

getAll

public java.util.Collection getAll()
Returns a Collection with the Holidays.

Returns:
Collection with the Holidays

clear

public void clear()
Removes all holidays from the Collection.


getData

public java.lang.Object getData(java.util.Date date)
Returns the data asociated with the provided date.

Specified by:
getData in interface DataModel
Parameters:
date - date provided
Returns:
the data asociated or null

getHoliDay

public HoliDay getHoliDay(java.util.Date date)
Checks if the date provided is holiday.

Parameters:
date - Date to be checked
Returns:
the holiday or null if it's not a holiday