Package com.illumon.util.calendar
Class DefaultNoHolidayBusinessCalendar
java.lang.Object
com.illumon.util.calendar.AbstractCalendar
com.illumon.util.calendar.AbstractBusinessCalendar
com.illumon.util.calendar.DefaultNoHolidayBusinessCalendar
- All Implemented Interfaces:
BusinessCalendar
,Calendar
public class DefaultNoHolidayBusinessCalendar extends AbstractBusinessCalendar
A
BusinessCalendar
with no non-business days.-
Constructor Summary
Constructors Modifier Constructor Description protected
DefaultNoHolidayBusinessCalendar(BusinessCalendar calendar)
Creates a new Default24HourBusinessCalendar instance. -
Method Summary
Modifier and Type Method Description long
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
.double
diffNonBusinessDay(DBDateTime start, DBDateTime end)
Returns the amount of non-business time in standard business days betweenstart
andend
.long
diffNonBusinessNanos(DBDateTime start, DBDateTime end)
Returns the amount of non-business time in nanoseconds betweenstart
andend
.boolean
equals(Object obj)
BusinessSchedule
getBusinessDay(DBDateTime time)
Deprecated.BusinessSchedule
getBusinessDay(String date)
Deprecated.BusinessSchedule
getBusinessDay(LocalDate date)
Deprecated.BusinessSchedule
getBusinessSchedule(DBDateTime time)
Gets the indicated business day's schedule.BusinessSchedule
getBusinessSchedule(String date)
Gets the indicated business day's schedule.BusinessSchedule
getBusinessSchedule(LocalDate date)
Gets the indicated business day's schedule.List<String>
getDefaultBusinessPeriods()
Gets the business periods for the default days.Map<LocalDate,BusinessSchedule>
getHolidays()
Gets business schedules for dates that are different from the defaults.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.String
name()
Gets the name of the calendar.String
nextNonBusinessDay()
Gets the next non-business day.String
nextNonBusinessDay(int days)
Gets the non-business datedays
non-business days after the current day.String
nextNonBusinessDay(DBDateTime time)
Gets the next non-business day.String
nextNonBusinessDay(DBDateTime time, int days)
Gets the non-business datedays
non-business days after inputtime
.String
nextNonBusinessDay(String date)
Gets the next non-business day.String
nextNonBusinessDay(String date, int days)
Gets the non-business datedays
non-business days after inputdate
.String[]
nonBusinessDaysInRange(DBDateTime start, DBDateTime end)
Returns the non-business days betweenstart
andend
, inclusive.String[]
nonBusinessDaysInRange(String start, String end)
Returns the non-business days betweenstart
andend
, inclusive.int
numberOfNonBusinessDays(DBDateTime start, DBDateTime end)
Returns the number of non-business days betweenstart
andend
.int
numberOfNonBusinessDays(DBDateTime start, DBDateTime end, boolean endInclusive)
Returns the number of non-business days betweenstart
andend
.int
numberOfNonBusinessDays(String start, String end)
Returns the number of non-business days betweenstart
andend
.int
numberOfNonBusinessDays(String start, String end, boolean endInclusive)
Returns the number of non-business days betweenstart
andend
.String
previousNonBusinessDay()
Gets the previous non-business day.String
previousNonBusinessDay(int days)
Gets the non-business datedays
non-business days before the current day.String
previousNonBusinessDay(DBDateTime time)
Gets the previous non-business day.String
previousNonBusinessDay(DBDateTime time, int days)
Gets the non-business datedays
non-business days before inputtime
.String
previousNonBusinessDay(String date)
Gets the previous non-business day.String
previousNonBusinessDay(String date, int days)
Gets the non-business datedays
non-business days before inputdate
.long
standardBusinessDayLengthNanos()
Returns the length of a standard business day in nanoseconds.DBTimeZone
timeZone()
Gets the timezone of the calendar.String
toString()
Methods inherited from class com.illumon.util.calendar.AbstractBusinessCalendar
businessDaysInRange, businessDaysInRange, diffBusinessDay, fractionOfBusinessDayComplete, fractionOfBusinessDayRemaining, fractionOfStandardBusinessDay, fractionOfStandardBusinessDay, isBusinessDay, isBusinessDay, isBusinessDay, isBusinessTime, isLastBusinessDayOfMonth, isLastBusinessDayOfMonth, isLastBusinessDayOfWeek, isLastBusinessDayOfWeek, nextBusinessDay, nextBusinessDay, nextBusinessDay, nextBusinessDay, nextBusinessSchedule, nextBusinessSchedule, nextBusinessSchedule, nextBusinessSchedule, numberOfBusinessDays, numberOfBusinessDays, numberOfBusinessDays, numberOfBusinessDays, previousBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessSchedule, previousBusinessSchedule, previousBusinessSchedule, previousBusinessSchedule
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, getLastHoliday, isBusinessDay, isLastBusinessDayOfMonth, isLastBusinessDayOfWeek, nextBusinessDay, nextBusinessDay, nextBusinessSchedule, nextBusinessSchedule, previousBusinessDay, previousBusinessDay, previousBusinessSchedule, previousBusinessSchedule
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
-
Constructor Details
-
DefaultNoHolidayBusinessCalendar
Creates a new Default24HourBusinessCalendar instance. Assumes thatcalendar
is aBusinessCalendar
with no holidays and a 24 hour business day.- Parameters:
calendar
-BusinessCalendar
with no holidays and a 24 hour business day
-
-
Method Details
-
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
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
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
Description copied from interface:Calendar
Gets the name of the calendar.- Returns:
- the name of the calendar
-
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.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.Description copied from interface:BusinessCalendar
Gets the indicated business day.- Parameters:
date
- date- Returns:
- the corresponding BusinessSchedule of
date
-
getBusinessDay
Deprecated.Description copied from interface:BusinessCalendar
Gets the indicated business day.- 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
.- 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
.- 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
.- Parameters:
date
- date- Returns:
- the corresponding BusinessSchedule of
date
-
diffBusinessNanos
Description copied from interface:BusinessCalendar
Returns the amount of business time in nanoseconds betweenstart
andend
.- 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
.- 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
-
hashCode
public int hashCode() -
previousNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the previous non-business day.- Returns:
- the most recent non-business day before the current day
-
previousNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the non-business datedays
non-business days before the current day. Ifdays
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
Description copied from interface:BusinessCalendar
Gets the previous non-business day.- Specified by:
previousNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
previousNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
time
- time; if null, return null- Returns:
- the most recent non-business day before
time
-
previousNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the non-business datedays
non-business days before inputtime
. Ifdays
is zero and the day is a business day, null is returned.- Specified by:
previousNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
previousNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
time
- time; if null, return nulldays
- number of days- Returns:
- the non-business date
days
non-business days before inputtime
-
previousNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the previous non-business day.- Specified by:
previousNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
previousNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
date
- date; if null, return null- Returns:
- the most recent non-business day before
date
-
previousNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the non-business datedays
non-business days before inputdate
. Ifdays
is zero and the day is a business day, null is returned.- Specified by:
previousNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
previousNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
date
- date; if null, return nulldays
- number of days- Returns:
- the non-business date
days
non-business days before inputdate
-
nextNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the next non-business day.- Returns:
- the next non-business day after the current day
-
nextNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the non-business datedays
non-business days after the current day. Ifdays
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
Description copied from interface:BusinessCalendar
Gets the next non-business day.- Specified by:
nextNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
nextNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
time
- time; if null, return null- Returns:
- the next non-business day after
time
-
nextNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the non-business datedays
non-business days after inputtime
. Ifdays
is zero and the day is a business day, null is returned.- Specified by:
nextNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
nextNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
time
- time; if null, return nulldays
- number of days- Returns:
- the non-business date
days
non-business days after inputtime
-
nextNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the next non-business day.- Specified by:
nextNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
nextNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
date
- date; if null, return null- Returns:
- the next non-business day after
date
-
nextNonBusinessDay
Description copied from interface:BusinessCalendar
Gets the non-business datedays
non-business days after inputdate
. Ifdays
is zero and the day is a business day, null is returned.- Specified by:
nextNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
nextNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
date
- date; if null, return nulldays
- number of days- Returns:
- the most recent business day before
time
-
nonBusinessDaysInRange
Description copied from interface:BusinessCalendar
Returns the non-business days betweenstart
andend
, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days forstart
andend
will be included if they are non-business days.- Specified by:
nonBusinessDaysInRange
in interfaceBusinessCalendar
- Overrides:
nonBusinessDaysInRange
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return empty arrayend
- end time; if null, return empty array- Returns:
- inclusive non-business days between
start
andend
-
nonBusinessDaysInRange
Description copied from interface:BusinessCalendar
Returns the non-business days betweenstart
andend
, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days forstart
andend
will be included if they are non-business days.- Specified by:
nonBusinessDaysInRange
in interfaceBusinessCalendar
- Overrides:
nonBusinessDaysInRange
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return empty arrayend
- end time; if null, return empty array- Returns:
- inclusive non-business days between
start
andend
-
diffNonBusinessNanos
Description copied from interface:BusinessCalendar
Returns the amount of non-business time in nanoseconds betweenstart
andend
.- Specified by:
diffNonBusinessNanos
in interfaceBusinessCalendar
- Overrides:
diffNonBusinessNanos
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return NULL_LONGend
- end time; if null, return NULL_LONG- Returns:
- the amount of non-business time in nanoseconds between the
start
andend
-
diffNonBusinessDay
Description copied from interface:BusinessCalendar
Returns the amount of non-business time in standard business days betweenstart
andend
.- Specified by:
diffNonBusinessDay
in interfaceBusinessCalendar
- Overrides:
diffNonBusinessDay
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return NULL_LONGend
- end time; if null, return NULL_LONG- Returns:
- the amount of non-business time in standard business days between the
start
andend
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendar
Returns the number of non-business days betweenstart
andend
.- Specified by:
numberOfNonBusinessDays
in interfaceBusinessCalendar
- Overrides:
numberOfNonBusinessDays
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return NULL_INTend
- end time; if null, return NULL_INT- Returns:
- number of business days between the
start
andend
, inclusive and exclusive respectively.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendar
Returns the number of non-business days betweenstart
andend
.- Specified by:
numberOfNonBusinessDays
in interfaceBusinessCalendar
- Overrides:
numberOfNonBusinessDays
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return NULL_LONGend
- end time; if null, return NULL_LONGendInclusive
- whether to treat theend
inclusive or exclusively- Returns:
- number of business days between the
start
andend
, inclusive andendInclusive
respectively.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendar
Returns the number of non-business days betweenstart
andend
.- Specified by:
numberOfNonBusinessDays
in interfaceBusinessCalendar
- Overrides:
numberOfNonBusinessDays
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return NULL_INTend
- end time; if null, return NULL_INT- Returns:
- number of non-business days between the
start
andend
, inclusive.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendar
Returns the number of non-business days betweenstart
andend
.- Specified by:
numberOfNonBusinessDays
in interfaceBusinessCalendar
- Overrides:
numberOfNonBusinessDays
in classAbstractBusinessCalendar
- Parameters:
start
- start time; if null, return NULL_INTend
- end time; if null, return NULL_INTendInclusive
- whether to treat theend
inclusive or exclusively- Returns:
- number of non-business days between the
start
andend
, inclusive andendInclusive
respectively.
-