Module com.jongsoft.lang
Package com.jongsoft.lang.time
Interface Range<T extends java.time.temporal.Temporal>
-
- Type Parameters:
T
- the temporal type
- All Known Implementing Classes:
RangeImpl
public interface Range<T extends java.time.temporal.Temporal>
A temporal range to contain a from until temporal entities. Where the from is inclusive and the until is exclusive.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description T
from()
The from part for this temporal range.default int
fromPart(java.time.temporal.TemporalField part)
Get a part of the from temporal of this range.Range<T>
next()
Returns the range exactly after this range.Range<T>
previous()
Returns the range exactly before this range.java.util.stream.Stream<Range<T>>
slice(java.time.temporal.ChronoUnit slicing)
Slice the temporal range into smaller sections, where each slice is at least the indicated ChronoUnit in size.T
until()
The until part for this temporal range.default int
untilPart(java.time.temporal.TemporalField part)
Get a part of the until temporal of this range.
-
-
-
Method Detail
-
from
T from()
The from part for this temporal range.- Returns:
- the inclusive from part
-
fromPart
default int fromPart(java.time.temporal.TemporalField part)
Get a part of the from temporal of this range.- Parameters:
part
- the temporal field part to get- Returns:
- the temporal field value
-
until
T until()
The until part for this temporal range.- Returns:
- the exclusive until part
-
untilPart
default int untilPart(java.time.temporal.TemporalField part)
Get a part of the until temporal of this range.- Parameters:
part
- the temporal field part to get- Returns:
- the temporal field value
-
slice
java.util.stream.Stream<Range<T>> slice(java.time.temporal.ChronoUnit slicing)
Slice the temporal range into smaller sections, where each slice is at least the indicated ChronoUnit in size.- Parameters:
slicing
- the slicing range- Returns:
- the sliced ranges
-
previous
Range<T> previous()
Returns the range exactly before this range. If the range was created using a ChronoUnit then the window will shift exactly one ChronoUnit back. If it was created using a from and until it will shift exactly the same size back.- Returns:
- the previous window
-
-