Module kivakit.interfaces
Interface PointInTime<Time extends PointInTime<Time,Duration>,Duration extends LengthOfTime<Duration>>
- All Superinterfaces:
Comparable<PointInTime<?,
,?>> DoubleQuantizable
,Quantizable
,Stringable
,StringSource
,TimeMeasurement
- All Known Implementing Classes:
BaseTime
,Day
,DayOfWeek
,Hour
,HourOfWeek
,LocalTime
,Minute
,Second
,Time
,Week
,Year
public interface PointInTime<Time extends PointInTime<Time,Duration>,Duration extends LengthOfTime<Duration>>
extends Comparable<PointInTime<?,?>>, Stringable, TimeMeasurement
Interface to an object having a length of time, measured in milliseconds.
Measurement
Conversion
A length of time can be converted to specific time units by calling one of the following methods:
TimeMeasurement.asMicroseconds()
TimeMeasurement.asMilliseconds()
TimeMeasurement.asSeconds()
TimeMeasurement.asMinutes()
TimeMeasurement.asHours()
TimeMeasurement.asDays()
TimeMeasurement.asWeeks()
TimeMeasurement.asYears()
asJavaInstant()
Arithmetic
plus(LengthOfTime)
minus(LengthOfTime)
minus(PointInTime)
roundUp(LengthOfTime)
roundDown(LengthOfTime)
nearest(LengthOfTime)
Minima and Maxima
Comparison
compareTo(PointInTime)
isBefore(PointInTime)
isAfter(PointInTime)
isAtOrBefore(PointInTime)
isAtOrAfter(PointInTime)
isZero()
Quantizable.isNonZero()
isAfter(PointInTime)
isAtOrAfter(PointInTime)
isBefore(PointInTime)
isAtOrBefore(PointInTime)
Implementation
- Author:
- jonathanl (shibo)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.telenav.kivakit.interfaces.string.Stringable
Stringable.Format
-
Method Summary
Modifier and TypeMethodDescriptiondefault Instant
default int
compareTo
(PointInTime<?, ?> that) default boolean
default boolean
isAtOrAfter
(Time that) default boolean
isAtOrBefore
(Time that) default boolean
default boolean
isGreaterThan
(Time that) default boolean
isGreaterThanOrEqualTo
(Time that) default boolean
isLessThan
(Time that) default boolean
isLessThanOrEqualTo
(Time that) default boolean
default boolean
isZero()
maximum()
default Time
minimum()
default Time
default Time
default Duration
default Time
newDuration
(Nanoseconds nanoseconds) newTime
(Nanoseconds nanoseconds) default Time
default Time
default Time
Methods inherited from interface com.telenav.kivakit.interfaces.numeric.Quantizable
asCommaSeparatedString, asSimpleString, asString, doubleQuantum, isNonZero
Methods inherited from interface com.telenav.kivakit.interfaces.string.Stringable
asString
Methods inherited from interface com.telenav.kivakit.interfaces.time.TimeMeasurement
asDays, asHours, asHumanReadableString, asMicroseconds, asMilliseconds, asMinutes, asNanoseconds, asSeconds, asWeeks, asYears, milliseconds, nanoseconds, quantum, unitString
-
Method Details
-
asJavaInstant
- Returns:
- A Java
Instant
for this time value
-
isAfter
- Returns:
- True if this time value is after the given value
-
isAtOrAfter
- Returns:
- True if this time value is at or after the given value
-
isAtOrBefore
- Returns:
- True if this time value is at or before the given value
-
isBefore
- Returns:
- True if this time value is before the given value
-
isGreaterThan
- Returns:
- True if this time value is after the given value
-
isGreaterThanOrEqualTo
- Returns:
- True if this time value is at or after the given value
-
isLessThan
- Returns:
- True if this time value is before the given value
-
isLessThanOrEqualTo
- Returns:
- True if this time value is at or before the given value
-
isNegative
default boolean isNegative() -
isZero
default boolean isZero()- Specified by:
isZero
in interfaceQuantizable
-
maximum
Time maximum()- Returns:
- The maximum point in time
-
maximum
- Returns:
- The larger of this point in time and the given point in time
-
minimum
Time minimum()- Returns:
- The minimum point in time
-
minimum
- Returns:
- The smaller of this point in time and the given point in time
-
minus
- Returns:
- This point in time minus the given length of time
-
minus
- Returns:
- This point in time minus the given point in time as a duration
-
nearest
- Returns:
- The nearest point in time of the given unit
-
plus
- Returns:
- This point in time plus the given duration
-
roundDown
- Returns:
- This point in time rounded down to the closest unit
-
roundUp
- Returns:
- This point in time rounded up to the closest unit
-