Package com.illumon.util.calendar
Class AbstractBusinessCalendar
java.lang.Object
com.illumon.util.calendar.AbstractCalendar
com.illumon.util.calendar.AbstractBusinessCalendar
- All Implemented Interfaces:
BusinessCalendar,Calendar
- Direct Known Subclasses:
DefaultBusinessCalendar,DefaultNoHolidayBusinessCalendar
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString[]businessDaysInRange(DBDateTime start, DBDateTime end) Returns the business days betweenstartandend, inclusive.String[]businessDaysInRange(String start, String end) Returns the business days betweenstartandend, inclusive.doublediffBusinessDay(DBDateTime start, DBDateTime end) Returns the amount of business time in standard business days betweenstartandend.doublediffNonBusinessDay(DBDateTime start, DBDateTime end) Returns the amount of non-business time in standard business days betweenstartandend.longdiffNonBusinessNanos(DBDateTime start, DBDateTime end) Returns the amount of non-business time in nanoseconds betweenstartandend.doubleReturns the fraction of the business day complete by the given time.doubleReturns the fraction of the business day remaining after the given time.doubleFor the given date, returns the ratio of the business day length and the standard business day length.doubleFor the given date, returns the ratio of the business day length and the standard business day length.booleanisBusinessDay(DBDateTime time) Does time occur on a business day?booleanisBusinessDay(String date) Is the date a business day?booleanisBusinessDay(LocalDate date) Is the date a business day?booleanisBusinessTime(DBDateTime time) Determines if the specified time is a business time.booleanIs the time on the last business day of the month with business time remaining?booleanIs the date the last business day of the month?booleanIs the time on the last business day of the week with business time remaining?booleanIs the date the last business day of the week?nextBusinessDay(DBDateTime time) Gets the next business day.nextBusinessDay(DBDateTime time, int days) Gets the business datedaysbusiness days after inputtime.nextBusinessDay(String date) Gets the next business day.nextBusinessDay(String date, int days) Gets the business datedaysbusiness days after inputdate.Gets the next business schedule.nextBusinessSchedule(DBDateTime time, int days) Gets the business scheduledaysdays after inputtime.nextBusinessSchedule(String date) Gets the next business schedule after inputdate.nextBusinessSchedule(String date, int days) Gets the business scheduledaysdays after inputdate.nextNonBusinessDay(DBDateTime time) Gets the next non-business day.nextNonBusinessDay(DBDateTime time, int days) Gets the non-business datedaysnon-business days after inputtime.nextNonBusinessDay(String date) Gets the next non-business day.nextNonBusinessDay(String date, int days) Gets the non-business datedaysnon-business days after inputdate.String[]nonBusinessDaysInRange(DBDateTime start, DBDateTime end) Returns the non-business days betweenstartandend, inclusive.String[]nonBusinessDaysInRange(String start, String end) Returns the non-business days betweenstartandend, inclusive.intnumberOfBusinessDays(DBDateTime start, DBDateTime end) Returns the number of business days betweenstartandend.intnumberOfBusinessDays(DBDateTime start, DBDateTime end, boolean endInclusive) Returns the number of business days betweenstartandend.intnumberOfBusinessDays(String start, String end) Returns the number of business days betweenstartandend.intnumberOfBusinessDays(String start, String end, boolean endInclusive) Returns the number of business days betweenstartandend.intnumberOfNonBusinessDays(DBDateTime start, DBDateTime end) Returns the number of non-business days betweenstartandend.intnumberOfNonBusinessDays(DBDateTime start, DBDateTime end, boolean endInclusive) Returns the number of non-business days betweenstartandend.intnumberOfNonBusinessDays(String start, String end) Returns the number of non-business days betweenstartandend.intnumberOfNonBusinessDays(String start, String end, boolean endInclusive) Returns the number of non-business days betweenstartandend.Gets the previous business day.previousBusinessDay(DBDateTime time, int days) Gets the business datedaysbusiness days before inputtime.previousBusinessDay(String date) Gets the previous business day.previousBusinessDay(String date, int days) Gets the business datedaysbusiness days before inputdate.Gets the previous business schedule before inputtime.previousBusinessSchedule(DBDateTime time, int days) Gets the business scheduledaysdays before inputtime.Gets the business schedule before inputdate.previousBusinessSchedule(String date, int days) Gets the business scheduledaysdays before inputdate.Gets the previous non-business day.previousNonBusinessDay(DBDateTime time, int days) Gets the non-business datedaysnon-business days before inputtime.previousNonBusinessDay(String date) Gets the previous non-business day.previousNonBusinessDay(String date, int days) Gets the non-business datedaysnon-business days before inputdate.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, previousDayMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.illumon.util.calendar.BusinessCalendar
currentBusinessSchedule, diffBusinessNanos, diffBusinessYear, fractionOfStandardBusinessDay, getBusinessDay, getBusinessDay, getBusinessDay, getBusinessSchedule, getBusinessSchedule, getBusinessSchedule, getDefaultBusinessPeriods, getHolidays, getLastHoliday, getRawData, isBusinessDay, isBusinessDay, isLastBusinessDayOfMonth, isLastBusinessDayOfWeek, nextBusinessDay, nextBusinessDay, nextBusinessSchedule, nextBusinessSchedule, nextNonBusinessDay, nextNonBusinessDay, previousBusinessDay, previousBusinessDay, previousBusinessSchedule, previousBusinessSchedule, previousNonBusinessDay, previousNonBusinessDay, standardBusinessDayLengthNanosMethods inherited from interface com.illumon.util.calendar.Calendar
currentDay, dayOfWeek, dayOfWeek, dayOfWeek, daysInRange, daysInRange, diffDay, diffNanos, diffYear, name, nextDay, nextDay, nextDay, nextDay, nextDay, nextDay, numberOfDays, numberOfDays, numberOfDays, numberOfDays, previousDay, previousDay, previousDay, previousDay, previousDay, previousDay, timeZone
-
Constructor Details
-
AbstractBusinessCalendar
public AbstractBusinessCalendar()
-
-
Method Details
-
isBusinessDay
Description copied from interface:BusinessCalendarDoes time occur on a business day?- Specified by:
isBusinessDayin interfaceBusinessCalendar- Parameters:
time- time- Returns:
- true if the date is a business day; false otherwise.
-
isBusinessDay
Description copied from interface:BusinessCalendarIs the date a business day?- Specified by:
isBusinessDayin interfaceBusinessCalendar- Parameters:
date- date- Returns:
- true if the date is a business day; false otherwise.
-
isBusinessDay
Description copied from interface:BusinessCalendarIs the date a business day?- Specified by:
isBusinessDayin interfaceBusinessCalendar- Parameters:
date- date- Returns:
- true if the date is a business day; false otherwise.
-
isBusinessTime
Description copied from interface:BusinessCalendarDetermines if the specified time is a business time. If the time falls between business periods, false will be returned.- Specified by:
isBusinessTimein interfaceBusinessCalendar- Parameters:
time- time- Returns:
- true if the specified time is a business time; otherwise, false.
-
previousBusinessDay
Description copied from interface:BusinessCalendarGets the previous business day.- Specified by:
previousBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return null- Returns:
- the most recent business day before
time
-
previousBusinessDay
Description copied from interface:BusinessCalendarGets the business datedaysbusiness days before inputtime. Ifdaysis zero and the day is not a business day, null is returned.- Specified by:
previousBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return nulldays- number of days- Returns:
- the business date
daysbusiness days before inputtime
-
previousBusinessDay
Description copied from interface:BusinessCalendarGets the previous business day.- Specified by:
previousBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return null- Returns:
- the most recent business day before
date
-
previousBusinessDay
Description copied from interface:BusinessCalendarGets the business datedaysbusiness days before inputdate. Ifdaysis zero and the day is not a business day, null is returned.- Specified by:
previousBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return nulldays- number of days- Returns:
- the business date
daysbusiness days before inputdate
-
previousBusinessSchedule
Description copied from interface:BusinessCalendarGets the previous business schedule before inputtime. Assumes implementation of getBusinessSchedule(null) returns null.- Specified by:
previousBusinessSchedulein interfaceBusinessCalendar- Parameters:
time- time; if null, return null- Returns:
- the most recent business schedule before
time
-
previousBusinessSchedule
Description copied from interface:BusinessCalendarGets the business scheduledaysdays before inputtime. Assumes implementation of getBusinessSchedule(null) returns null.- Specified by:
previousBusinessSchedulein interfaceBusinessCalendar- Parameters:
time- time; if null, return nulldays- number of days
-
previousBusinessSchedule
Description copied from interface:BusinessCalendarGets the business schedule before inputdate. Assumes implementation of getBusinessSchedule(null) returns null.- Specified by:
previousBusinessSchedulein interfaceBusinessCalendar- Parameters:
date- date; if null, return null- Returns:
- the most recent business schedule before
date
-
previousBusinessSchedule
Description copied from interface:BusinessCalendarGets the business scheduledaysdays before inputdate. Assumes implementation of getBusinessSchedule(null) returns null.- Specified by:
previousBusinessSchedulein interfaceBusinessCalendar- Parameters:
date- date; if null, return nulldays- number of days- Returns:
- the business schedule
daysdays before inputdate
-
previousNonBusinessDay
Description copied from interface:BusinessCalendarGets the previous non-business day.- Specified by:
previousNonBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return null- Returns:
- the most recent non-business day before
time
-
previousNonBusinessDay
Description copied from interface:BusinessCalendarGets the non-business datedaysnon-business days before inputtime. Ifdaysis zero and the day is a business day, null is returned.- Specified by:
previousNonBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return nulldays- number of days- Returns:
- the non-business date
daysnon-business days before inputtime
-
previousNonBusinessDay
Description copied from interface:BusinessCalendarGets the previous non-business day.- Specified by:
previousNonBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return null- Returns:
- the most recent non-business day before
date
-
previousNonBusinessDay
Description copied from interface:BusinessCalendarGets the non-business datedaysnon-business days before inputdate. Ifdaysis zero and the day is a business day, null is returned.- Specified by:
previousNonBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return nulldays- number of days- Returns:
- the non-business date
daysnon-business days before inputdate
-
nextBusinessDay
Description copied from interface:BusinessCalendarGets the next business day.- Specified by:
nextBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return null- Returns:
- the next business day after
time
-
nextBusinessDay
Description copied from interface:BusinessCalendarGets the business datedaysbusiness days after inputtime. Ifdaysis zero and the day is not a business day, null is returned.- Specified by:
nextBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return nulldays- number of days- Returns:
- the next business day after
time
-
nextBusinessDay
Description copied from interface:BusinessCalendarGets the next business day.- Specified by:
nextBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return null- Returns:
- the next business day after
date
-
nextBusinessDay
Description copied from interface:BusinessCalendarGets the business datedaysbusiness days after inputdate. Ifdaysis zero and the day is not a business day, null is returned.- Specified by:
nextBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return nulldays- number of days- Returns:
- the business date
daysbusiness days after inputdate
-
nextBusinessSchedule
Description copied from interface:BusinessCalendarGets the next business schedule.- Specified by:
nextBusinessSchedulein interfaceBusinessCalendar- Parameters:
time- time; if null, return null- Returns:
- the next closest business schedule after
time
-
nextBusinessSchedule
Description copied from interface:BusinessCalendarGets the business scheduledaysdays after inputtime. Ifdateis null, assumes the implementation of getBusinessSchedule(null) returns null.- Specified by:
nextBusinessSchedulein interfaceBusinessCalendar- Parameters:
time- time; if null, return nulldays- number of days- Returns:
- the business schedule
daysaftertime
-
nextBusinessSchedule
Description copied from interface:BusinessCalendarGets the next business schedule after inputdate. Assumes implementation of getBusinessSchedule(null) returns null.- Specified by:
nextBusinessSchedulein interfaceBusinessCalendar- Parameters:
date- date; if null, return null- Returns:
- the next closest business schedule after
date
-
nextBusinessSchedule
Description copied from interface:BusinessCalendarGets the business scheduledaysdays after inputdate. Ifdateis null, assumes the implementation of getBusinessSchedule(null) returns null.- Specified by:
nextBusinessSchedulein interfaceBusinessCalendar- Parameters:
date- date; if null, return nulldays- number of days- Returns:
- the business schedule
daysafterdate
-
nextNonBusinessDay
Description copied from interface:BusinessCalendarGets the next non-business day.- Specified by:
nextNonBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return null- Returns:
- the next non-business day after
time
-
nextNonBusinessDay
Description copied from interface:BusinessCalendarGets the non-business datedaysnon-business days after inputtime. Ifdaysis zero and the day is a business day, null is returned.- Specified by:
nextNonBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return nulldays- number of days- Returns:
- the non-business date
daysnon-business days after inputtime
-
nextNonBusinessDay
Description copied from interface:BusinessCalendarGets the next non-business day.- Specified by:
nextNonBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return null- Returns:
- the next non-business day after
date
-
nextNonBusinessDay
Description copied from interface:BusinessCalendarGets the non-business datedaysnon-business days after inputdate. Ifdaysis zero and the day is a business day, null is returned.- Specified by:
nextNonBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return nulldays- number of days- Returns:
- the most recent business day before
time
-
businessDaysInRange
Description copied from interface:BusinessCalendarReturns the business days betweenstartandend, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days forstartandendwill be included if they are business days.- Specified by:
businessDaysInRangein interfaceBusinessCalendar- Parameters:
start- start time; if null, return empty arrayend- end time; if null, return empty array- Returns:
- inclusive business days between
startandend
-
businessDaysInRange
Description copied from interface:BusinessCalendarReturns the business days betweenstartandend, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days forstartandendwill be included if they are business days.- Specified by:
businessDaysInRangein interfaceBusinessCalendar- Parameters:
start- start time; if null, return empty arrayend- end time; if null, return empty array- Returns:
- inclusive business days between
startandend
-
nonBusinessDaysInRange
Description copied from interface:BusinessCalendarReturns the non-business days betweenstartandend, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days forstartandendwill be included if they are non-business days.- Specified by:
nonBusinessDaysInRangein interfaceBusinessCalendar- Parameters:
start- start time; if null, return empty arrayend- end time; if null, return empty array- Returns:
- inclusive non-business days between
startandend
-
nonBusinessDaysInRange
Description copied from interface:BusinessCalendarReturns the non-business days betweenstartandend, inclusive. Because no time information (e.g., hours, minutes, seconds) is returned, the corresponding days forstartandendwill be included if they are non-business days.- Specified by:
nonBusinessDaysInRangein interfaceBusinessCalendar- Parameters:
start- start time; if null, return empty arrayend- end time; if null, return empty array- Returns:
- inclusive non-business days between
startandend
-
diffNonBusinessNanos
Description copied from interface:BusinessCalendarReturns the amount of non-business time in nanoseconds betweenstartandend.- Specified by:
diffNonBusinessNanosin interfaceBusinessCalendar- 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
startandend
-
diffBusinessDay
Description copied from interface:BusinessCalendarReturns the amount of business time in standard business days betweenstartandend.- Specified by:
diffBusinessDayin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_LONGend- end time; if null, return NULL_LONG- Returns:
- the amount of business time in standard business days between the
startandend
-
diffNonBusinessDay
Description copied from interface:BusinessCalendarReturns the amount of non-business time in standard business days betweenstartandend.- Specified by:
diffNonBusinessDayin interfaceBusinessCalendar- 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
startandend
-
numberOfBusinessDays
Description copied from interface:BusinessCalendarReturns the number of business days betweenstartandend.- Specified by:
numberOfBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_INTend- end time; if null, return NULL_INT- Returns:
- number of business days between the
startandend, inclusive and exclusive respectively.
-
numberOfBusinessDays
Description copied from interface:BusinessCalendarReturns the number of business days betweenstartandend.- Specified by:
numberOfBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_LONGend- end time; if null, return NULL_LONGendInclusive- whether to treat theendinclusive or exclusively- Returns:
- number of business days between the
startandend, inclusive andendInclusiverespectively.
-
numberOfBusinessDays
Description copied from interface:BusinessCalendarReturns the number of business days betweenstartandend.- Specified by:
numberOfBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_INTend- end time; if null, return NULL_INT- Returns:
- number of business days between the
startandend, inclusive and exclusive respectively.
-
numberOfBusinessDays
Description copied from interface:BusinessCalendarReturns the number of business days betweenstartandend.- Specified by:
numberOfBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_INTend- end time; if null, return NULL_INTendInclusive- whether to treat theendinclusive or exclusively- Returns:
- number of business days between the
startandend, inclusive andendInclusiverespectively.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendarReturns the number of non-business days betweenstartandend.- Specified by:
numberOfNonBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_INTend- end time; if null, return NULL_INT- Returns:
- number of business days between the
startandend, inclusive and exclusive respectively.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendarReturns the number of non-business days betweenstartandend.- Specified by:
numberOfNonBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_LONGend- end time; if null, return NULL_LONGendInclusive- whether to treat theendinclusive or exclusively- Returns:
- number of business days between the
startandend, inclusive andendInclusiverespectively.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendarReturns the number of non-business days betweenstartandend.- Specified by:
numberOfNonBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_INTend- end time; if null, return NULL_INT- Returns:
- number of non-business days between the
startandend, inclusive.
-
numberOfNonBusinessDays
Description copied from interface:BusinessCalendarReturns the number of non-business days betweenstartandend.- Specified by:
numberOfNonBusinessDaysin interfaceBusinessCalendar- Parameters:
start- start time; if null, return NULL_INTend- end time; if null, return NULL_INTendInclusive- whether to treat theendinclusive or exclusively- Returns:
- number of non-business days between the
startandend, inclusive andendInclusiverespectively.
-
fractionOfStandardBusinessDay
Description copied from interface:BusinessCalendarFor the given date, returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A half day holiday will return 0.5.- Specified by:
fractionOfStandardBusinessDayin interfaceBusinessCalendar- Parameters:
time- time; if null, return 0- Returns:
- ratio of the business day length and the standard business day length for the date
- See Also:
-
fractionOfStandardBusinessDay
Description copied from interface:BusinessCalendarFor the given date, returns the ratio of the business day length and the standard business day length. For example, a holiday has zero business time and will therefore return 0.0. A normal business day will be of the standard length and will therefore return 1.0. A half day holiday will return 0.5.- Specified by:
fractionOfStandardBusinessDayin interfaceBusinessCalendar- Parameters:
date- date; if null, return 0- Returns:
- ratio of the business day length and the standard business day length for the date
- See Also:
-
fractionOfBusinessDayRemaining
Description copied from interface:BusinessCalendarReturns the fraction of the business day remaining after the given time.- Specified by:
fractionOfBusinessDayRemainingin interfaceBusinessCalendar- Parameters:
time- time- Returns:
- the fraction of the day left after
time; NULL_DOUBLE if time is null
-
fractionOfBusinessDayComplete
Description copied from interface:BusinessCalendarReturns the fraction of the business day complete by the given time.- Specified by:
fractionOfBusinessDayCompletein interfaceBusinessCalendar- Parameters:
time- time- Returns:
- the fraction of the day complete by
time; NULL_DOUBLE if time is null
-
isLastBusinessDayOfMonth
Description copied from interface:BusinessCalendarIs the time on the last business day of the month with business time remaining?- Specified by:
isLastBusinessDayOfMonthin interfaceBusinessCalendar- Parameters:
time- time- Returns:
- true if
timeis on the last business day of the month with business time remaining; false otherwise.
-
isLastBusinessDayOfMonth
Description copied from interface:BusinessCalendarIs the date the last business day of the month?- Specified by:
isLastBusinessDayOfMonthin interfaceBusinessCalendar- Parameters:
date- date- Returns:
- true if
dateis on the last business day of the month; false otherwise.
-
isLastBusinessDayOfWeek
Description copied from interface:BusinessCalendarIs the time on the last business day of the week with business time remaining?- Specified by:
isLastBusinessDayOfWeekin interfaceBusinessCalendar- Parameters:
time- time- Returns:
- true if
timeis on the last business day of the week with business time remaining; false otherwise.
-
isLastBusinessDayOfWeek
Description copied from interface:BusinessCalendarIs the date the last business day of the week?- Specified by:
isLastBusinessDayOfWeekin interfaceBusinessCalendar- Parameters:
date- date- Returns:
- true if
dateis on the last business day of the week; false otherwise.
-