Interface Stopwatch

All Superinterfaces:
Standard<Stopwatch>
All Known Implementing Classes:
Stopwatch1

public interface Stopwatch extends Standard<Stopwatch>
Stopwatch component with all its methods. (Note: by package-wide convention, all references are non-null.)
Mathematical Subtypes:
STOPWATCH_MODEL is (
  time: integer,
  running: boolean
 )
 exemplar s
 constraint
  s.time = [CPU time in milliseconds that this.running has been true]
Mathematical Model (abstract value and abstract invariant of this):
type Stopwatch is modeled by STOPWATCH_MODEL
Constructor(s) (initial abstract value(s) of this):
():
 ensures
  this = (0, false)
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns this.time in milliseconds.
    boolean
    Returns this.running.
    void
    Starts this.
    void
    Stops this.

    Methods inherited from interface components.standard.Standard

    clear, newInstance, transferFrom
  • Method Details

    • start

      void start()
      Starts this.
      Updates:
      this.running
      Requires:
      not this.running
      Ensures:
      this.running
    • stop

      void stop()
      Stops this.
      Updates:
      this.running
      Requires:
      this.running
      Ensures:
      not this.running
    • elapsed

      int elapsed()
      Returns this.time in milliseconds.
      Returns:
      this.time
      Ensures:
      elapsed = this.time
    • isRunning

      boolean isRunning()
      Returns this.running.
      Returns:
      this.running
      Ensures:
      isRunning = this.running