Class TimeInterval

java.lang.Object
org.yamcs.studio.data.sim.TimeInterval

public class TimeInterval extends Object
A period of time that spans two instances (included) at the nanosecond precision.
  • Method Details

    • 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
    • around

      public static TimeInterval around(Duration duration, Instant reference)
      Returns a time interval that lasts this duration and is centered around the given instant reference.
      Parameters:
      duration - the duration
      reference - a instant
      Returns:
      a new time interval
    • after

      public static TimeInterval after(Duration duration, Instant reference)
      Returns a time interval that lasts this duration and starts from the given instant.
      Parameters:
      duration - the duration
      reference - a instant
      Returns:
      a new time interval
    • before

      public static TimeInterval before(Duration duration, Instant reference)
      Returns a time interval that lasts this duration and ends at the given instant.
      Parameters:
      duration - the duration
      reference - a instant
      Returns:
      a new time 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
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object