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

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

public abstract class AbstractIMMDateCalculator<E>
extends Object
implements IMMDateCalculator<E>

Abstract implementation in order to encapsulate all the common functionality between Jdk and Joda implementations. It is parametrized on but basically Date and LocalDate are the only viable values for it for now.

Version:
$Revision: 200 $ $Date: 2006-10-10 16:15:58 -0400 (Tue, 10 Oct 2006) $
Author:
Marcin Jekot, $LastChangedBy: benoitx $

Field Summary
protected static int DAYS_IN_WEEK
           
protected static int MONTH_IN_YEAR
           
protected static int MONTHS_IN_QUARTER
           
 
Constructor Summary
AbstractIMMDateCalculator()
           
 
Method Summary
 List<E> getIMMDates(E start, E end)
          Returns a list of IMM dates between 2 dates, it will exclude the start date if it is an IMM date but would include the end date if it is an IMM (same as IMMPeriod.QUARTERLY).
protected abstract  E getNextIMMDate(boolean requestNextIMM, E theStartDate, IMMPeriod period)
           
 E getNextIMMDate(E startDate)
          Given a start date, it will return the next IMM Date, even if the start date is an IMM date (same as calling getNextIMMDate(IMMPeriod.QUARTERLY)).
 E getNextIMMDate(E startDate, IMMPeriod period)
          Given a start date, it will return the next IMM Date based on the IMMPeriod, even if the start date is an IMM date.
 E getPreviousIMMDate(E startDate)
          Given a start date, it will return the previous IMM Date, even if the start date is an IMM date.
 E getPreviousIMMDate(E startDate, IMMPeriod period)
          Given a start date, it will return the previous IMM Date based on the IMMPeriod, even if the start date is an IMM date.
 
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.IMMDateCalculator
getIMMDates, isIMMDate
 

Field Detail

MONTHS_IN_QUARTER

protected static final int MONTHS_IN_QUARTER
See Also:
Constant Field Values

MONTH_IN_YEAR

protected static final int MONTH_IN_YEAR
See Also:
Constant Field Values

DAYS_IN_WEEK

protected static final int DAYS_IN_WEEK
See Also:
Constant Field Values
Constructor Detail

AbstractIMMDateCalculator

public AbstractIMMDateCalculator()
Method Detail

getNextIMMDate

public E getNextIMMDate(E startDate)
Description copied from interface: IMMDateCalculator
Given a start date, it will return the next IMM Date, even if the start date is an IMM date (same as calling getNextIMMDate(IMMPeriod.QUARTERLY)).

Specified by:
getNextIMMDate in interface IMMDateCalculator<E>
Parameters:
startDate -
Returns:
the next IMMDate based on current date.

getNextIMMDate

public E getNextIMMDate(E startDate,
                        IMMPeriod period)
Description copied from interface: IMMDateCalculator
Given a start date, it will return the next IMM Date based on the IMMPeriod, even if the start date is an IMM date.

Specified by:
getNextIMMDate in interface IMMDateCalculator<E>
Parameters:
startDate -
period - specify when the "next" IMM is, if quarterly then it is the conventional algorithm.
Returns:
the next IMMDate based on current date.

getPreviousIMMDate

public E getPreviousIMMDate(E startDate)
Description copied from interface: IMMDateCalculator
Given a start date, it will return the previous IMM Date, even if the start date is an IMM date.

Specified by:
getPreviousIMMDate in interface IMMDateCalculator<E>
Parameters:
startDate -
Returns:
the previous IMMDate based on current date.

getPreviousIMMDate

public E getPreviousIMMDate(E startDate,
                            IMMPeriod period)
Description copied from interface: IMMDateCalculator
Given a start date, it will return the previous IMM Date based on the IMMPeriod, even if the start date is an IMM date.

Specified by:
getPreviousIMMDate in interface IMMDateCalculator<E>
Parameters:
startDate -
period - specify when the "previous" IMM is, if quarterly then it is the conventional algorithm.
Returns:
the previous IMMDate based on current date.

getIMMDates

public List<E> getIMMDates(E start,
                           E end)
Returns a list of IMM dates between 2 dates, it will exclude the start date if it is an IMM date but would include the end date if it is an IMM (same as IMMPeriod.QUARTERLY).

Specified by:
getIMMDates in interface IMMDateCalculator<E>
Parameters:
start - start of the interval, excluded
end - end of the interval, may be included.
Returns:
list of IMM dates

getNextIMMDate

protected abstract E getNextIMMDate(boolean requestNextIMM,
                                    E theStartDate,
                                    IMMPeriod period)


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