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

LearnLib / learnlib / 6805330902

08 Nov 2023 11:40PM UTC coverage: 93.335% (+0.008%) from 93.327%
6805330902

push

github

mtf90
typo

11736 of 12574 relevant lines covered (93.34%)

1.69 hits per line

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

73.33
/algorithms/active/ttt-vpa/src/main/java/de/learnlib/algorithm/ttt/vpa/NondetStackContents.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of LearnLib, http://www.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.algorithm.ttt.vpa;
17

18
import java.util.Collections;
19
import java.util.Set;
20

21
import net.automatalib.automaton.vpa.StackContents;
22
import org.checkerframework.checker.nullness.qual.Nullable;
23

24
final class NondetStackContents {
25

26
    private final Set<Integer> syms;
27

28
    private final NondetStackContents rest;
29

30
    private final boolean isTrueNondet;
31

32
    @SuppressWarnings("PMD.UselessParentheses") // to make it explicit which binary operator has higher precedence
33
    NondetStackContents(Set<Integer> syms, NondetStackContents rest) {
2✔
34
        this.syms = syms;
2✔
35
        this.rest = rest;
2✔
36
        this.isTrueNondet = syms.size() > 1 || (rest != null && rest.isTrueNondet);
2✔
37
    }
2✔
38

39
    public static NondetStackContents push(Set<Integer> syms, NondetStackContents rest) {
40
        return new NondetStackContents(syms, rest);
2✔
41
    }
42

43
    public static @Nullable NondetStackContents fromDet(@Nullable StackContents sc) {
44
        if (sc == null) {
2✔
45
            return null;
2✔
46
        }
47
        return push(Collections.singleton(sc.peek()), fromDet(sc.pop()));
×
48
    }
49

50
    public static @Nullable StackContents toDet(@Nullable NondetStackContents nsc) {
51
        if (nsc == null) {
×
52
            return null;
×
53
        }
54
        return StackContents.push(nsc.syms.iterator().next(), toDet(nsc.pop()));
×
55
    }
56

57
    public Set<Integer> peek() {
58
        return syms;
2✔
59
    }
60

61
    public NondetStackContents pop() {
62
        return rest;
2✔
63
    }
64

65
    public boolean isTrueNondet() {
66
        return this.isTrueNondet;
2✔
67
    }
68

69
}
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