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
Author:
jonathanl (shibo)
  • Method Details

    • asJavaInstant

      default Instant asJavaInstant()
      Returns:
      A Java Instant for this time value
    • compareTo

      default int compareTo(PointInTime<?,?> that)
      Specified by:
      compareTo in interface Comparable<Time extends PointInTime<Time,Duration>>
    • isAfter

      default boolean isAfter(Time that)
      Returns:
      True if this time value is after the given value
    • isAtOrAfter

      default boolean isAtOrAfter(Time that)
      Returns:
      True if this time value is at or after the given value
    • isAtOrBefore

      default boolean isAtOrBefore(Time that)
      Returns:
      True if this time value is at or before the given value
    • isBefore

      default boolean isBefore(Time that)
      Returns:
      True if this time value is before the given value
    • isGreaterThan

      default boolean isGreaterThan(Time that)
      Returns:
      True if this time value is after the given value
    • isGreaterThanOrEqualTo

      default boolean isGreaterThanOrEqualTo(Time that)
      Returns:
      True if this time value is at or after the given value
    • isLessThan

      default boolean isLessThan(Time that)
      Returns:
      True if this time value is before the given value
    • isLessThanOrEqualTo

      default boolean isLessThanOrEqualTo(Time that)
      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 interface Quantizable
    • maximum

      Time maximum()
      Returns:
      The maximum point in time
    • maximum

      default Time maximum(Time that)
      Returns:
      The larger of this point in time and the given point in time
    • minimum

      Time minimum()
      Returns:
      The minimum point in time
    • minimum

      default Time minimum(Time that)
      Returns:
      The smaller of this point in time and the given point in time
    • minus

      default Time minus(Duration duration)
      Returns:
      This point in time minus the given length of time
    • minus

      default Duration minus(Time that)
      Returns:
      This point in time minus the given point in time as a duration
    • nearest

      default Time nearest(Duration unit)
      Returns:
      The nearest point in time of the given unit
    • newDuration

      Duration newDuration(Nanoseconds nanoseconds)
      Returns:
      An instance of the class implementing LengthOfTime
    • newTime

      Time newTime(Nanoseconds nanoseconds)
      Returns:
      An instance of the class implementing PointInTime
    • plus

      default Time plus(Duration that)
      Returns:
      This point in time plus the given duration
    • roundDown

      default Time roundDown(Duration unit)
      Returns:
      This point in time rounded down to the closest unit
    • roundUp

      default Time roundUp(Duration unit)
      Returns:
      This point in time rounded up to the closest unit