• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In
Build has been canceled!

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

92.0
/algorithms/active/oml/src/main/java/de/learnlib/algorithms/oml/ttt/dfa/ChildrenDFA.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.oml.ttt.dfa;
17

18
import java.util.Arrays;
19
import java.util.Collection;
20
import java.util.Collections;
21

22
import de.learnlib.algorithms.oml.ttt.dt.AbstractDTNode;
23
import de.learnlib.algorithms.oml.ttt.dt.Children;
24
import de.learnlib.algorithms.oml.ttt.dt.DTInnerNode;
25
import de.learnlib.algorithms.oml.ttt.dt.DTLeaf;
26
import org.checkerframework.checker.nullness.qual.Nullable;
27

28
class ChildrenDFA<I> implements Children<I, Boolean> {
2✔
29

30
    private @Nullable AbstractDTNode<I, Boolean> trueChild;
31
    private @Nullable AbstractDTNode<I, Boolean> falseChild;
32

33
    @Override
34
    public @Nullable AbstractDTNode<I, Boolean> child(Boolean out) {
35
        return out ? trueChild : falseChild;
2✔
36
    }
37

38
    @Override
39
    public Boolean key(AbstractDTNode<I, Boolean> child) {
40
        if (child == trueChild) {
2✔
41
            return true;
2✔
42
        } else if (child == falseChild) {
2✔
43
            return false;
2✔
44
        } else {
45
            throw new AssertionError("this should not be possible");
×
46
        }
47
    }
48

49
    @Override
50
    public void addChild(Boolean out, AbstractDTNode<I, Boolean> child) {
51
        assert child(out) == null;
2✔
52
        if (out) {
2✔
53
            trueChild = child;
2✔
54
        } else {
55
            falseChild = child;
2✔
56
        }
57
    }
2✔
58

59
    @Override
60
    public void replace(DTLeaf<I, Boolean> oldNode, DTInnerNode<I, Boolean> newNode) {
61
        if (oldNode == trueChild) {
2✔
62
            trueChild = newNode;
2✔
63
        } else if (oldNode == falseChild) {
2✔
64
            falseChild = newNode;
2✔
65
        } else {
66
            throw new AssertionError("this should not be possible");
×
67
        }
68
    }
2✔
69

70
    @Override
71
    public Collection<AbstractDTNode<I, Boolean>> all() {
72
        if (trueChild != null && falseChild != null) {
2✔
73
            return Arrays.asList(trueChild, falseChild);
2✔
74
        } else if (trueChild != null) {
2✔
75
            return Collections.singletonList(trueChild);
1✔
76
        } else if (falseChild != null) {
2✔
77
            return Collections.singletonList(falseChild);
2✔
78
        } else {
79
            return Collections.emptyList();
2✔
80
        }
81
    }
82

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