Class TimeInterval


  • public class TimeInterval
    extends Object
    A period of time that spans two instants (included) at the nanosecond precision.
    Author:
    carcassi
    • Method Detail

      • contains

        public boolean contains​(Instant instant)
        True if the given time stamp is inside the interval.
        Parameters:
        instant - a time stamp
        Returns:
        true if inside the interval
      • between

        public static TimeInterval between​(Instant start,
                                           Instant end)
        Returns the interval between the given timestamps.
        Parameters:
        start - the beginning of the interval
        end - the end of the interval
        Returns:
        a new interval
      • minus

        public TimeInterval minus​(Duration duration)
        Returns a new interval shifted backward in time by the given duration.
        Parameters:
        duration - a time duration
        Returns:
        the new shifted interval
      • getStart

        public Instant getStart()
        Initial value of the interval.
        Returns:
        the initial instant
      • getEnd

        public Instant getEnd()
        Final value of the interval.
        Returns:
        the final instant
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object