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 TypeMethodDescriptionlong
diffBusinessNanos
(DBDateTime start, DBDateTime end) Returns the amount of business time in nanoseconds betweenstart
andend
.double
diffBusinessYear
(DBDateTime startTime, DBDateTime endTime) Returns the number of business years betweenstart
andend
.boolean
getBusinessDay
(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.int
hashCode()
boolean
isBusinessDay
(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.long
Returns 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, previousNonBusinessDay
Methods 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, previousDay
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.illumon.util.calendar.BusinessCalendar
currentBusinessSchedule, fractionOfStandardBusinessDay, isBusinessDay, isLastBusinessDayOfMonth, isLastBusinessDayOfWeek, nextBusinessDay, nextBusinessDay, nextBusinessSchedule, nextBusinessSchedule, nextNonBusinessDay, nextNonBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessSchedule, previousBusinessSchedule, previousNonBusinessDay, previousNonBusinessDay
Methods 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:BusinessCalendar
Gets the business periods for the default days.- Specified by:
getDefaultBusinessPeriods
in interfaceBusinessCalendar
- Returns:
- a list of strings with a comma separating open and close times
-
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.- Specified by:
getHolidays
in interfaceBusinessCalendar
- Returns:
- a map of dates and to their business periods
-
isBusinessDay
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.- Specified by:
isBusinessDay
in interfaceBusinessCalendar
- Parameters:
day
- a day of the week- Returns:
- true if the day is a business day; false otherwise.
-
name
Description copied from interface:Calendar
Gets the name of the calendar. -
timeZone
Description copied from interface:Calendar
Gets the timezone of the calendar. -
standardBusinessDayLengthNanos
public long standardBusinessDayLengthNanos()Description copied from interface:BusinessCalendar
Returns the length of a standard business day in nanoseconds.- Specified by:
standardBusinessDayLengthNanos
in interfaceBusinessCalendar
- Returns:
- length of a standard business day in nanoseconds.
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendar
Gets the indicated business day.- Specified by:
getBusinessDay
in interfaceBusinessCalendar
- Parameters:
time
- time- Returns:
- the corresponding BusinessSchedule of
time
; null if time is null
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendar
Gets the indicated business day.- Specified by:
getBusinessDay
in interfaceBusinessCalendar
- Parameters:
date
- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendar
Gets the indicated business day.- Specified by:
getBusinessDay
in interfaceBusinessCalendar
- Parameters:
date
- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessSchedule
Description copied from interface:BusinessCalendar
Gets the indicated business day's schedule.getBusinessSchedule(null)
returnsnull
.- Specified by:
getBusinessSchedule
in interfaceBusinessCalendar
- Parameters:
time
- time- Returns:
- the corresponding BusinessSchedule of
time
; null if time is null
-
getBusinessSchedule
Description copied from interface:BusinessCalendar
Gets the indicated business day's schedule.getBusinessSchedule(null)
returnsnull
.- Specified by:
getBusinessSchedule
in interfaceBusinessCalendar
- Parameters:
date
- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessSchedule
Description copied from interface:BusinessCalendar
Gets the indicated business day's schedule.getBusinessSchedule(null)
returnsnull
.- Specified by:
getBusinessSchedule
in interfaceBusinessCalendar
- Parameters:
date
- date- Returns:
- the corresponding BusinessSchedule of
date
-
getLastHoliday
Description copied from interface:BusinessCalendar
Gets the date of the last holiday defined in the calendar.- Specified by:
getLastHoliday
in interfaceBusinessCalendar
- Returns:
- the date of the last holiday, or
LocalDate.MAX
if no holiday dates are defined
-
diffBusinessNanos
Description copied from interface:BusinessCalendar
Returns the amount of business time in nanoseconds betweenstart
andend
.- Specified by:
diffBusinessNanos
in 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
start
andend
-
diffBusinessYear
Description copied from interface:BusinessCalendar
Returns the number of business years betweenstart
andend
.- Specified by:
diffBusinessYear
in interfaceBusinessCalendar
- Parameters:
startTime
- start; if null, return nullendTime
- end; if null, return null- Returns:
- the amount of business time in business years between the
start
andend
-
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:
getRawData
in 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()
-