|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.nakedobjects.applib.clock.Clock
org.nakedobjects.applib.fixtures.FixtureClock
public class FixtureClock
This clock, for use by fixtures, can be set to specific time.
If not set it will provide the time provided by the system clock.
Note that - by design - it does not provide any mechanism to advance the time (eg automatic ticking of the clock). That is, the time returned is always explicitly under the control of the programmer (it can be moved forward or back as required).
| Method Summary | |
|---|---|
void |
addDate(int years,
int months,
int days)
Adjusts the time by the specified number of years, months or days. |
void |
addTime(int hours,
int minutes)
Adjusts the time by the specified number of hours and minutes. |
void |
clear()
Sets the clock to epoch, that is midnight, 1 Jan 1970 UTC. |
static FixtureClock |
initialize()
Configures the system to use a FixtureClock rather than the in-built system clock. |
static boolean |
remove()
Makes Clock.remove() visible. |
void |
reset()
Go back to just returning the system's time. |
void |
setDate(int year,
int month,
int day)
Sets the date, but the time portion is left unchanged. |
void |
setTime(int hour,
int min)
Sets the hours and minutes as specified, and sets the seconds and milliseconds to zero, but the date portion is left unchanged. |
protected long |
time()
Access via Clock.getTime(). |
java.lang.String |
toString()
|
| Methods inherited from class org.nakedobjects.applib.clock.Clock |
|---|
getInstance, getTime, getTimeAsCalendar, isInitialized, timeAsCalendar |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static FixtureClock initialize()
Must call before any other call to Clock.getInstance().
java.lang.IllegalStateException - if Clock singleton already initialized with some other implementation.public static boolean remove()
Clock.remove() visible.
protected long time()
Clock.getTime().
Will just return the system time until setDate(int, int, int) or
setTime(int, int) (or one of the overloads) has been called.
time in class Clockpublic void clear()
This is typically called before either setDate(int, int, int)
(so that time is set to midnight) and/or setTime(int, int)
(so that date is set to a well known value).
public void setTime(int hour,
int min)
setDate(int, int, int),
addTime(int, int)
public void setDate(int year,
int month,
int day)
setTime(int, int),
addDate(int, int, int)
public void addTime(int hours,
int minutes)
Typically called after setTime(int, int), to move the clock
forward or perhaps back.
addDate(int, int, int)
public void addDate(int years,
int months,
int days)
Typically called after setDate(int, int, int), to move the clock
forward or perhaps back.
addTime(int, int)public void reset()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||