Class Time

java.lang.Object
ai.dat.core.configuration.time.Time
All Implemented Interfaces:
Serializable

public final class Time extends Object implements Serializable
The definition of a time interval. Similar to a simpler version of Duration.
See Also:
  • Method Details

    • toMilliseconds

      public long toMilliseconds()
      Converts the time interval to milliseconds.
      Returns:
      The time interval in milliseconds.
    • toString

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

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

      public int hashCode()
      Overrides:
      hashCode in class Object
    • of

      public static Time of(long size, TimeUnit unit)
      Creates a new Time of the given duration and TimeUnit.
      Parameters:
      size - The duration of time.
      unit - The unit of time of the duration, for example TimeUnit.SECONDS.
      Returns:
      The time policy.
    • milliseconds

      public static Time milliseconds(long milliseconds)
      Creates a new Time that represents the given number of milliseconds.
    • seconds

      public static Time seconds(long seconds)
      Creates a new Time that represents the given number of seconds.
    • minutes

      public static Time minutes(long minutes)
      Creates a new Time that represents the given number of minutes.
    • hours

      public static Time hours(long hours)
      Creates a new Time that represents the given number of hours.
    • days

      public static Time days(long days)
      Creates a new Time that represents the given number of days.
    • fromDuration

      public static Time fromDuration(Duration duration)
      Creates a new Time that represents the number of milliseconds in the given duration.