Class TimeInterval
java.lang.Object
com.flowingcode.vaadin.addons.recurrentschedulefield.api.TimeInterval
- All Implemented Interfaces:
Serializable,Comparable<TimeInterval>
A class that represents a time interval (a time period defined by start and end points) according to
ISO 8601.
- Author:
- Flowing Code
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTimeInterval(LocalDateTime start, LocalDateTime end) Creates a newTimeIntervalwith the specified start and end date-times. -
Method Summary
Modifier and TypeMethodDescriptionintbooleanGets the time duration (or time period) of this interval.Returns the (exclusive) ending point of this interval.Returns the starting point of this interval.inthashCode()booleanincludes(LocalDateTime date) Checks whether the givenLocalDateTimefalls within this interval.booleanisAfter(LocalDateTime date) Checks whether this interval falls after the specifiedLocalDateTime.booleanisBefore(LocalDateTime date) Checks whether this interval falls before the specifiedLocalDateTime.
-
Constructor Details
-
TimeInterval
Creates a newTimeIntervalwith the specified start and end date-times.- Parameters:
start- the inclusive start date-time of the intervalend- the exclusive end date-time of the interval- Throws:
IllegalArgumentException- ifstartis not beforeend
-
-
Method Details
-
getStartDate
Returns the starting point of this interval. -
getEndDate
Returns the (exclusive) ending point of this interval. -
includes
Checks whether the givenLocalDateTimefalls within this interval.- Returns:
trueif the argument is within this interval,falseotherwise
-
isBefore
Checks whether this interval falls before the specifiedLocalDateTime.- Returns:
trueif this interval is before,falseotherwise
-
isAfter
Checks whether this interval falls after the specifiedLocalDateTime.- Returns:
trueif this interval is after,falseotherwise
-
getDuration
Gets the time duration (or time period) of this interval. The duration is calculated as the difference between the start and (exclusive) end times.- Returns:
- a
Durationrepresenting the length of an interval
-
compareTo
- Specified by:
compareToin interfaceComparable<TimeInterval>
-
equals
-
hashCode
public int hashCode()
-