• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wurstscript / WurstScript / 228

29 Nov 2023 05:00PM UTC coverage: 62.48% (-0.09%) from 62.574%
228

push

circleci

web-flow
Show dialog for choosing game path, cleanup (#1083)

* show dialog for choosing game path

* cleanup code

* remove logs and refactor

* remove confusing mpq error, make some mpq loads readonly

17295 of 27681 relevant lines covered (62.48%)

0.62 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/languageserver/DebouncingTimer.java
1
package de.peeeq.wurstio.languageserver;
2

3
import java.time.Duration;
4
import java.util.concurrent.Executors;
5
import java.util.concurrent.ScheduledExecutorService;
6
import java.util.concurrent.ScheduledFuture;
7
import java.util.concurrent.TimeUnit;
8

9
public class DebouncingTimer {
10
    final private Runnable action;
11
    final private ScheduledExecutorService es = Executors.newSingleThreadScheduledExecutor();
×
12
    private boolean isReady = false;
×
13
    private ScheduledFuture<?> fut;
14

15

16
    public DebouncingTimer(Runnable action) {
×
17
        this.action = action;
×
18
    }
×
19

20

21
    /** checks whether the timer is ready */
22
    public synchronized boolean isReady() {
23
        return isReady;
×
24
    }
25

26
    public synchronized void stop() {
27
        if (fut != null) {
×
28
            fut.cancel(true);
×
29
            fut = null;
×
30
        }
31
        isReady = false;
×
32
    }
×
33

34
    public synchronized void start(Duration d) {
35
        stop();
×
36
        fut = es.schedule(() -> {
×
37
            synchronized (DebouncingTimer.this) {
×
38
                isReady = true;
×
39
            }
×
40
            action.run();
×
41
        }, d.toMillis(), TimeUnit.MILLISECONDS);
×
42
    }
×
43

44

45

46

47

48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc