E
- a representation of a date, typically JDK: Date, Calendar;
Joda:LocalDate, YearMonthDaypublic interface DateCalculator<E> extends BaseCalculator<E>
Modifier and Type | Method and Description |
---|---|
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.
|
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).
|
E |
forceCurrentDateNoAdjustment(E date)
Gives a current business date, it will NOT be moved.
|
HolidayCalendar<E> |
getHolidayCalendar()
Returns an immutable version of the HolidayCalendar.
|
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.
|
int |
getNumberOfBusinessDaysBetween(E d1,
E d2)
Number of non weekend, non holidays days between d1 and d2, using the Holiday Handler type to match
what the method moveByBusinessDays requires.
|
E |
getStartDate()
Gives the startDate of this calculator (immutable once set via
setStartDate).
|
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 |
isWeekend(E date)
Is the given date falling on a weekend, according to the WorkingWeek.
|
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.
|
DateCalculator<E> |
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<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, please note that all tenors are
relative to the SPOT day which is a number of days from the current date.
|
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 increment)
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> |
setStartDate(E startDate)
Setting the start date also sets the current business date (and if this
is a non-working day, the current business date will be moved to the next
business day according to the HolidayHandler algorithm given).
|
DateCalculator<E> |
setWorkingWeek(WorkingWeek week)
Allows user to define what their Working Week should be (default is
Mon-Fri).
|
getCurrentBusinessDate, getCurrentIncrement
isNonWorkingDay
String getName()
DateCalculator<E> setStartDate(E startDate)
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).E getStartDate()
boolean isWeekend(E date)
boolean isCurrentDateNonWorking()
DateCalculator<E> setHolidayCalendar(HolidayCalendar<E> calendar)
calendar
- the holiday calendar (if null, no holidays taken into account)HolidayCalendar<E> getHolidayCalendar()
DateCalculator<E> setWorkingWeek(WorkingWeek week)
week
- an immutable definition of a week.E setCurrentBusinessDate(E date)
date
- E forceCurrentDateNoAdjustment(E date)
date
- String getHolidayHandlerType()
DateCalculator<E> moveByDays(int days)
days
- number of days (can be <0 or >0)DateCalculator<E> moveByBusinessDays(int businessDays)
businessDays
- (can be <0 or >0)IllegalArgumentException
- if the HolidayHandlerType is (MODIFIED_PRECEDING or
BACKWARD) and businessDays > 0 or (MODIFIED_FOLLOWING or
FORWARD) and businessDays < 0DateCalculator<E> combine(DateCalculator<E> calculator)
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; Also, it is required that BOTH calendars either
have Early/Late Boundaries or none.DateCalculator<E> moveByTenor(Tenor tenor, int spotLag)
tenor
- the Tenor to reach.spotLag
- number of days to "spot" days, this can vary from one market
to the other. It is sometimes called "settlement interval"
or "offset".DateCalculator<E> moveByTenor(Tenor tenor)
tenor
- the Tenor to reach.List<E> calculateTenorDates(List<Tenor> tenors)
List<E> calculateTenorDates(List<Tenor> tenors, int spotLag)
DateCalculator<E> setCurrentIncrement(int increment)
increment
- int getNumberOfBusinessDaysBetween(E d1, E d2)
d1
- start dated2
- end dateCopyright © 2006–2022 Appendium - Portfolio Financing Platform. All rights reserved.