Class CountdownClock
java.lang.Object
org.episteme.social.history.clock.Clock
org.episteme.social.history.clock.CountdownClock
- All Implemented Interfaces:
Serializable, EventListener, TimeListener
A clock that counts down from a target duration.
Shows the remaining time relative to a deadline capture from a
TimeServer.
* @version 1.1- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCountdownClock(TimeServer timeServer, ModernTime initialTime) Creates a new CountdownClock. -
Method Summary
Modifier and TypeMethodDescriptionReturns the initial countdown duration.getTime()Returns the current time representation held by this clock.voidreset()Resets the countdown to its initial duration.voidsetStartingTime(ModernTime startingTime) Sets the initial countdown duration.voidstart()Starts the underlying time server.voidstop()Stops the underlying time server.voidtimeChanged(TimeEvent event) Invoked when a time change occurs on the monitoredTimeServer.Methods inherited from class Clock
getTimeServer, toString
-
Constructor Details
-
CountdownClock
Creates a new CountdownClock.- Parameters:
timeServer- the time server to monitorinitialTime- the starting countdown duration- Throws:
NullPointerException- if timeServer or initialTime is null
-
-
Method Details
-
start
public void start()Starts the underlying time server. -
stop
public void stop()Stops the underlying time server. -
reset
public void reset()Resets the countdown to its initial duration. -
getStartingTime
-
setStartingTime
Sets the initial countdown duration.- Parameters:
startingTime- the new starting duration
-
getTime
Description copied from class:ClockReturns the current time representation held by this clock. -
timeChanged
Description copied from interface:TimeListenerInvoked when a time change occurs on the monitoredTimeServer.- Parameters:
event- the event containing the new time state
-