E - a representation of a date, typically JDK: Date, Calendar;
            Joda:LocalDate, YearMonthDaypublic abstract class AbstractDateCalculator<E extends Serializable> extends Object implements DateCalculator<E>
Date and LocalDate are the only
 viable values for it for now.| Modifier and Type | Field and Description | 
|---|---|
protected static int | 
DAYS_IN_WEEK  | 
| Modifier | Constructor and Description | 
|---|---|
protected  | 
AbstractDateCalculator(String name,
                      HolidayCalendar<E> holidayCalendar,
                      HolidayHandler<E> holidayHandler)  | 
| Modifier and Type | Method and Description | 
|---|---|
protected DateCalculator<E> | 
applyTenor(TenorCode tenorCode,
          int unit)  | 
List<E> | 
calculateTenorDates(List<Tenor> tenors)
Calculate a series of Tenor codes in one go based on current day,
 this does NOT change the current business date. 
 | 
List<E> | 
calculateTenorDates(List<Tenor> tenors,
                   int spotLag)
Calculate a series of Tenor codes in one go based on SPOT day (calculated
 with the spot lag), this does NOT change the current business date. 
 | 
protected abstract void | 
checkBoundary(E date)
This may throw an  
IndexOutOfBoundsException if the date is not within the
 boundaries. | 
protected abstract E | 
clone(E date)  | 
DateCalculator<E> | 
combine(DateCalculator<E> calculator)
Allows DateCalculators to be combined into a new one, the startDate and
 currentBusinessDate will be the ones from the existing calendar (not the
 parameter one). 
 | 
protected abstract E | 
compareDate(E date1,
           E date2,
           boolean returnEarliest)  | 
protected abstract DateCalculator<E> | 
createNewCalculator(String calcName,
                   E theStartDate,
                   HolidayCalendar<E> holidays,
                   HolidayHandler<E> handler)  | 
E | 
forceCurrentDateNoAdjustment(E date)
Gives a current business date, it will NOT be moved. 
 | 
E | 
getCurrentBusinessDate()
Gives the current business date held by the calculator. 
 | 
int | 
getCurrentIncrement()
return the current increment in the calculator, this is used by the
 handler. 
 | 
HolidayCalendar<E> | 
getHolidayCalendar()
Returns an immutable version of the HolidayCalendar. 
 | 
HolidayHandler<E> | 
getHolidayHandler()  | 
String | 
getHolidayHandlerType()
Gives the name of the holiday handler algorithm, see HolidayHandlerType
 for some standard values. 
 | 
String | 
getName()
This is typically the name of the associated set of holidays. 
 | 
E | 
getStartDate()
Gives the startDate of this calculator (immutable once set via
 setStartDate). 
 | 
protected abstract E | 
getToday()  | 
boolean | 
isCurrentDateNonWorking()
Is the current business day a non-working day, this is useful if the
 calculator does not have any algorithm to change the date when it falls
 on a non-working day. 
 | 
boolean | 
isNonWorkingDay(E date)
is the given date a non working day? 
 | 
DateCalculator<E> | 
moveByBusinessDays(int businessDays)
This changes the current business date held in the calculator, it moves
 the current date by a number of business days, this means that if a date
 is either a 'weekend' or holiday along the way, it will be skipped
 according to the holiday handler and not count towards the number of days
 to move. 
 | 
protected abstract DateCalculator<E> | 
moveByMonths(int months)  | 
DateCalculator<E> | 
moveByTenor(Tenor tenor)
Move the current date by a given tenor, please note that all tenors are
 relative to the CURRENT day (and NOT from spot). 
 | 
DateCalculator<E> | 
moveByTenor(Tenor tenor,
           int spotLag)
move the current date by a given tenor, this means that if a date is
 either a 'weekend' or holiday, it will be skipped according to the holiday
 handler and not count towards the number of days to move. 
 | 
protected void | 
moveToSpotDate(int spotLag)  | 
E | 
setCurrentBusinessDate(E date)
Gives a current business date, it may be moved according to the
 HolidayHandler algorithm if it falls on a non-working day. 
 | 
DateCalculator<E> | 
setCurrentIncrement(int currentIncrement)
This would be used by delegate methods to detect if the increment
 if positive or negative (this will allow us to define a Handler
 that can act as Forward if positive and Backward if negative). 
 | 
DateCalculator<E> | 
setHolidayCalendar(HolidayCalendar<E> calendar)
This is typically used at the construction of a DateCalculator to give a
 reference to a Holiday Calendar, if not the case, the calculator will
 make an immutable copy of the HolidayCalendar. 
 | 
DateCalculator<E> | 
setHolidayHandler(HolidayHandler<E> holidayHandler)  | 
void | 
setName(String name)  | 
DateCalculator<E> | 
setStartDate(E startDate)
Set both start date and current date 
 | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetNumberOfBusinessDaysBetween, isWeekend, moveByDays, setWorkingWeekprotected static final int DAYS_IN_WEEK
protected AbstractDateCalculator(String name, HolidayCalendar<E> holidayCalendar, HolidayHandler<E> holidayHandler)
public DateCalculator<E> setHolidayCalendar(HolidayCalendar<E> calendar)
DateCalculatorsetHolidayCalendar in interface DateCalculator<E extends Serializable>calendar - the holiday calendar (if null, no holidays taken into account)public String getName()
DateCalculatorgetName in interface DateCalculator<E extends Serializable>public void setName(String name)
public E getStartDate()
DateCalculatorgetStartDate in interface DateCalculator<E extends Serializable>public DateCalculator<E> setStartDate(E startDate)
setStartDate in interface DateCalculator<E extends Serializable>startDate - the reference date for this calculator, the current business
            date is also updated and may be moved if it falls on a non
            working day (holiday/weekend).public E getCurrentBusinessDate()
BaseCalculatorgetCurrentBusinessDate in interface BaseCalculator<E extends Serializable>public DateCalculator<E> moveByTenor(Tenor tenor, int spotLag)
moveByTenor in interface DateCalculator<E extends Serializable>tenor - the tenor.spotLag - number of days to "spot" days, this can vary from one market
            to the other.protected DateCalculator<E> applyTenor(TenorCode tenorCode, int unit)
public DateCalculator<E> moveByTenor(Tenor tenor)
moveByTenor in interface DateCalculator<E extends Serializable>tenor - the Tenor to reach.public List<E> calculateTenorDates(List<Tenor> tenors)
calculateTenorDates in interface DateCalculator<E extends Serializable>public List<E> calculateTenorDates(List<Tenor> tenors, int spotLag)
calculateTenorDates in interface DateCalculator<E extends Serializable>protected abstract DateCalculator<E> moveByMonths(int months)
public DateCalculator<E> setHolidayHandler(HolidayHandler<E> holidayHandler)
public String getHolidayHandlerType()
DateCalculatorgetHolidayHandlerType in interface DateCalculator<E extends Serializable>public boolean isNonWorkingDay(E date)
isNonWorkingDay in interface NonWorkingDayChecker<E extends Serializable>protected abstract void checkBoundary(E date)
IndexOutOfBoundsException if the date is not within the
 boundaries.date - public boolean isCurrentDateNonWorking()
DateCalculatorisCurrentDateNonWorking in interface DateCalculator<E extends Serializable>public E forceCurrentDateNoAdjustment(E date)
DateCalculatorforceCurrentDateNoAdjustment in interface DateCalculator<E extends Serializable>public E setCurrentBusinessDate(E date)
DateCalculatorsetCurrentBusinessDate in interface DateCalculator<E extends Serializable>public HolidayHandler<E> getHolidayHandler()
protected void moveToSpotDate(int spotLag)
public DateCalculator<E> moveByBusinessDays(int businessDays)
DateCalculatormoveByBusinessDays in interface DateCalculator<E extends Serializable>businessDays - (can be <0 or >0)public DateCalculator<E> combine(DateCalculator<E> calculator)
combine in interface DateCalculator<E extends Serializable>calculator - return the same DateCalculator if calendar is null or the
            original calendar (but why would you want to do that?)IllegalArgumentException - if both calendars have different types of HolidayHandlers or
             WorkingWeek;protected abstract E getToday()
protected abstract DateCalculator<E> createNewCalculator(String calcName, E theStartDate, HolidayCalendar<E> holidays, HolidayHandler<E> handler)
public int getCurrentIncrement()
BaseCalculatorgetCurrentIncrement in interface BaseCalculator<E extends Serializable>public DateCalculator<E> setCurrentIncrement(int currentIncrement)
DateCalculatorsetCurrentIncrement in interface DateCalculator<E extends Serializable>currentIncrement - The currentIncrement to set.public HolidayCalendar<E> getHolidayCalendar()
DateCalculatorgetHolidayCalendar in interface DateCalculator<E extends Serializable>Copyright © 2006–2022 Appendium - Portfolio Financing Platform. All rights reserved.