public class Time
extends java.lang.Object
implements java.lang.Cloneable
Time
which consits of hours and minutes only.Constructor and Description |
---|
Time(short hour,
short minutes,
short seconds)
Constructs a new
Time object from the specified values. |
Time(java.lang.String tm)
Constructs a new
Time object from the specified time string. |
Modifier and Type | Method and Description |
---|---|
boolean |
after(Time time)
Returns
true if the this Time object contains a time
which is later the time in the parameter time . |
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 this
Time . |
void |
setMinutes(short minutes)
Sets the minutes of this
Time . |
java.lang.String |
toString() |
public Time(java.lang.String tm)
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".tm
- String containing a timepublic Time(short hour, short minutes, short seconds)
Time
object from the specified values.hour
- Hourminutes
- Minuteseconds
- Secondpublic Time clone()
clone
in class java.lang.Object
public short getHours()
public void setHours(short hours)
Time
.hours
- Short containing the new value for hourspublic short getMinutes()
public void setMinutes(short minutes)
Time
.minutes
- Short containing the new value for minutespublic boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean after(Time time)
true
if the this Time
object contains a time
which is later the time in the parameter time
.time
- Time which should be testedtrue
if this time is later than the time in the paramterpublic java.lang.String toString()
toString
in class java.lang.Object
public static Time now()