Package org.salespointframework.time
Class Interval
java.lang.Object
org.salespointframework.time.Interval
Simple value object to represent time intervals. Note that whether the endpoints are included or not can vary between
the offered methods.
- Author:
- Oliver Drotbohm, Martin Morgenstern, Rebecca Uecker
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(LocalDateTime reference) Returns whether the givenLocalDateTimeis contained in the currentInterval.booleanstatic Interval.IntervalBuilderfrom(LocalDateTime start) Starts building a newIntervalwith the given start time.Returns the duration of the interval, with the end excluded.getEnd()The end date of theInterval.getStart()The start date of theInterval.inthashCode()booleanReturns whether the currentIntervaloverlaps with the given one.toString()
-
Method Details
-
from
Starts building a newIntervalwith the given start time.- Parameters:
start- must not be null.- Returns:
- will never be null.
-
getDuration
Returns the duration of the interval, with the end excluded.- Returns:
- will never be null.
-
contains
Returns whether the givenLocalDateTimeis contained in the currentInterval. The comparison includes start and end, i.e., the method treats this interval as closed.- Parameters:
reference- must not be null.- Returns:
-
overlaps
Returns whether the currentIntervaloverlaps with the given one. The comparison excludes start and end, i.e., the method treats both intervals as open.- Parameters:
reference- must not be null.- Returns:
-
toDuration
- Returns:
-
toString
-
getStart
The start date of theInterval. -
getEnd
The end date of theInterval. -
equals
-
hashCode
public int hashCode()
-