Package components.stopwatch
Interface Stopwatch
- All Known Implementing Classes:
Stopwatch1
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
Methods inherited from interface components.standard.Standard
clear, newInstance, transferFrom
-
Method Details
-
start
void start()Startsthis
.- Updates:
this.running
- Requires:
not this.running
- Ensures:
this.running
-
stop
void stop()Stopsthis
.- Updates:
this.running
- Requires:
this.running
- Ensures:
not this.running
-
elapsed
int elapsed()Returnsthis.time
in milliseconds.- Returns:
this.time
- Ensures:
elapsed = this.time
-
isRunning
boolean isRunning()Returnsthis.running
.- Returns:
this.running
- Ensures:
isRunning = this.running
-