Class TimePeriod

java.lang.Object
com.qfs.snl.impl.TimePeriod
All Implemented Interfaces:
ITimePeriod

public class TimePeriod extends Object implements ITimePeriod
Effective implementation of ITimePeriod.
Author:
ActiveViam
  • Constructor Details Link icon

    • TimePeriod Link icon

      public TimePeriod()
      Default constructor with prescribed time supplier.

      This creates a time period without boundaries.

    • TimePeriod Link icon

      public TimePeriod(ITimePeriod period)
      Copy constructor.
      Parameters:
      period - period to copy
  • Method Details Link icon

    • from Link icon

      public TimePeriod from(long time)
      Adds a start boundary.
      Parameters:
      time - timestamp in ms
      Returns:
      this
    • fromNow Link icon

      public TimePeriod fromNow()
      Adds a start boundary using server current time.
      Returns:
      this
    • to Link icon

      public TimePeriod to(long time)
      Adds an end boundary to the time period.
      Parameters:
      time - timestamp in ms
      Returns:
      this
    • toNow Link icon

      public TimePeriod toNow()
      Adds an end boundary to the period using server current time.
      Returns:
      this
    • resolve Link icon

      public void resolve(ITimeSupplier clock)
      Description copied from interface: ITimePeriod
      Resolves the current time for boundaries.
      Specified by:
      resolve in interface ITimePeriod
      Parameters:
      clock - the time supplier with respect to which the time period need be resolved
    • hasFromTime Link icon

      public boolean hasFromTime()
      Description copied from interface: ITimePeriod
      Gets if the period has a start boundary.
      Specified by:
      hasFromTime in interface ITimePeriod
      Returns:
      true if a 'from' value is defined
    • getFromTime Link icon

      public long getFromTime()
      Description copied from interface: ITimePeriod
      Gets the resolved 'from' timestamp.
      Specified by:
      getFromTime in interface ITimePeriod
      Returns:
      boundary as a UNIX timestamp in ms
    • isFromNow Link icon

      public boolean isFromNow()
      Description copied from interface: ITimePeriod
      Gets if the 'from' boundary is made of the server current time.
      Specified by:
      isFromNow in interface ITimePeriod
      Returns:
      true if the boundary is dynamic, false otherwise
    • hasToTime Link icon

      public boolean hasToTime()
      Description copied from interface: ITimePeriod
      Gets if the period has an end boundary.
      Specified by:
      hasToTime in interface ITimePeriod
      Returns:
      true if a 'to' value is defined
    • getToTime Link icon

      public long getToTime()
      Description copied from interface: ITimePeriod
      Gets the resolved 'to' timestamp.
      Specified by:
      getToTime in interface ITimePeriod
      Returns:
      boundary as a UNIX timestamp in ms
    • isToNow Link icon

      public boolean isToNow()
      Description copied from interface: ITimePeriod
      Gets if the 'to' boundary is made of the server current time.
      Specified by:
      isToNow in interface ITimePeriod
      Returns:
      true if the boundary is dynamic, false otherwise
    • getCurrentTime Link icon

      public long getCurrentTime()
      Description copied from interface: ITimePeriod
      Gets the resolved current time.
      Specified by:
      getCurrentTime in interface ITimePeriod
      Returns:
      the current time.
    • contains Link icon

      public boolean contains(long time)
      Description copied from interface: ITimePeriod
      Decides if a time is strictly contained by the period.
      Specified by:
      contains in interface ITimePeriod
      Parameters:
      time - timestamp in ms
      Returns:
      true if the period contains the time.
    • toString Link icon

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object