Class CountdownClock

java.lang.Object
org.episteme.social.history.clock.Clock
org.episteme.social.history.clock.CountdownClock
All Implemented Interfaces:
Serializable, EventListener, TimeListener

public class CountdownClock extends Clock
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 Details

    • CountdownClock

      public CountdownClock(TimeServer timeServer, ModernTime initialTime)
      Creates a new CountdownClock.
      Parameters:
      timeServer - the time server to monitor
      initialTime - 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

      public ModernTime getStartingTime()
      Returns the initial countdown duration.
      Returns:
      starting time
    • setStartingTime

      public void setStartingTime(ModernTime startingTime)
      Sets the initial countdown duration.
      Parameters:
      startingTime - the new starting duration
    • getTime

      public ModernTime getTime()
      Description copied from class: Clock
      Returns the current time representation held by this clock.
      Specified by:
      getTime in class Clock
      Returns:
      the current time
    • timeChanged

      public void timeChanged(TimeEvent event)
      Description copied from interface: TimeListener
      Invoked when a time change occurs on the monitored TimeServer.
      Parameters:
      event - the event containing the new time state