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 Detail

      • resolve

        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

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

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

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

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

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

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

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

        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

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

        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