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

LearnLib / learnlib / 20198569605

13 Dec 2025 10:10PM UTC coverage: 94.914% (+0.4%) from 94.471%
20198569605

Pull #153

github

web-flow
Merge 6a71fc929 into 879958926
Pull Request #153: Implementation for learning MMLTs, new model for collecting statistics

1823 of 1873 new or added lines in 77 files covered. (97.33%)

1 existing line in 1 file now uncovered.

14258 of 15022 relevant lines covered (94.91%)

1.73 hits per line

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

93.33
/filters/statistics/src/main/java/de/learnlib/filter/statistic/container/ClockContainer.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of LearnLib <https://learnlib.de>.
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package de.learnlib.filter.statistic.container;
17

18
import java.time.Duration;
19
import java.time.Instant;
20

21
import org.checkerframework.checker.nullness.qual.Nullable;
22

23
/**
24
 * A stop clock that can be paused and resumed.
25
 */
26
class ClockContainer implements StatisticContainer {
27

28
    private @Nullable Instant started;
29
    private Duration elapsed;
30

31
    ClockContainer() {
2✔
32
        this.elapsed = Duration.ZERO;
2✔
33
        this.started = null;
2✔
34
    }
2✔
35

36
    void resume() {
37
        if (this.started != null) {
2✔
38
            throw new IllegalStateException("You cannot resume a timer that is still running");
2✔
39
        }
40
        this.started = Instant.now();
2✔
41
    }
2✔
42

43
    void pause() {
44
        if (started == null) {
2✔
NEW
45
            throw new IllegalStateException("You cannot pause a timer that has not been started");
×
46
        }
47
        this.elapsed = this.elapsed.plus(Duration.between(started, Instant.now()));
2✔
48
        this.started = null;
2✔
49
    }
2✔
50

51
    Duration getElapsed() {
52
        return this.elapsed;
2✔
53
    }
54

55
    @Override
56
    public String toString() {
57
        return elapsed.toMillis() + " ms";
2✔
58
    }
59
}
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

© 2026 Coveralls, Inc