Package org.kigalisim.engine.state
Class YearMatcher
java.lang.Object
org.kigalisim.engine.state.YearMatcher
Class representing a range of years where inclusion can be tested.
This class provides functionality to test whether a given year falls within a specified range, supporting both bounded and unbounded ranges.
- License:
- BSD-3-Clause
-
Constructor Summary
ConstructorsConstructorDescriptionYearMatcher(Integer start, Integer end) Create a new year range from Integer values.YearMatcher(Optional<Integer> start, Optional<Integer> end) Create a new year range. -
Method Summary
Modifier and TypeMethodDescriptiongetEnd()Get the end of the year range.booleangetInRange(int year) Determine if a year is included in this range.getStart()Get the start of the year range.static YearMatcherCreate a new unbounded year range.
-
Constructor Details
-
YearMatcher
Create a new year range.Create a new year range between start and end where empty Optional in either means positive or negative infinity.
- Parameters:
start- The starting year (inclusive) in this range or empty if no min yearend- The ending year (inclusive) in this range or empty if no max year
-
YearMatcher
Create a new year range from Integer values.Create a new year range between start and end where null in either means positive or negative infinity.
- Parameters:
start- The starting year (inclusive) in this range or null if no min yearend- The ending year (inclusive) in this range or null if no max year
-
-
Method Details
-
unbounded
Create a new unbounded year range.Create a new year range with no bounds (matches any year).
- Returns:
- A YearMatcher with no bounds
-
getInRange
public boolean getInRange(int year) Determine if a year is included in this range.- Parameters:
year- The year to test for inclusion- Returns:
- true if this value is between getStart and getEnd
-
getStart
Get the start of the year range.- Returns:
- The minimum included year in this range or empty if negative infinity
-
getEnd
Get the end of the year range.- Returns:
- The maximum included year in this range or empty if positive infinity
-