| 7 | import java.time.*; // Java 8 time classes |
| 8 | |
| 9 | public abstract class Event { |
| 10 | private Instant eventTime; |
| 11 | protected final Duration delayTime; |
| 12 | public Event(long millisecondDelay) { |
| 13 | delayTime = Duration.ofMillis(millisecondDelay); |
| 14 | start(); |
| 15 | } |
| 16 | public void start() { // Allows restarting |
| 17 | eventTime = Instant.now().plus(delayTime); |
| 18 | } |
| 19 | public boolean ready() { |
| 20 | return Instant.now().isAfter(eventTime); |
| 21 | } |
| 22 | public abstract void action(); |
| 23 | } |
nothing calls this directly
no outgoing calls
no test coverage detected