net.sf.nachocalendar.holidays

Class HoliDayModel

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.
Collection
getAll()
Returns a Collection with the Holidays.
Object
getData(Date date)
Returns the data asociated with the provided date.
HoliDay
getHoliDay(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.

Constructor Details

HoliDayModel

public HoliDayModel()
Creates a new instance of DefaultHoliDayModel.

Method Details

addHoliDay

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

clear

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

getAll

public Collection getAll()
Returns a Collection with the Holidays.
Returns:
Collection with the Holidays

getData

public Object getData(Date date)
Returns the data asociated with the provided date.
Parameters:
date - date provided
Returns:
the data asociated or null

getHoliDay

public HoliDay getHoliDay(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

getSize

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

removeHoliDay

public void removeHoliDay(HoliDay day)
Removes the provided holiday from the Collection.
Parameters:
day - holiday to be removed