Interface QueryableTimer

  • All Known Implementing Classes:
    SimpleActiveTimer

    public interface QueryableTimer
    A timer that can be asked about its current state.

    Valid timer states are:

    • New: not started yet.
    • Running: started, but not stopped yet.
    • Stopped: started and then stopped.
    • Method Detail

      • hasBeenStarted

        boolean hasBeenStarted()
        Has the timer been started?
        Returns:
        True if the timer has been started.
      • isRunning

        boolean isRunning()
        Is the timer currently running?
        Returns:
        True if the timer is currently running.
      • isStopped

        boolean isStopped()
        Has the timer been stopped?
        Returns:
        True if the timer has been stopped.
      • elapsed

        Duration elapsed()
        What is the elapsed time of this timer?

        If the timer is running, this is the elapsed time since it was started, until the current time. If the timer has been stopped, this is the elapsed time from the moment it was started until the moment it was stopped. (When the timer has been stopped, this value does not change.)

        Returns:
        The amount of time that has elapsed since the timer was started.