Interface ChronoInterval<T>
- Type Parameters:
T
- temporal type of time points within a given interval
- All Known Implementing Classes:
CalendarMonth
,CalendarPeriod
,CalendarQuarter
,CalendarWeek
,CalendarYear
,ClockInterval
,DateInterval
,FixedCalendarInterval
,IsoInterval
,MomentInterval
,SimpleInterval
,TimestampInterval
,ValueInterval
Represents a temporal interval on a timeline.
Note: Time4J-intervals contain every timepoint between start and end boundary without exception (continuous intervals). The start must not be after the end.
- Since:
- 2.0
- Author:
- Meno Hochschild
-
Method Summary
Modifier and TypeMethodDescriptionboolean
abuts(ChronoInterval<T> other)
Queries if this interval abuts the other one such that there is neither any overlap nor any gap between.boolean
contains(ChronoInterval<T> other)
Does this interval contain the other one?boolean
Queries if given time point belongs to this interval.getEnd()
Yields the upper bound of this interval.getStart()
Yields the lower bound of this interval.default boolean
intersects(ChronoInterval<T> other)
Queries if this interval intersects the other one such that there is at least one common time point.default boolean
isAfter(ChronoInterval<T> other)
Is this interval after the other one?boolean
Is this interval after the given time point?boolean
isBefore(ChronoInterval<T> other)
Is this interval before the other one?boolean
Is this interval before the given time point?boolean
isEmpty()
Determines if this interval is empty.default boolean
isFinite()
Determines if this interval has finite boundaries.
-
Method Details
-
getStart
Yields the lower bound of this interval.
- Returns:
- start interval boundary
- Since:
- 2.0
-
getEnd
Yields the upper bound of this interval.
- Returns:
- end interval boundary
- Since:
- 2.0
-
isFinite
default boolean isFinite()Determines if this interval has finite boundaries.
- Returns:
true
if start and end are finite elsefalse
- Since:
- 2.0
-
isEmpty
boolean isEmpty()Determines if this interval is empty.
- Returns:
true
if this interval does not contain any time point elsefalse
- Since:
- 2.0
-
contains
Queries if given time point belongs to this interval.
- Parameters:
temporal
- time point to be queried- Returns:
true
if given time point belongs to this interval elsefalse
- Since:
- 2.0
-
contains
Does this interval contain the other one?
An interval cannot contain infinite intervals but can contain an empty interval if it contains the start anchor of the empty interval.
- Parameters:
other
- another interval whose relation to this interval is to be investigated- Returns:
true
if this interval contains the other one elsefalse
- Since:
- 3.25/4.21
- See Also:
intersects(ChronoInterval)
-
isAfter
Is this interval after the given time point?
- Parameters:
temporal
- reference time point- Returns:
true
if this interval is after given time point elsefalse
-
isAfter
Is this interval after the other one?
- Parameters:
other
- another interval whose relation to this interval is to be investigated- Returns:
true
if this interval is after the other one elsefalse
- Since:
- 3.25/4.21
-
isBefore
Is this interval before the given time point?
- Parameters:
temporal
- reference time point- Returns:
true
if this interval is before given time point elsefalse
-
isBefore
Is this interval before the other one?
- Parameters:
other
- another interval whose relation to this interval is to be investigated- Returns:
true
if this interval is before the other one elsefalse
- Since:
- 3.25/4.21
-
abuts
Queries if this interval abuts the other one such that there is neither any overlap nor any gap between.
Note: Empty intervals never abut.
- Parameters:
other
- another interval which might abut this interval- Returns:
true
if there is no intersection and no gap between elsefalse
- Since:
- 3.25/4.21
-
intersects
Queries if this interval intersects the other one such that there is at least one common time point.
In contrast to
contains(ChronoInterval)
, an interval can never intersect an empty interval.- Parameters:
other
- another interval which might have an intersection with this interval- Returns:
true
if there is an non-empty intersection of this interval and the other one elsefalse
- Since:
- 3.25/4.21
- See Also:
isBefore(ChronoInterval)
,isAfter(ChronoInterval)
-