Package com.uc4.api

Class Time

java.lang.Object
com.uc4.api.Time
All Implemented Interfaces:
Cloneable

public class Time extends Object implements Cloneable
This class represents a Time which consits of hours and minutes only.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Time(short hour, short minutes, short seconds)
    Constructs a new Time object from the specified values.
    Time(@Nullable LocalTime jdkLocalTime)
    creates a uc4 Time from a jdk java.time.LocalTime.
    Constructs a new Time object from the specified time string.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    after(Time time)
    Returns true if the this Time object contains a time which is later the time in the parameter time.
     
    boolean
     
    short
    Returns the hours as short.
    short
    Returns the minutes as short.
    int
     
    static Time
    now()
    Creates a new Time instance which is set to the current time.
    void
    setHours(short hours)
    Sets the hours of this Time.
    void
    setMinutes(short minutes)
    Sets the minutes of this Time.
     
     

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Time

      public Time(String tm)
      Constructs a new Time object from the specified time string. The format of time must be hh:mm An empty string can also be used to create a Time object which contains "00:00".
      Parameters:
      tm - String containing a time
    • Time

      public Time(short hour, short minutes, short seconds)
      Constructs a new Time object from the specified values.
      Parameters:
      hour - Hour
      minutes - Minute
      seconds - Second
    • Time

      public Time(@Nullable LocalTime jdkLocalTime)
      creates a uc4 Time from a jdk java.time.LocalTime.
      Parameters:
      jdkLocalTime - . if null, the time at midnight (0:00:00) will be used
  • Method Details

    • clone

      public Time clone()
      Overrides:
      clone in class Object
    • toLocalTime

      public LocalTime toLocalTime()
    • getHours

      public short getHours()
      Returns the hours as short.
      Returns:
      Short containing the hours
    • setHours

      public void setHours(short hours)
      Sets the hours of this Time.
      Parameters:
      hours - Short containing the new value for hours
    • getMinutes

      public short getMinutes()
      Returns the minutes as short.
      Returns:
      Short containing the minutes
    • setMinutes

      public void setMinutes(short minutes)
      Sets the minutes of this Time.
      Parameters:
      minutes - Short containing the new value for minutes
    • equals

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

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

      public boolean after(Time time)
      Returns true if the this Time object contains a time which is later the time in the parameter time.
      Parameters:
      time - Time which should be tested
      Returns:
      Boolean value which is set to true if this time is later than the time in the paramter
    • toString

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

      public static Time now()
      Creates a new Time instance which is set to the current time.
      Returns:
      Time