net.finmath.time.businessdaycalendar
Class BusinessdayCalendar
- java.lang.Object
-
- net.finmath.time.businessdaycalendar.BusinessdayCalendar
-
- All Implemented Interfaces:
- BusinessdayCalendarInterface
- Direct Known Subclasses:
- BusinessdayCalendarAny, BusinessdayCalendarExcludingTARGETHolidays, BusinessdayCalendarExcludingWeekends
public abstract class BusinessdayCalendar extends java.lang.Object implements BusinessdayCalendarInterface
Base class for all business day calendars. Implements date rolling and date adjustment. For the supported date roll conventions seeBusinessdayCalendarInterface.DateRollConvention.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.finmath.time.businessdaycalendar.BusinessdayCalendarInterface
BusinessdayCalendarInterface.DateRollConvention
-
-
Constructor Summary
Constructors Constructor and Description BusinessdayCalendar()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description static java.util.CalendarcreateDateFromDateAndOffsetCode(java.util.Calendar baseDate, java.lang.String dateOffsetCode)Create a new date by "adding" a year fraction to a given base date.java.util.CalendargetAdjustedDate(java.util.Calendar date, BusinessdayCalendarInterface.DateRollConvention dateRollConvention)Get an adjusted date for a given date.java.util.CalendargetAdjustedDate(java.util.Calendar baseDate, java.lang.String dateOffsetCode, BusinessdayCalendarInterface.DateRollConvention dateRollConvention)Get an adjusted date for a given date and offset code.java.util.DategetAdjustedDate(java.util.Date baseDate, java.lang.String dateOffsetCode, BusinessdayCalendarInterface.DateRollConvention dateRollConvention)Get an adjusted date for a given date and offset code.java.util.CalendargetRolledDate(java.util.Calendar baseDate, int businessDays)Find a new date by adding the given number of business days to a given base date.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.finmath.time.businessdaycalendar.BusinessdayCalendarInterface
isBusinessday
-
-
-
-
Method Detail
-
getAdjustedDate
public java.util.Calendar getAdjustedDate(java.util.Calendar date, BusinessdayCalendarInterface.DateRollConvention dateRollConvention)Description copied from interface:BusinessdayCalendarInterfaceGet an adjusted date for a given date. Sincejava.util.Calendaris not immutable this method has to return a clone of date, even if the roll convention is not resulting in an adjustment.- Specified by:
getAdjustedDatein interfaceBusinessdayCalendarInterface- Parameters:
date- Given date to be adjusted.dateRollConvention- The date roll convention to be used for the adjustment.- Returns:
- The adjusted date applying dateRollConvention to the given date.
-
getAdjustedDate
public java.util.Calendar getAdjustedDate(java.util.Calendar baseDate, java.lang.String dateOffsetCode, BusinessdayCalendarInterface.DateRollConvention dateRollConvention)Description copied from interface:BusinessdayCalendarInterfaceGet an adjusted date for a given date and offset code. Sincejava.util.Calendaris not immutable this method has to return a clone of baseDate, even if the roll convention is not resulting in an adjustment. First we create a new date by "adding" an offset to the base date. The offset may be given by codes like 1D, 2D, 1W, 2W, 1M, 2M, 3M, 1Y, 2Y, etc., where the letters denote the units as follows: D denotes days, W denotes weeks, M denotes month Y denotes years. Next the result is adjusted according to the given dateRollConvention.- Specified by:
getAdjustedDatein interfaceBusinessdayCalendarInterface- Parameters:
baseDate- The start date.dateOffsetCode- String containing date offset codes (like 2D, 1W, 3M, etc.) or combination of them separated by spaces.dateRollConvention- The date roll convention to be used for the adjustment.- Returns:
- The adjusted date applying dateRollConvention to the given date.
-
getRolledDate
public java.util.Calendar getRolledDate(java.util.Calendar baseDate, int businessDays)Description copied from interface:BusinessdayCalendarInterfaceFind a new date by adding the given number of business days to a given base date. Sincejava.util.Calendaris not immutable this method has to return a clone of baseDate, even if the roll convention is not resulting in an adjustment. If baseDate is not a business date and businessDays is zero, the method returns the next business day.- Specified by:
getRolledDatein interfaceBusinessdayCalendarInterface- Parameters:
baseDate- The starting date.businessDays- The number of business days from the starting date (negative values are allowed).- Returns:
- A date of a business day such that the number of business days between this one (including) and the start date (excluding) is businessDays.
-
getAdjustedDate
public java.util.Date getAdjustedDate(java.util.Date baseDate, java.lang.String dateOffsetCode, BusinessdayCalendarInterface.DateRollConvention dateRollConvention)Get an adjusted date for a given date and offset code. First we create a new date by "adding" an offset to the base date. The offset may be given by codes like 1D, 2D, 1W, 2W, 1M, 2M, 3M, 1Y, 2Y, etc., where the letters denote the units as follows: D denotes days, W denotes weeks, M denotes month Y denotes years. Next the result is adjusted according to the given dateRollConvention.- Parameters:
baseDate- The start date.dateOffsetCode- String containing date offset codes (like 2D, 1W, 3M, etc.) or combination of them separated by spaces.dateRollConvention- The date roll convention to be used for the adjustment.- Returns:
- The adjusted date applying dateRollConvention to the given date.
-
createDateFromDateAndOffsetCode
public static java.util.Calendar createDateFromDateAndOffsetCode(java.util.Calendar baseDate, java.lang.String dateOffsetCode)Create a new date by "adding" a year fraction to a given base date.The date offset may be given by codes like 1D, 2D, 1W, 2W, 1M, 2M, 3M, 1Y, 2Y, etc., where the letters denote the units as follows: D denotes days, W denotes weeks, M denotes month Y denotes years. If the date offset does not carry a letter code at the end, it will be interpreted as ACT/365 year fraction.
The function may be used to ease the creation of maturities in spreadsheets.
- Parameters:
baseDate- The start date.dateOffsetCode- String containing date offset codes (like 2D, 1W, 3M, etc.) or combination of them separated by spaces.- Returns:
- A date corresponding the date adding the offset to the start date.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG