|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.colorado.simulations.Clock
public class Clock
A Clock object holds one instance of a time value shuch as
9:48 P.M.
CuckooClock,
Clock24| Constructor Summary | |
|---|---|
Clock()
Construct a Clock that is initially set to midnight. |
|
| Method Summary | ||
|---|---|---|
void |
advance(int minutes)
Move this Clock's time by a given number of minutes. |
|
static boolean |
earlier(Clock c1,
Clock c2)
Test whether the time on one clock is earlier than the time on another. |
|
int |
getHour()
Get the current hour of this Clock. |
|
int |
getMinute()
Get the current minute of this Clock. |
|
boolean |
isMorning()
Check whether this Clock's time is before noon. |
|
void |
setTime(int hour,
int minute,
boolean morning)
Set the current time of this Clock. |
|
static
|
someMorning(java.util.Vector<T> clocks)
|
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Clock()
Clock that is initially set to midnight.
- - none
Clock has been initialized with an initial time of
midnight.| Method Detail |
|---|
public void advance(int minutes)
Clock's time by a given number of minutes.
minutes - the amount to move this Clock's time
Clock's time has been moved forward by the indicated
number of minutes. Note: A negative argument moves this
Clock backward.
public static boolean earlier(Clock c1,
Clock c2)
c1 - a Clockc2 - another Clock
true if the time on c1 is earlier
than the time on c2 over a usual day (starting at midnight
and continuing through 11:59 P.M.); otherwise returns false.public int getHour()
Clock.
- - none
public int getMinute()
Clock.
- - none
public boolean isMorning()
Clock's time is before noon.
- - none
Clock's time lies from 12:00 midnight
to 11:59 A.M. (inclusive), then the return value is
true; otherwise the return value is false.
public void setTime(int hour,
int minute,
boolean morning)
Clock.
hour - the hour to set this Clock tominute - the minute to set this Clock tomorning - indication of whether the new time is before noon
Clock's time has been set to the given hour and
minute (using the usual 12-hour notation). If the third parameter,
morning, is true, then this time is from
12:00 midnight to 11:59 A.M. Otherwise this time is from 12:00 noon
to 11:59 P.M.
java.lang.IllegalArgumentException - Indicates that the hour or minute is illegal.public static <T extends Clock> boolean someMorning(java.util.Vector<T> clocks)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||