+ Preconditions.checkState(state == State.STOPPED, "state is not STOPPED");
+ resume();
+ }
+
+ @Override
+ public void pause() {
+ if (state == State.RUNNING) {
+ elapsedTime += TICKER.read() - startTime;
+ state = State.PAUSED;
+ }
+ }
+
+ @Override
+ public void resume() {
+ if (state != State.RUNNING) {
+ startTime = TICKER.read();
+ state = State.RUNNING;
+ }