utility, takes a consumer and returns a version that runs only once every "count" iterations
(Consumer<T> c, int count)
| 55 | */ |
| 56 | |
| 57 | static public <T> Consumer<T> strobe(Consumer<T> c, int count) { |
| 58 | return new Consumer<T>() { |
| 59 | int tick = 0; |
| 60 | |
| 61 | @Override |
| 62 | public void accept(T t) { |
| 63 | if (tick++ % count == 0) c.accept(t); |
| 64 | } |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | static public Perform perform(int pass, Supplier<Boolean> action) { |
| 69 | return new Perform() { |