Package org.salespointframework.time
Class Interval
- java.lang.Object
- 
- org.salespointframework.time.Interval
 
- 
 public final class Interval extends Object 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
 
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classInterval.IntervalBuilder
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(LocalDateTime reference)Returns whether the givenLocalDateTimeis contained in the currentInterval.booleanequals(Object o)static Interval.IntervalBuilderfrom(LocalDateTime start)Starts building a newIntervalwith the given start time.DurationgetDuration()Returns the duration of the interval, with the end excluded.LocalDateTimegetEnd()The end date of theInterval.LocalDateTimegetStart()The start date of theInterval.inthashCode()booleanoverlaps(Interval reference)Returns whether the currentIntervaloverlaps with the given one.DurationtoDuration()StringtoString()
 
- 
- 
- 
Method Detail- 
frompublic static Interval.IntervalBuilder from(LocalDateTime start) Starts building a newIntervalwith the given start time.- Parameters:
- start- must not be null.
- Returns:
- will never be null.
 
 - 
getDurationpublic Duration getDuration() Returns the duration of the interval, with the end excluded.- Returns:
- will never be null.
 
 - 
containspublic boolean contains(LocalDateTime reference) 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:
 
 - 
overlapspublic boolean overlaps(Interval reference) 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:
 
 - 
toDurationpublic Duration toDuration() - Returns:
 
 - 
getStartpublic LocalDateTime getStart() The start date of theInterval.
 - 
getEndpublic LocalDateTime getEnd() The end date of theInterval.
 
- 
 
-