public class WorkdayCalculator
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static WorkdayCalculator |
instance |
Modifier and Type | Method and Description |
---|---|
protected int |
calculateNonWeekendHolidays(double start,
double end,
double[] holidays)
Calculates how many holidays in a list are workdays, considering an interval of dates.
|
int |
calculateWorkdays(double start,
double end,
double[] holidays)
Calculate how many workdays are there between a start and an end date, as excel representations, considering a range of holidays.
|
java.util.Date |
calculateWorkdays(double start,
int workdays,
double[] holidays)
Calculate the workday past x workdays from a starting date, considering a range of holidays.
|
java.util.Date |
calculateWorkdays(double start,
int workdays,
int weekendType,
double[] holidays)
Calculate the workday past x workdays from a starting date, considering a range of holidays.
|
java.util.Set<java.lang.Integer> |
getValidWeekendTypes() |
protected boolean |
isHoliday(double aDate,
double[] holidays) |
protected boolean |
isInARange(double start,
double end,
double aDate) |
protected boolean |
isWeekend(double aDate) |
protected int |
pastDaysOfWeek(double start,
double end,
int dayOfWeek)
Calculates how many days of week past between a start and an end date.
|
public static final WorkdayCalculator instance
public java.util.Set<java.lang.Integer> getValidWeekendTypes()
public int calculateWorkdays(double start, double end, double[] holidays)
start
- start date.end
- end date.holidays
- an array of holidays.public java.util.Date calculateWorkdays(double start, int workdays, double[] holidays)
start
- start date.workdays
- number of workdays to be past from starting date.holidays
- an array of holidays.public java.util.Date calculateWorkdays(double start, int workdays, int weekendType, double[] holidays)
start
- start date.workdays
- number of workdays to be past from starting date.weekendType
- weekend parameter (see https://support.microsoft.com/en-us/office/workday-intl-function-a378391c-9ba7-4678-8a39-39611a9bf81d)holidays
- an array of holidays.protected int pastDaysOfWeek(double start, double end, int dayOfWeek)
start
- start date.end
- end date.dayOfWeek
- a day of week as represented by Calendar
constants.protected int calculateNonWeekendHolidays(double start, double end, double[] holidays)
start
- start date.end
- end date.holidays
- an array of holidays.protected boolean isWeekend(double aDate)
aDate
- a given date.true
if date is weekend, false
otherwise.protected boolean isHoliday(double aDate, double[] holidays)
aDate
- a given date.holidays
- an array of holidays.true
if date is a holiday, false
otherwise.protected boolean isInARange(double start, double end, double aDate)
start
- start date.end
- end date.aDate
- a date to be analyzed.true
if aDate is between start and end dates, false
otherwise.Copyright 2022 The Apache Software Foundation or its licensors, as applicable.