net.objectlab.kit.datecalc.common
Class AbstractKitCalculatorsFactory<E>

Package class diagram package AbstractKitCalculatorsFactory
java.lang.Object
  extended by net.objectlab.kit.datecalc.common.AbstractKitCalculatorsFactory<E>
Type Parameters:
E - a representation of a date, typically JDK: Date, Calendar; Joda:LocalDate, YearMonthDay
All Implemented Interfaces:
KitCalculatorsFactory<E>

public abstract class AbstractKitCalculatorsFactory<E>
extends Object
implements KitCalculatorsFactory<E>

Base class for all calculator factories, it handles the holiday registration.

Version:
$Revision: 334 $ $Date: 2010-03-30 07:06:50 -0400 (Tue, 30 Mar 2010) $
Author:
Marcin Jekot, $LastChangedBy: marchy $

Constructor Summary
AbstractKitCalculatorsFactory()
           
 
Method Summary
 HolidayCalendar<E> getHolidayCalendar(String name)
           
 Set<String> getRegisteredHolidayCalendarNames()
           
 boolean isHolidayCalendarRegistered(String name)
           
 void registerHolidays(String name, HolidayCalendar<E> holidaysCalendar)
          Use this method to register a given calendar, it will replace any existing one with the same name.
protected  void setHolidays(String name, DateCalculator<E> dc)
          Used by extensions to set holidays in a DateCalculator.
 void unregisterAllHolidayCalendars()
          unregister all holiday calendars;
 void unregisterHolidayCalendar(String calendarName)
          Unregister a given holiday calendar
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.objectlab.kit.datecalc.common.KitCalculatorsFactory
getDateCalculator, getIMMDateCalculator, getPeriodCountCalculator
 

Constructor Detail

AbstractKitCalculatorsFactory

public AbstractKitCalculatorsFactory()
Method Detail

registerHolidays

public void registerHolidays(String name,
                             HolidayCalendar<E> holidaysCalendar)
Use this method to register a given calendar, it will replace any existing one with the same name. An immutable copy is made so that any changes outside this class will have no affect. It won't update any existing DateCalculator as these should not be amended whilst in existence (we could otherwise get inconsistent results).

Specified by:
registerHolidays in interface KitCalculatorsFactory<E>
Parameters:
name - the calendar name to register these holidays under.
holidaysCalendar - a calendar containing a set of holidays (non-working days).

isHolidayCalendarRegistered

public boolean isHolidayCalendarRegistered(String name)
Specified by:
isHolidayCalendarRegistered in interface KitCalculatorsFactory<E>
Returns:
true if the holiday name is registered.

getHolidayCalendar

public HolidayCalendar<E> getHolidayCalendar(String name)
Specified by:
getHolidayCalendar in interface KitCalculatorsFactory<E>
Returns:
an immutable Holiday Calendar that is registered, null if not registered.

setHolidays

protected void setHolidays(String name,
                           DateCalculator<E> dc)
Used by extensions to set holidays in a DateCalculator.

Parameters:
name - holiday name
dc - the date calculator to configure.

getRegisteredHolidayCalendarNames

public Set<String> getRegisteredHolidayCalendarNames()
Specified by:
getRegisteredHolidayCalendarNames in interface KitCalculatorsFactory<E>
Returns:
an immutable set of registered calendar names

unregisterHolidayCalendar

public void unregisterHolidayCalendar(String calendarName)
Unregister a given holiday calendar

Specified by:
unregisterHolidayCalendar in interface KitCalculatorsFactory<E>
Parameters:
calendarName - the calendar name to unregister.

unregisterAllHolidayCalendars

public void unregisterAllHolidayCalendars()
unregister all holiday calendars;

Specified by:
unregisterAllHolidayCalendars in interface KitCalculatorsFactory<E>


Copyright © 2006-2010 Appendium - Portfolio Financing Platform. All Rights Reserved.