Package com.uc4.api
Class Time
- java.lang.Object
-
- com.uc4.api.Time
-
- All Implemented Interfaces:
java.lang.Cloneable
public class Time extends java.lang.Object implements java.lang.Cloneable
This class represents aTime
which consits of hours and minutes only.
-
-
Constructor Summary
Constructors Constructor Description Time(short hour, short minutes, short seconds)
Constructs a newTime
object from the specified values.Time(@Nullable java.time.LocalTime jdkLocalTime)
creates a uc4 Time from a jdk java.time.LocalTime.Time(java.lang.String tm)
Constructs a newTime
object from the specified time string.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
after(Time time)
Returnstrue
if the thisTime
object contains a time which is later the time in the parametertime
.Time
clone()
boolean
equals(java.lang.Object obj)
short
getHours()
Returns the hours as short.short
getMinutes()
Returns the minutes as short.int
hashCode()
static Time
now()
Creates a new Time instance which is set to the current time.void
setHours(short hours)
Sets the hours of thisTime
.void
setMinutes(short minutes)
Sets the minutes of thisTime
.java.time.LocalTime
toLocalTime()
java.lang.String
toString()
-
-
-
Constructor Detail
-
Time
public Time(java.lang.String tm)
Constructs a newTime
object from the specified time string. The format oftime
must be hh:mm An empty string can also be used to create aTime
object which contains "00:00".- Parameters:
tm
- String containing a time
-
Time
public Time(short hour, short minutes, short seconds)
Constructs a newTime
object from the specified values.- Parameters:
hour
- Hourminutes
- Minuteseconds
- Second
-
Time
public Time(@Nullable java.time.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 Detail
-
clone
public Time clone()
- Overrides:
clone
in classjava.lang.Object
-
toLocalTime
public java.time.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 thisTime
.- 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 thisTime
.- Parameters:
minutes
- Short containing the new value for minutes
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
after
public boolean after(Time time)
Returnstrue
if the thisTime
object contains a time which is later the time in the parametertime
.- 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 java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
now
public static Time now()
Creates a new Time instance which is set to the current time.- Returns:
- Time
-
-