Skip to content

Commit

Permalink
Merge pull request #1494 from NASA-AMMOS/documentation/streamline-loc…
Browse files Browse the repository at this point in the history
…ator-guide

Add a users guide to streamline resource framework
  • Loading branch information
dandelany authored Aug 7, 2024
2 parents 1ce729a + 8d7ab6c commit bf29adf
Show file tree
Hide file tree
Showing 3 changed files with 1,409 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,13 @@ public static VariableClock pausedStopwatch() {
public static VariableClock pausedStopwatch(Duration time) {
return new VariableClock(time, 0);
}

public static VariableClock runningTimer(Duration timeRemaining) {
return new VariableClock(timeRemaining, -1);
}

public static VariableClock pausedTimer(Duration timeRemaining) {
// Identical to pausedStopwatch (could be condensed to just "paused", perhaps?)
return new VariableClock(timeRemaining, 0);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@ public static void reset(MutableResource<VariableClock> stopwatch) {
public static void restart(MutableResource<VariableClock> stopwatch) {
stopwatch.emit("Restart", effect(c -> runningStopwatch(ZERO)));
}

/**
* Start counting down from current value.
*/
public static void startCountdown(MutableResource<VariableClock> timer) {
timer.emit("Start Countdown", effect(c -> runningTimer(c.extract())));
}
}
Loading

0 comments on commit bf29adf

Please sign in to comment.