net.objectlab.kit.datecalc.joda
Class LocalDateCalculator

Package class diagram package LocalDateCalculator
java.lang.Object
  extended by net.objectlab.kit.datecalc.common.AbstractDateCalculator<LocalDate>
      extended by net.objectlab.kit.datecalc.joda.LocalDateCalculator
All Implemented Interfaces:
DateCalculator<LocalDate>

public class LocalDateCalculator
extends AbstractDateCalculator<LocalDate>

This class is used via the DateCalculator interface, it enables the handling of different HolidayHandler, if no HolidayHandler is defined, the calendar will NOT move a date, even if it falls on a holiday or weekend.

Version:
$Revision: 311 $ $Date: 2010-03-23 17:08:11 -0400 (Tue, 23 Mar 2010) $
Author:
Benoit Xhenseval, $LastChangedBy: marchy $

Field Summary
 
Fields inherited from class net.objectlab.kit.datecalc.common.AbstractDateCalculator
DAYS_IN_WEEK
 
Constructor Summary
LocalDateCalculator()
           
LocalDateCalculator(String name, LocalDate startDate, HolidayCalendar<LocalDate> holidayCalendar, HolidayHandler<LocalDate> holidayHandler)
           
 
Method Summary
protected  void checkBoundary(LocalDate date)
          This may throw an IndexOutOfBoundsException if the date is not within the boundaries.
protected  LocalDate clone(LocalDate date)
           
protected  LocalDate compareDate(LocalDate date1, LocalDate date2, boolean returnEarliest)
           
protected  DateCalculator<LocalDate> createNewCalculator(String name, LocalDate startDate, HolidayCalendar<LocalDate> holidays, HolidayHandler<LocalDate> handler)
           
protected  LocalDate getToday()
           
 boolean isWeekend(LocalDate date)
          is the date a non-working day according to the WorkingWeek?
 DateCalculator<LocalDate> moveByDays(int days)
          This changes the current business date held in the calculator, it moves the new current business date by the number of days and, if it falls on a weekend or holiday, moves it further according to the HolidayHandler given in this DateCalculator.
 DateCalculator<LocalDate> moveByMonths(int months)
           
 void setWorkingWeek(WorkingWeek week)
          Set the working week.
 
Methods inherited from class net.objectlab.kit.datecalc.common.AbstractDateCalculator
calculateTenorDates, calculateTenorDates, combine, getCurrentBusinessDate, getCurrentIncrement, getHolidayCalendar, getHolidayHandler, getHolidayHandlerType, getName, getStartDate, isCurrentDateNonWorking, isNonWorkingDay, moveByBusinessDays, moveByTenor, moveByTenor, setCurrentBusinessDate, setCurrentIncrement, setHolidayCalendar, setHolidayHandler, setName, setStartDate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalDateCalculator

public LocalDateCalculator()

LocalDateCalculator

public LocalDateCalculator(String name,
                           LocalDate startDate,
                           HolidayCalendar<LocalDate> holidayCalendar,
                           HolidayHandler<LocalDate> holidayHandler)
Method Detail

setWorkingWeek

public void setWorkingWeek(WorkingWeek week)
Set the working week.

Parameters:
week - the JodaWorkingWeek
Throws:
IllegalArgumentException - if the week is not a JodaWorkingWeek.

isWeekend

public boolean isWeekend(LocalDate date)
is the date a non-working day according to the WorkingWeek?

Returns:
true if the date falls on a weekend.

moveByDays

public DateCalculator<LocalDate> moveByDays(int days)
Description copied from interface: DateCalculator
This changes the current business date held in the calculator, it moves the new current business date by the number of days and, if it falls on a weekend or holiday, moves it further according to the HolidayHandler given in this DateCalculator.

Parameters:
days - number of days (can be <0 or >0)
Returns:
the DateCalculator (so one can do calendar.moveByDays(-2).getCurrentBusinessDate();)

moveByMonths

public DateCalculator<LocalDate> moveByMonths(int months)
Specified by:
moveByMonths in class AbstractDateCalculator<LocalDate>

createNewCalculator

protected DateCalculator<LocalDate> createNewCalculator(String name,
                                                        LocalDate startDate,
                                                        HolidayCalendar<LocalDate> holidays,
                                                        HolidayHandler<LocalDate> handler)
Specified by:
createNewCalculator in class AbstractDateCalculator<LocalDate>

getToday

protected LocalDate getToday()
Specified by:
getToday in class AbstractDateCalculator<LocalDate>

compareDate

protected LocalDate compareDate(LocalDate date1,
                                LocalDate date2,
                                boolean returnEarliest)
Specified by:
compareDate in class AbstractDateCalculator<LocalDate>

checkBoundary

protected void checkBoundary(LocalDate date)
Description copied from class: AbstractDateCalculator
This may throw an IndexOutOfBoundsException if the date is not within the boundaries.

Specified by:
checkBoundary in class AbstractDateCalculator<LocalDate>

clone

protected LocalDate clone(LocalDate date)
Specified by:
clone in class AbstractDateCalculator<LocalDate>


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