Package com.illumon.util.calendar
Class DefaultBusinessCalendar
java.lang.Object
com.illumon.util.calendar.AbstractCalendar
com.illumon.util.calendar.AbstractBusinessCalendar
com.illumon.util.calendar.DefaultBusinessCalendar
- All Implemented Interfaces:
BusinessCalendar,Calendar,Serializable
Default implementation for a
BusinessCalendar. This implementation is thread safe.
Overrides many default Calendar and BusinessCalendar
methods for improved performance. See the documentation of Calendar
for details.- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionlongdiffBusinessNanos(DBDateTime start, DBDateTime end) Returns the amount of business time in nanoseconds betweenstartandend.doublediffBusinessYear(DBDateTime startTime, DBDateTime endTime) Returns the number of business years betweenstartandend.booleangetBusinessDay(DBDateTime time) Deprecated.getBusinessDay(String date) Deprecated.getBusinessDay(LocalDate date) Deprecated.Gets the indicated business day's schedule.getBusinessSchedule(String date) Gets the indicated business day's schedule.getBusinessSchedule(LocalDate date) Gets the indicated business day's schedule.Gets the business periods for the default days.Gets business schedules for dates that are different from the defaults.Gets the date of the last holiday defined in the calendar.byte[]For use in the web API server, so we can get the raw calendar data for shipping to clients.inthashCode()booleanisBusinessDay(DayOfWeek day) 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.name()Gets the name of the calendar.longReturns the length of a standard business day in nanoseconds.timeZone()Gets the timezone of the calendar.toString()Methods inherited from class com.illumon.util.calendar.AbstractBusinessCalendar
businessDaysInRange, businessDaysInRange, diffBusinessDay, diffNonBusinessDay, diffNonBusinessNanos, fractionOfBusinessDayComplete, fractionOfBusinessDayRemaining, fractionOfStandardBusinessDay, fractionOfStandardBusinessDay, isBusinessDay, isBusinessDay, isBusinessDay, isBusinessTime, isLastBusinessDayOfMonth, isLastBusinessDayOfMonth, isLastBusinessDayOfWeek, isLastBusinessDayOfWeek, nextBusinessDay, nextBusinessDay, nextBusinessDay, nextBusinessDay, nextBusinessSchedule, nextBusinessSchedule, nextBusinessSchedule, nextBusinessSchedule, nextNonBusinessDay, nextNonBusinessDay, nextNonBusinessDay, nextNonBusinessDay, nonBusinessDaysInRange, nonBusinessDaysInRange, numberOfBusinessDays, numberOfBusinessDays, numberOfBusinessDays, numberOfBusinessDays, numberOfNonBusinessDays, numberOfNonBusinessDays, numberOfNonBusinessDays, numberOfNonBusinessDays, previousBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessSchedule, previousBusinessSchedule, previousBusinessSchedule, previousBusinessSchedule, previousNonBusinessDay, previousNonBusinessDay, previousNonBusinessDay, previousNonBusinessDayMethods inherited from class com.illumon.util.calendar.AbstractCalendar
dayOfWeek, dayOfWeek, daysInRange, daysInRange, diffDay, diffNanos, diffYear, nextDay, nextDay, nextDay, nextDay, numberOfDays, numberOfDays, numberOfDays, numberOfDays, previousDay, previousDay, previousDay, previousDayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.util.calendar.BusinessCalendar
currentBusinessSchedule, fractionOfStandardBusinessDay, isBusinessDay, isLastBusinessDayOfMonth, isLastBusinessDayOfWeek, nextBusinessDay, nextBusinessDay, nextBusinessSchedule, nextBusinessSchedule, nextNonBusinessDay, nextNonBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessSchedule, previousBusinessSchedule, previousNonBusinessDay, previousNonBusinessDayMethods inherited from interface com.illumon.util.calendar.Calendar
currentDay, dayOfWeek, dayOfWeek, dayOfWeek, daysInRange, daysInRange, diffDay, diffNanos, diffYear, nextDay, nextDay, nextDay, nextDay, nextDay, nextDay, numberOfDays, numberOfDays, numberOfDays, numberOfDays, previousDay, previousDay, previousDay, previousDay, previousDay, previousDay
-
Method Details
-
getDefaultBusinessPeriods
Description copied from interface:BusinessCalendarGets the business periods for the default days.- Specified by:
getDefaultBusinessPeriodsin interfaceBusinessCalendar- Returns:
- a list of strings with a comma separating open and close times
-
getHolidays
Description copied from interface:BusinessCalendarGets business schedules for dates that are different from the defaults. This returns all dates that are defined as a holiday for the calendar.- Specified by:
getHolidaysin interfaceBusinessCalendar- Returns:
- a map of dates and to their business periods
-
isBusinessDay
Description copied from interface:BusinessCalendarIs 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.- Specified by:
isBusinessDayin interfaceBusinessCalendar- Parameters:
day- a day of the week- Returns:
- true if the day is a business day; false otherwise.
-
name
Description copied from interface:CalendarGets the name of the calendar. -
timeZone
Description copied from interface:CalendarGets the timezone of the calendar. -
standardBusinessDayLengthNanos
public long standardBusinessDayLengthNanos()Description copied from interface:BusinessCalendarReturns the length of a standard business day in nanoseconds.- Specified by:
standardBusinessDayLengthNanosin interfaceBusinessCalendar- Returns:
- length of a standard business day in nanoseconds.
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendarGets the indicated business day.- Specified by:
getBusinessDayin interfaceBusinessCalendar- Parameters:
time- time- Returns:
- the corresponding BusinessSchedule of
time; null if time is null
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendarGets the indicated business day.- Specified by:
getBusinessDayin interfaceBusinessCalendar- Parameters:
date- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendarGets the indicated business day.- Specified by:
getBusinessDayin interfaceBusinessCalendar- Parameters:
date- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessSchedule
Description copied from interface:BusinessCalendarGets the indicated business day's schedule.getBusinessSchedule(null)returnsnull.- Specified by:
getBusinessSchedulein interfaceBusinessCalendar- Parameters:
time- time- Returns:
- the corresponding BusinessSchedule of
time; null if time is null
-
getBusinessSchedule
Description copied from interface:BusinessCalendarGets the indicated business day's schedule.getBusinessSchedule(null)returnsnull.- Specified by:
getBusinessSchedulein interfaceBusinessCalendar- Parameters:
date- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessSchedule
Description copied from interface:BusinessCalendarGets the indicated business day's schedule.getBusinessSchedule(null)returnsnull.- Specified by:
getBusinessSchedulein interfaceBusinessCalendar- Parameters:
date- date- Returns:
- the corresponding BusinessSchedule of
date
-
getLastHoliday
Description copied from interface:BusinessCalendarGets the date of the last holiday defined in the calendar.- Specified by:
getLastHolidayin interfaceBusinessCalendar- Returns:
- the date of the last holiday, or
LocalDate.MAXif no holiday dates are defined
-
diffBusinessNanos
Description copied from interface:BusinessCalendarReturns the amount of business time in nanoseconds betweenstartandend.- Specified by:
diffBusinessNanosin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_LONGend- end time; if null, return NULL_LONG- Returns:
- the amount of business time in nanoseconds between the
startandend
-
diffBusinessYear
Description copied from interface:BusinessCalendarReturns the number of business years betweenstartandend.- Specified by:
diffBusinessYearin interfaceBusinessCalendar- Parameters:
startTime- start; if null, return nullendTime- end; if null, return null- Returns:
- the amount of business time in business years between the
startandend
-
toString
-
equals
-
getRawData
@NotNull public byte[] getRawData()For use in the web API server, so we can get the raw calendar data for shipping to clients.- Specified by:
getRawDatain interfaceBusinessCalendar- Returns:
- the raw data used to construct this calendar, may be null if the raw data is not available
- Throws:
IllegalArgumentException- if the
-
hashCode
public int hashCode()
-