• 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

94.12
/algorithms/active/ttt/src/main/java/de/learnlib/algorithms/ttt/base/TTTState.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.base;
17

18
import de.learnlib.api.AccessSequenceProvider;
19
import net.automatalib.commons.smartcollections.ResizingArrayStorage;
20
import net.automatalib.words.Word;
21

22
/**
23
 * A state in a {@link AbstractTTTHypothesis}.
24
 *
25
 * @param <I>
26
 *         input symbol
27
 */
28
public class TTTState<I, D> implements AccessSequenceProvider<I> {
29

30
    final int id;
31

32
    private final ResizingArrayStorage<TTTTransition<I, D>> transitions;
33
    private final TTTTransition<I, D> parentTransition;
34

35
    AbstractBaseDTNode<I, D> dtLeaf;
36

37
    public TTTState(int initialAlphabetSize, TTTTransition<I, D> parentTransition, int id) {
2✔
38
        this.id = id;
2✔
39
        this.parentTransition = parentTransition;
2✔
40
        this.transitions = new ResizingArrayStorage<>(TTTTransition.class, initialAlphabetSize);
2✔
41
    }
2✔
42

43
    /**
44
     * Checks whether this state is the initial state (i.e., the root of the spanning tree).
45
     *
46
     * @return {@code true} if this state is the initial state, {@code false} otherwise
47
     */
48
    public boolean isRoot() {
49
        return getParentTransition() == null;
×
50
    }
51

52
    public TTTTransition<I, D> getParentTransition() {
53
        return parentTransition;
2✔
54
    }
55

56
    /**
57
     * Retrieves the discrimination tree leaf associated with this state.
58
     *
59
     * @return the discrimination tree leaf associated with this state
60
     */
61
    public AbstractBaseDTNode<I, D> getDTLeaf() {
62
        return dtLeaf;
2✔
63
    }
64

65
    @Override
66
    public Word<I> getAccessSequence() {
67
        if (getParentTransition() != null) {
2✔
68
            return getParentTransition().getAccessSequence();
2✔
69
        }
70
        return Word.epsilon(); // root
2✔
71
    }
72

73
    @Override
74
    public String toString() {
75
        return "s" + id;
2✔
76
    }
77

78
    public void setTransition(int idx, TTTTransition<I, D> transition) {
79
        transitions.array[idx] = transition;
2✔
80
    }
2✔
81

82
    public TTTTransition<I, D> getTransition(int idx) {
83
        return transitions.array[idx];
2✔
84
    }
85

86
    public TTTTransition<I, D>[] getTransitions() {
87
        return transitions.array;
2✔
88
    }
89

90
    /**
91
     * See {@link ResizingArrayStorage#ensureCapacity(int)}.
92
     */
93
    public boolean ensureInputCapacity(int capacity) {
94
        return this.transitions.ensureCapacity(capacity);
2✔
95
    }
96
}
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