Package com.qfs.snl

Interface ITimePeriod

All Known Implementing Classes:
TimePeriod, TimePeriodDto

public interface ITimePeriod
Definition of a time period.

It can optional be bounded with a start and an end.
It it possible to define the boundaries as the current time on the server, allowing clients to cope with potential time desynchronization.

Author:
ActiveViam
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    boolean
    contains(long time)
    Decides if a time is strictly contained by the period.
    default boolean
    equals(ITimePeriod period, Object other)
    Tests two objects for equality as ITimePeriod.
    long
    Gets the resolved current time.
    long
    Gets the resolved 'from' timestamp.
    long
    Gets the resolved 'to' timestamp.
    boolean
    Gets if the period has a start boundary.
    default int
    Computes a hashcode for a time period.
    boolean
    Gets if the period has an end boundary.
    boolean
    Gets if the 'from' boundary is made of the server current time.
    boolean
    Gets if the 'to' boundary is made of the server current time.
    void
    Resolves the current time for boundaries.
  • Method Details Link icon

    • resolve Link icon

      void resolve(ITimeSupplier clock)
      Resolves the current time for boundaries.
      Parameters:
      clock - the time supplier with respect to which the time period need be resolved
    • hasFromTime Link icon

      boolean hasFromTime()
      Gets if the period has a start boundary.
      Returns:
      true if a 'from' value is defined
    • getFromTime Link icon

      long getFromTime()
      Gets the resolved 'from' timestamp.
      Returns:
      boundary as a UNIX timestamp in ms
    • isFromNow Link icon

      boolean isFromNow()
      Gets if the 'from' boundary is made of the server current time.
      Returns:
      true if the boundary is dynamic, false otherwise
    • hasToTime Link icon

      boolean hasToTime()
      Gets if the period has an end boundary.
      Returns:
      true if a 'to' value is defined
    • getToTime Link icon

      long getToTime()
      Gets the resolved 'to' timestamp.
      Returns:
      boundary as a UNIX timestamp in ms
    • isToNow Link icon

      boolean isToNow()
      Gets if the 'to' boundary is made of the server current time.
      Returns:
      true if the boundary is dynamic, false otherwise
    • getCurrentTime Link icon

      long getCurrentTime()
      Gets the resolved current time.
      Returns:
      the current time.
    • contains Link icon

      boolean contains(long time)
      Decides if a time is strictly contained by the period.
      Parameters:
      time - timestamp in ms
      Returns:
      true if the period contains the time.
    • hashCode Link icon

      default int hashCode(ITimePeriod period)
      Computes a hashcode for a time period.
      Parameters:
      period - period to consider
      Returns:
      computed hashcode
    • equals Link icon

      default boolean equals(ITimePeriod period, Object other)
      Tests two objects for equality as ITimePeriod.
      Parameters:
      period - first object
      other - other object
      Returns:
      true if the objects are equal as time periods