Class TemporalApplicability
- java.lang.Object
-
- org.sellcom.geotemporal.time.applicability.GeoTemporalApplicability
-
- org.sellcom.geotemporal.time.applicability.TemporalApplicability
-
- All Implemented Interfaces:
BiPredicate<Temporal,GeoRegion>,Predicate<Temporal>,GeoTemporalPredicate,TemporalPredicate
public abstract class TemporalApplicability extends GeoTemporalApplicability implements TemporalPredicate
Applicability at aTemporal.- Since:
- 1.0
- See Also:
Temporal
-
-
Constructor Summary
Constructors Constructor Description TemporalApplicability()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TemporalApplicabilityalways()Creates an applicability that is always satisfied.static TemporalApplicabilitydateRange(LocalDate startDate, LocalDate endDate)Creates an applicability satisfied in the given range of dates.static TemporalApplicabilitydayOfWeekAfter(int ordinal, DayOfWeek dayOfWeek, MonthDay monthDay)Creates an applicability satisfied on the ordinal-th day-of-week after the given month-day.static TemporalApplicabilitydayOfWeekBefore(int ordinal, DayOfWeek dayOfWeek, MonthDay monthDay)Creates an applicability satisfied on the ordinal-th day-of-week before the given month-day.static TemporalApplicabilitydayOfWeekRange(DayOfWeek startDayOfWeek, DayOfWeek endDayOfWeek)Creates an applicability satisfied in the given days-of-week.static TemporalApplicabilityevenIsoWeek()Creates an applicability satisfied in weeks with an even ISO week number.static TemporalApplicabilityisoWeekRange(int startWeekNumber, int endWeekNumber)Creates an applicability satisfied in weeks with the week number in the given range.static TemporalApplicabilitymonthDayRange(MonthDay startMonthDay, MonthDay endMonthDay)Creates an applicability satisfied in the given range of month-days.static TemporalApplicabilitymonthRange(Month startMonth, Month endMonth)Creates an applicability satisfied in the given range of months.TemporalApplicabilitynegate()static TemporalApplicabilitynever()Creates an applicability that is never satisfied.static TemporalApplicabilityoddIsoWeek()Creates an applicability satisfied in weeks with an odd ISO week number.static TemporalApplicabilitysingleDate(LocalDate date)Creates an applicability satisfied on the given date.static TemporalApplicabilitysingleDayOfWeek(DayOfWeek dayOfWeek)Creates an applicability satisfied on the given day-of-week.static TemporalApplicabilitysingleIsoWeek(int weekNumber)Creates an applicability satisfied in weeks with the given ISO week number.static TemporalApplicabilitysingleMonth(Month month)Creates an applicability satisfied in the given month.static TemporalApplicabilitysingleMonthDay(MonthDay monthDay)Creates an applicability satisfied on the given month-day.static TemporalApplicabilitysingleYear(int year)Creates an applicability satisfied in the given year.static TemporalApplicabilitysingleYear(Year year)Creates an applicability satisfied in the given year.abstract booleantest(Temporal temporal)Checks whether this applicability is satisfied at the given temporal.booleantest(Temporal temporal, GeoRegion region)Checks whether this applicability is satisfied at the given temporal in the given region.static TemporalApplicabilityyearRange(int startYear, int endYear)Creates an applicability satisfied in the given range of years.static TemporalApplicabilityyearRange(Year startYear, Year endYear)Creates an applicability satisfied in the given range of years.-
Methods inherited from interface java.util.function.BiPredicate
and, or
-
Methods inherited from class org.sellcom.geotemporal.time.applicability.GeoTemporalApplicability
holiday, parse, publicHoliday, schoolHoliday, weekend, workingDay
-
-
-
-
Method Detail
-
always
public static TemporalApplicability always()
Creates an applicability that is always satisfied.- Since:
- 1.0
-
dateRange
public static TemporalApplicability dateRange(LocalDate startDate, LocalDate endDate)
Creates an applicability satisfied in the given range of dates. Both the start date and the end date are inclusive.- Throws:
IllegalArgumentException- ifstartDateisnullIllegalArgumentException- ifendDateisnull- Since:
- 1.0
-
dayOfWeekAfter
public static TemporalApplicability dayOfWeekAfter(int ordinal, DayOfWeek dayOfWeek, MonthDay monthDay)
Creates an applicability satisfied on the ordinal-th day-of-week after the given month-day.- Throws:
IllegalArgumentException- ifordinalis0IllegalArgumentException- ifdayOfWeekisnullIllegalArgumentException- ifmonthDayisnull- Since:
- 1.0
-
dayOfWeekBefore
public static TemporalApplicability dayOfWeekBefore(int ordinal, DayOfWeek dayOfWeek, MonthDay monthDay)
Creates an applicability satisfied on the ordinal-th day-of-week before the given month-day.- Throws:
IllegalArgumentException- ifordinalis0IllegalArgumentException- ifdayOfWeekisnullIllegalArgumentException- ifmonthDayisnull- Since:
- 1.0
-
dayOfWeekRange
public static TemporalApplicability dayOfWeekRange(DayOfWeek startDayOfWeek, DayOfWeek endDayOfWeek)
Creates an applicability satisfied in the given days-of-week. Both the start day-of-week and the end day-of-week are inclusive and the range may wrap around the end of the week.- Throws:
IllegalArgumentException- ifstartDayOfWeekisnullIllegalArgumentException- ifendDayOfWeekisnull- Since:
- 1.0
-
evenIsoWeek
public static TemporalApplicability evenIsoWeek()
Creates an applicability satisfied in weeks with an even ISO week number.- Since:
- 1.0
-
isoWeekRange
public static TemporalApplicability isoWeekRange(int startWeekNumber, int endWeekNumber)
Creates an applicability satisfied in weeks with the week number in the given range. Both the start week number and the end week number are inclusive.- Since:
- 1.0
-
monthDayRange
public static TemporalApplicability monthDayRange(MonthDay startMonthDay, MonthDay endMonthDay)
Creates an applicability satisfied in the given range of month-days. Both the start month-day and the end month-day are inclusive and the range may wrap around the end of the year.- Throws:
IllegalArgumentException- ifstartMonthDayisnullIllegalArgumentException- ifendMonthDayisnull- Since:
- 1.0
-
monthRange
public static TemporalApplicability monthRange(Month startMonth, Month endMonth)
Creates an applicability satisfied in the given range of months. Both the start month and the end month are inclusive and the range may wrap around the end of the year.- Throws:
IllegalArgumentException- ifstartMonthisnullIllegalArgumentException- ifendMonthisnull- Since:
- 1.0
-
negate
public TemporalApplicability negate()
-
never
public static TemporalApplicability never()
Creates an applicability that is never satisfied.- Since:
- 1.0
-
oddIsoWeek
public static TemporalApplicability oddIsoWeek()
Creates an applicability satisfied in weeks with an odd ISO week number.- Since:
- 1.0
-
singleDate
public static TemporalApplicability singleDate(LocalDate date)
Creates an applicability satisfied on the given date.- Throws:
IllegalArgumentException- ifdateisnull- Since:
- 1.0
-
singleDayOfWeek
public static TemporalApplicability singleDayOfWeek(DayOfWeek dayOfWeek)
Creates an applicability satisfied on the given day-of-week.- Throws:
IllegalArgumentException- ifdayOfWeekisnull- Since:
- 1.0
-
singleIsoWeek
public static TemporalApplicability singleIsoWeek(int weekNumber)
Creates an applicability satisfied in weeks with the given ISO week number.- Throws:
IllegalArgumentException- ifweekNumberis not positiveIllegalArgumentException- ifweekNumberis greater than53- Since:
- 1.0
-
singleMonth
public static TemporalApplicability singleMonth(Month month)
Creates an applicability satisfied in the given month.- Throws:
IllegalArgumentException- ifmonthisnull- Since:
- 1.0
-
singleMonthDay
public static TemporalApplicability singleMonthDay(MonthDay monthDay)
Creates an applicability satisfied on the given month-day.- Throws:
IllegalArgumentException- ifmonthDayisnull- Since:
- 1.0
-
singleYear
public static TemporalApplicability singleYear(int year)
Creates an applicability satisfied in the given year.- Since:
- 1.0
-
singleYear
public static TemporalApplicability singleYear(Year year)
Creates an applicability satisfied in the given year.- Throws:
IllegalArgumentException- ifyearisnull- Since:
- 1.0
-
test
public abstract boolean test(Temporal temporal)
Checks whether this applicability is satisfied at the given temporal.- Specified by:
testin interfacePredicate<Temporal>- Specified by:
testin interfaceTemporalPredicate- Throws:
IllegalArgumentException- iftemporalisnull- Since:
- 1.0
-
test
public final boolean test(Temporal temporal, GeoRegion region)
Description copied from class:GeoTemporalApplicabilityChecks whether this applicability is satisfied at the given temporal in the given region.- Specified by:
testin interfaceBiPredicate<Temporal,GeoRegion>- Specified by:
testin interfaceGeoTemporalPredicate- Specified by:
testin classGeoTemporalApplicability
-
yearRange
public static TemporalApplicability yearRange(int startYear, int endYear)
Creates an applicability satisfied in the given range of years. Both the start year and the end year are inclusive.- Since:
- 1.0
-
yearRange
public static TemporalApplicability yearRange(Year startYear, Year endYear)
Creates an applicability satisfied in the given range of years. Both the start year and the end year are inclusive.- Throws:
IllegalArgumentException- ifstartYearisnullIllegalArgumentException- ifendYearisnull- Since:
- 1.0
-
-