Documentation of 'org.jfin.date.holiday.HolidayCalendar' Java class
HolidayCalendar
org.jfin.date.holiday

Class HolidayCalendar<T extends Period>

  • Direct Known Subclasses:
    FinancialCalendarHolidayCalendar, HolidayCalendarSet, WeekendHolidayCalendar


    public abstract class HolidayCalendar<T extends Period>
    extends java.lang.Object
    Abstract template class for all HolidayCalendar implementations. Provides reference implementations for adjusting Calendars by a business day or by a specific amount, adjust Calendars and Periods, and find the business days between two dates. In some implementations of the concrete HolidayCalendar it may be possible to create higher performance calculations and adjustments.
    • Constructor Summary

      Constructors 
      Constructor and Description
      HolidayCalendar() 
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method and Description
      java.util.Calendar adjust(java.util.Calendar calendar, BusinessDayConvention businessDayConvention)
      Adjust the financial date using the given business day convention and holiday calendar.
      java.util.List<T> adjust(java.util.List<T> periods, BusinessDayConvention businessDayConvention)
      Adjust the dates in the financial periods using the given business day convention and holiday calendar.
      T adjust(T period, BusinessDayConvention businessDayConvention)
      Adjust the dates in the financial period using the given business day convention and holiday calendar.
      java.util.Calendar advance(java.util.Calendar calendar, int offsetAmount, int offsetUnit, BusinessDayConvention businessDayConvention) 
      java.util.Calendar advanceBusinessDays(java.util.Calendar calendar, int offsetAmount)
      Advances the date by offsetAmount business days according to the given holiday calendar.
      long getBusinessDaysBetween(java.util.Calendar startCalendar, java.util.Calendar endCalendar)
      Returns the number of business days between two Calendars.
      static int getDaysInMonth(java.util.Calendar calendar)
      Returns the number of days in the current month.
      abstract boolean isHoliday(java.util.Calendar d)
      Returns true if the Calendar falls on a holiday or a weekend, otherwise false.
      static boolean isLastDayOfMonth(java.util.Calendar calendar)
      Returns whether or not it is the last day of the month
      abstract boolean isWeekend(java.util.Calendar d)
      Returns true if the Calendar falls on a weekend, otherwise false.
      static java.util.Calendar setToEndOfMonth(java.util.Calendar calendar)
      Sets the day to the last day in this month.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HolidayCalendar

        public HolidayCalendar()
    • Method Detail

      • isWeekend

        public abstract boolean isWeekend(java.util.Calendar d)
        Returns true if the Calendar falls on a weekend, otherwise false.
        Parameters:
        d - The Calendar to check
        Returns:
        true if the Calendar is a weekend, otherwise false
      • isHoliday

        public abstract boolean isHoliday(java.util.Calendar d)
        Returns true if the Calendar falls on a holiday or a weekend, otherwise false.
        Parameters:
        d - The Calendar to check
        Returns:
        true if the Calendar is a holiday, otherwise false
      • advanceBusinessDays

        public java.util.Calendar advanceBusinessDays(java.util.Calendar calendar,
                                                      int offsetAmount)
                                               throws HolidayCalendarException
        Advances the date by offsetAmount business days according to the given holiday calendar.
        Parameters:
        calendar -
        offsetAmount - The number of business days to offset. Positive is forward, negative backwards.
        Returns:
        The offset financial date
        Throws:
        HolidayCalendarException
      • advance

        public java.util.Calendar advance(java.util.Calendar calendar,
                                          int offsetAmount,
                                          int offsetUnit,
                                          BusinessDayConvention businessDayConvention)
                                   throws HolidayCalendarException
        Parameters:
        calendar -
        offsetAmount - The amount to offset. Positive is forward, negative backwards.
        offsetUnit - The unit to offset by. Of form Calendar.DATE, Calendar.MONTH, etc.
        businessDayConvention -
        Returns:
        The offset financial date
        Throws:
        HolidayCalendarException
      • adjust

        public java.util.List<T> adjust(java.util.List<T> periods,
                                        BusinessDayConvention businessDayConvention)
                                 throws HolidayCalendarException
        Adjust the dates in the financial periods using the given business day convention and holiday calendar.
        Parameters:
        periods -
        businessDayConvention -
        Returns:
        The adjusted periods.
        Throws:
        HolidayCalendarException
      • adjust

        public java.util.Calendar adjust(java.util.Calendar calendar,
                                         BusinessDayConvention businessDayConvention)
                                  throws HolidayCalendarException
        Adjust the financial date using the given business day convention and holiday calendar.
        Parameters:
        calendar -
        businessDayConvention -
        Returns:
        The adjusted Calendar
        Throws:
        HolidayCalendarException
      • isLastDayOfMonth

        public static boolean isLastDayOfMonth(java.util.Calendar calendar)
        Returns whether or not it is the last day of the month
        Parameters:
        calendar - The calendar to check
        Returns:
        true if it is the last day of the month, otherwise false
      • setToEndOfMonth

        public static java.util.Calendar setToEndOfMonth(java.util.Calendar calendar)
        Sets the day to the last day in this month.
        Parameters:
        calendar - the calendar to modify
        Returns:
        The calendar at the last day of the month
      • getDaysInMonth

        public static int getDaysInMonth(java.util.Calendar calendar)
        Returns the number of days in the current month.
        Returns:
        the number of days (28-31)
      • getBusinessDaysBetween

        public long getBusinessDaysBetween(java.util.Calendar startCalendar,
                                           java.util.Calendar endCalendar)
                                    throws HolidayCalendarException
        Returns the number of business days between two Calendars.
        Parameters:
        startCalendar -
        endCalendar -
        Returns:
        The number of business days
        Throws:
        HolidayCalendarException

DataMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.