|
||||||||||
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. |
protected static long |
MILLISECONDS_IN_DAY
|
protected static long |
MILLISECONDS_IN_HOUR
|
protected static long |
MILLISECONDS_IN_MINUTE
|
protected static long |
MILLISECONDS_IN_SECOND
|
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. |
protected |
Time(long time)
Construct a time object with the specified time. |
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. |
protected void |
setInMillis(long time)
Set the time of the day in millis. |
void |
setMinute(int minute)
Set the minute field. |
void |
setSecond(int second)
Set the second field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, 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
protected static final long MILLISECONDS_IN_DAY
protected static final long MILLISECONDS_IN_HOUR
protected static final long MILLISECONDS_IN_MINUTE
protected static final long MILLISECONDS_IN_SECOND
Constructor Detail |
---|
public Time()
protected Time(long time) throws java.lang.IllegalArgumentException
time
- The time in milliseconds. Must lie between 0 and 86399999.
java.lang.IllegalArgumentException
- If the argument is not proper.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 |
---|
protected void setInMillis(long time) throws java.lang.IllegalArgumentException
time
- The time of the day in milli seconds. The time must lie between
0 and 86399999.
java.lang.IllegalArgumentException
- If the argument is not proper.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 |