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

LearnLib / learnlib / 6433387082

06 Oct 2023 03:10PM UTC coverage: 92.296% (-0.007%) from 92.303%
6433387082

push

github

mtf90
update Falk's developer id

11573 of 12539 relevant lines covered (92.3%)

1.67 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/algorithms/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.algorithms.ttt.vpa;
17

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

21
import net.automatalib.automata.vpa.StackContents;
22

23
final class NondetStackContents {
24

25
    private final Set<Integer> syms;
26

27
    private final NondetStackContents rest;
28

29
    private final boolean isTrueNondet;
30

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

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

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

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

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

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

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

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