|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object speedscheduler.Time
public class Time
Simple time object to store hour and minute and compare to other Times.
Field Summary | |
---|---|
private int |
hour
|
private int |
minute
|
Constructor Summary | |
---|---|
Time(int hour,
int minute)
Creates a new Time with the specified hour and minute. |
Method Summary | |
---|---|
boolean |
between(Time t1,
Time t2)
Figures out if this time is between the two specified times, t1 and t2, inclusive. |
boolean |
earlierThan(Time t)
Figures out if this time is before the specified time t. |
boolean |
equals(java.lang.Object o)
Figures out if this time is equal to the specified time. |
int |
getHour()
Gets the hour value of this time (0-23). |
int |
getMinute()
Gets the minute value of this time (0-59). |
int |
hashCode()
Gets this object's hash code |
static void |
main(java.lang.String[] args)
For unit test only |
void |
setHour(int hour)
Sets the hour for this time, must be between 0 and 23. |
void |
setMinute(int minute)
Sets the minute for this time, must be between 0 and 59. |
java.lang.String |
toString()
Gets a human readable representation of this time, with am/pm and nice formatting. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private int hour
private int minute
Constructor Detail |
---|
public Time(int hour, int minute)
hour
- minute
- Method Detail |
---|
public int getHour()
public int getMinute()
public void setHour(int hour)
hour
- The new hour.
java.lang.IllegalArgumentException
- if the hour is out of the range from 0-23.public void setMinute(int minute)
hour
- The new minute.
java.lang.IllegalArgumentException
- if the minute is out of the range from 0-59.public boolean between(Time t1, Time t2)
t1
- t2
-
public boolean earlierThan(Time t)
t
-
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
t
-
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |