Class DefaultNoHolidayBusinessCalendar

All Implemented Interfaces:
BusinessCalendar, Calendar

public class DefaultNoHolidayBusinessCalendar extends AbstractBusinessCalendar
A BusinessCalendar with no non-business days.
  • Constructor Details

    • DefaultNoHolidayBusinessCalendar

      protected DefaultNoHolidayBusinessCalendar(BusinessCalendar calendar)
      Creates a new Default24HourBusinessCalendar instance. Assumes that calendar is a BusinessCalendar with no holidays and a 24 hour business day.
      Parameters:
      calendar - BusinessCalendar with no holidays and a 24 hour business day
  • Method Details

    • getDefaultBusinessPeriods

      public List<String> getDefaultBusinessPeriods()
      Description copied from interface: BusinessCalendar
      Gets the business periods for the default days.
      Returns:
      a list of strings with a comma separating open and close times
    • getHolidays

      public Map<LocalDate,BusinessSchedule> getHolidays()
      Description copied from interface: BusinessCalendar
      Gets business schedules for dates that are different from the defaults. This returns all dates that are defined as a holiday for the calendar.
      Returns:
      a map of dates and to their business periods
    • isBusinessDay

      public boolean isBusinessDay(DayOfWeek day)
      Description copied from interface: BusinessCalendar
      Is the day of the week a business day? A business day is a day that has a business schedule with one or more business periods defined.
      Parameters:
      day - a day of the week
      Returns:
      true if the day is a business day; false otherwise.
    • name

      public String name()
      Description copied from interface: Calendar
      Gets the name of the calendar.
      Returns:
      the name of the calendar
    • timeZone

      public DBTimeZone timeZone()
      Description copied from interface: Calendar
      Gets the timezone of the calendar.
      Returns:
      the time zone of the calendar
    • standardBusinessDayLengthNanos

      public long standardBusinessDayLengthNanos()
      Description copied from interface: BusinessCalendar
      Returns the length of a standard business day in nanoseconds.
      Returns:
      length of a standard business day in nanoseconds.
    • getBusinessDay

      @Deprecated public BusinessSchedule getBusinessDay(DBDateTime time)
      Deprecated.
      Description copied from interface: BusinessCalendar
      Gets the indicated business day.
      Parameters:
      time - time
      Returns:
      the corresponding BusinessSchedule of time; null if time is null
    • getBusinessDay

      @Deprecated public BusinessSchedule getBusinessDay(String date)
      Deprecated.
      Description copied from interface: BusinessCalendar
      Gets the indicated business day.
      Parameters:
      date - date
      Returns:
      the corresponding BusinessSchedule of date
    • getBusinessDay

      @Deprecated public BusinessSchedule getBusinessDay(LocalDate date)
      Deprecated.
      Description copied from interface: BusinessCalendar
      Gets the indicated business day.
      Parameters:
      date - date
      Returns:
      the corresponding BusinessSchedule of date
    • getBusinessSchedule

      public BusinessSchedule getBusinessSchedule(DBDateTime time)
      Description copied from interface: BusinessCalendar
      Gets the indicated business day's schedule. getBusinessSchedule(null) returns null.
      Parameters:
      time - time
      Returns:
      the corresponding BusinessSchedule of time; null if time is null
    • getBusinessSchedule

      public BusinessSchedule getBusinessSchedule(String date)
      Description copied from interface: BusinessCalendar
      Gets the indicated business day's schedule. getBusinessSchedule(null) returns null.
      Parameters:
      date - date
      Returns:
      the corresponding BusinessSchedule of date
    • getBusinessSchedule

      public BusinessSchedule getBusinessSchedule(LocalDate date)
      Description copied from interface: BusinessCalendar
      Gets the indicated business day's schedule. getBusinessSchedule(null) returns null.
      Parameters:
      date - date
      Returns:
      the corresponding BusinessSchedule of date
    • diffBusinessNanos

      public long diffBusinessNanos(DBDateTime start, DBDateTime end)
      Description copied from interface: BusinessCalendar
      Returns the amount of business time in nanoseconds between start and end.
      Parameters:
      start - start time; if null, return NULL_LONG
      end - end time; if null, return NULL_LONG
      Returns:
      the amount of business time in nanoseconds between the start and end
    • diffBusinessYear

      public double diffBusinessYear(DBDateTime startTime, DBDateTime endTime)
      Description copied from interface: BusinessCalendar
      Returns the number of business years between start and end.
      Parameters:
      startTime - start; if null, return null
      endTime - end; if null, return null
      Returns:
      the amount of business time in business years between the start and end
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • previousNonBusinessDay

      public String previousNonBusinessDay()
      Description copied from interface: BusinessCalendar
      Gets the previous non-business day.
      Returns:
      the most recent non-business day before the current day
    • previousNonBusinessDay

      public String previousNonBusinessDay(int days)
      Description copied from interface: BusinessCalendar
      Gets the non-business date days non-business days before the current day. If days is zero and the day is a business day, null is returned.
      Parameters:
      days - number of days
      Returns:
      the non-business date days non-business days before the current day
    • previousNonBusinessDay

      public String previousNonBusinessDay(DBDateTime time)
      Description copied from interface: BusinessCalendar
      Gets the previous non-business day.
      Specified by:
      previousNonBusinessDay in interface BusinessCalendar
      Overrides:
      previousNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      time - time; if null, return null
      Returns:
      the most recent non-business day before time
    • previousNonBusinessDay

      public String previousNonBusinessDay(DBDateTime time, int days)
      Description copied from interface: BusinessCalendar
      Gets the non-business date days non-business days before input time. If days is zero and the day is a business day, null is returned.
      Specified by:
      previousNonBusinessDay in interface BusinessCalendar
      Overrides:
      previousNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      time - time; if null, return null
      days - number of days
      Returns:
      the non-business date days non-business days before input time
    • previousNonBusinessDay

      public String previousNonBusinessDay(String date)
      Description copied from interface: BusinessCalendar
      Gets the previous non-business day.
      Specified by:
      previousNonBusinessDay in interface BusinessCalendar
      Overrides:
      previousNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      date - date; if null, return null
      Returns:
      the most recent non-business day before date
    • previousNonBusinessDay

      public String previousNonBusinessDay(String date, int days)
      Description copied from interface: BusinessCalendar
      Gets the non-business date days non-business days before input date. If days is zero and the day is a business day, null is returned.
      Specified by:
      previousNonBusinessDay in interface BusinessCalendar
      Overrides:
      previousNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      date - date; if null, return null
      days - number of days
      Returns:
      the non-business date days non-business days before input date
    • nextNonBusinessDay

      public String nextNonBusinessDay()
      Description copied from interface: BusinessCalendar
      Gets the next non-business day.
      Returns:
      the next non-business day after the current day
    • nextNonBusinessDay

      public String nextNonBusinessDay(int days)
      Description copied from interface: BusinessCalendar
      Gets the non-business date days non-business days after the current day. If days is zero and the day is a business day, null is returned.
      Parameters:
      days - number of days
      Returns:
      the non-business date days non-business days after the current day
    • nextNonBusinessDay

      public String nextNonBusinessDay(DBDateTime time)
      Description copied from interface: BusinessCalendar
      Gets the next non-business day.
      Specified by:
      nextNonBusinessDay in interface BusinessCalendar
      Overrides:
      nextNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      time - time; if null, return null
      Returns:
      the next non-business day after time
    • nextNonBusinessDay

      public String nextNonBusinessDay(DBDateTime time, int days)
      Description copied from interface: BusinessCalendar
      Gets the non-business date days non-business days after input time. If days is zero and the day is a business day, null is returned.
      Specified by:
      nextNonBusinessDay in interface BusinessCalendar
      Overrides:
      nextNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      time - time; if null, return null
      days - number of days
      Returns:
      the non-business date days non-business days after input time
    • nextNonBusinessDay

      public String nextNonBusinessDay(String date)
      Description copied from interface: BusinessCalendar
      Gets the next non-business day.
      Specified by:
      nextNonBusinessDay in interface BusinessCalendar
      Overrides:
      nextNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      date - date; if null, return null
      Returns:
      the next non-business day after date
    • nextNonBusinessDay

      public String nextNonBusinessDay(String date, int days)
      Description copied from interface: BusinessCalendar
      Gets the non-business date days non-business days after input date. If days is zero and the day is a business day, null is returned.
      Specified by:
      nextNonBusinessDay in interface BusinessCalendar
      Overrides:
      nextNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      date - date; if null, return null
      days - number of days
      Returns:
      the most recent business day before time
    • nonBusinessDaysInRange

      public String[] nonBusinessDaysInRange(DBDateTime start, DBDateTime end)
      Description copied from interface: BusinessCalendar
      Returns the non-business days between start and end, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days for start and end will be included if they are non-business days.
      Specified by:
      nonBusinessDaysInRange in interface BusinessCalendar
      Overrides:
      nonBusinessDaysInRange in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return empty array
      end - end time; if null, return empty array
      Returns:
      inclusive non-business days between start and end
    • nonBusinessDaysInRange

      public String[] nonBusinessDaysInRange(String start, String end)
      Description copied from interface: BusinessCalendar
      Returns the non-business days between start and end, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days for start and end will be included if they are non-business days.
      Specified by:
      nonBusinessDaysInRange in interface BusinessCalendar
      Overrides:
      nonBusinessDaysInRange in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return empty array
      end - end time; if null, return empty array
      Returns:
      inclusive non-business days between start and end
    • diffNonBusinessNanos

      public long diffNonBusinessNanos(DBDateTime start, DBDateTime end)
      Description copied from interface: BusinessCalendar
      Returns the amount of non-business time in nanoseconds between start and end.
      Specified by:
      diffNonBusinessNanos in interface BusinessCalendar
      Overrides:
      diffNonBusinessNanos in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return NULL_LONG
      end - end time; if null, return NULL_LONG
      Returns:
      the amount of non-business time in nanoseconds between the start and end
    • diffNonBusinessDay

      public double diffNonBusinessDay(DBDateTime start, DBDateTime end)
      Description copied from interface: BusinessCalendar
      Returns the amount of non-business time in standard business days between start and end.
      Specified by:
      diffNonBusinessDay in interface BusinessCalendar
      Overrides:
      diffNonBusinessDay in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return NULL_LONG
      end - end time; if null, return NULL_LONG
      Returns:
      the amount of non-business time in standard business days between the start and end
    • numberOfNonBusinessDays

      public int numberOfNonBusinessDays(DBDateTime start, DBDateTime end)
      Description copied from interface: BusinessCalendar
      Returns the number of non-business days between start and end.
      Specified by:
      numberOfNonBusinessDays in interface BusinessCalendar
      Overrides:
      numberOfNonBusinessDays in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return NULL_INT
      end - end time; if null, return NULL_INT
      Returns:
      number of business days between the start and end, inclusive and exclusive respectively.
    • numberOfNonBusinessDays

      public int numberOfNonBusinessDays(DBDateTime start, DBDateTime end, boolean endInclusive)
      Description copied from interface: BusinessCalendar
      Returns the number of non-business days between start and end.
      Specified by:
      numberOfNonBusinessDays in interface BusinessCalendar
      Overrides:
      numberOfNonBusinessDays in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return NULL_LONG
      end - end time; if null, return NULL_LONG
      endInclusive - whether to treat the end inclusive or exclusively
      Returns:
      number of business days between the start and end, inclusive and endInclusive respectively.
    • numberOfNonBusinessDays

      public int numberOfNonBusinessDays(String start, String end)
      Description copied from interface: BusinessCalendar
      Returns the number of non-business days between start and end.
      Specified by:
      numberOfNonBusinessDays in interface BusinessCalendar
      Overrides:
      numberOfNonBusinessDays in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return NULL_INT
      end - end time; if null, return NULL_INT
      Returns:
      number of non-business days between the start and end, inclusive.
    • numberOfNonBusinessDays

      public int numberOfNonBusinessDays(String start, String end, boolean endInclusive)
      Description copied from interface: BusinessCalendar
      Returns the number of non-business days between start and end.
      Specified by:
      numberOfNonBusinessDays in interface BusinessCalendar
      Overrides:
      numberOfNonBusinessDays in class AbstractBusinessCalendar
      Parameters:
      start - start time; if null, return NULL_INT
      end - end time; if null, return NULL_INT
      endInclusive - whether to treat the end inclusive or exclusively
      Returns:
      number of non-business days between the start and end, inclusive and endInclusive respectively.
    • getRawData

      @NotNull public byte[] getRawData()
      Description copied from interface: BusinessCalendar
      For use in the web API server, so we can get the raw calendar data for shipping to clients.
      Returns:
      the raw data used to construct this calendar, may be null if the raw data is not available