|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.clock.Time
public class Time
Class to represent time of the day. The time of the hour is represented by three fields -- hour, minute and second.
Field Summary | |
---|---|
static int |
HOURS_IN_DAY
Hours in a day. |
static int |
MINUTES_IN_HOUR
Minutes in a hour. |
static int |
SECONDS_IN_MINUTE
Seconds in a minute. |
Constructor Summary | |
---|---|
Time()
Default constructor. |
|
Time(int hour,
int minute,
int second)
Construct a time field given the hour, minute and second fields. |
Method Summary | |
---|---|
int |
getHour()
Get the hour of the day. |
long |
getInMillis()
Get the time of the day in milliseconds. |
int |
getMinute()
Get the minute field. |
int |
getSecond()
Get the second field. |
void |
setHour(int hour)
Set the hour field. |
void |
setMinute(int minute)
Set the minute field. |
void |
setSecond(int second)
Set the second field. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int HOURS_IN_DAY
public static final int MINUTES_IN_HOUR
public static final int SECONDS_IN_MINUTE
Constructor Detail |
---|
public Time()
public Time(int hour, int minute, int second)
hour
- The hour of the day. Must be between 0 and 23.minute
- The minute of the hour. Must be between 0 and 59.second
- The second of the minute. Must be between 0 and 59.
java.lang.IllegalArgumentException
- If any of the arguments is improper.Method Detail |
---|
public long getInMillis()
public int getHour()
public void setHour(int hour) throws java.lang.IllegalArgumentException
hour
- The hour of the day. Must lie between 0 and 23.
java.lang.IllegalArgumentException
- If the argument is illegal.public int getMinute()
public void setMinute(int minute)
minute
- The minute of the hour. Must lie between 0 and 59.
java.lang.IllegalArgumentException
- If the argument is illegal.public int getSecond()
public void setSecond(int second)
second
- The second of the hour. Must lie between 0 and 59.
java.lang.IllegalArgumentException
- If the argument is illegal.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |