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

LearnLib / automatalib / 6685076669

29 Oct 2023 06:24PM UTC coverage: 89.857% (+0.06%) from 89.796%
6685076669

push

github

mtf90
align core packages with api packages

15814 of 17599 relevant lines covered (89.86%)

1.67 hits per line

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

86.67
/util/src/main/java/net/automatalib/util/ts/TS.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of AutomataLib, http://www.automatalib.net/.
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 net.automatalib.util.ts;
17

18
import java.util.Iterator;
19
import java.util.function.Function;
20

21
import net.automatalib.ts.DeterministicTransitionSystem;
22
import net.automatalib.ts.TransitionSystem;
23
import net.automatalib.ts.UniversalTransitionSystem;
24
import net.automatalib.util.ts.iterator.AllDefinedInputsIterator;
25
import net.automatalib.util.ts.iterator.AllUndefinedInputsIterator;
26
import net.automatalib.util.ts.iterator.DefinedInputsIterator;
27
import net.automatalib.util.ts.iterator.UndefinedInputsIterator;
28

29
public final class TS {
30

31
    private TS() {
32
        // prevent initialization
33
    }
34

35
    public static <S, SP> Function<S, SP> stateProperties(UniversalTransitionSystem<S, ?, ?, SP, ?> uts) {
36
        return uts::getStateProperty;
2✔
37
    }
38

39
    public static <T, TP> Function<T, TP> transitionProperties(UniversalTransitionSystem<?, ?, T, ?, TP> uts) {
40
        return uts::getTransitionProperty;
2✔
41
    }
42

43
    public static <S, I> Iterable<I> definedInputs(DeterministicTransitionSystem<S, I, ?> dts,
44
                                                   S state,
45
                                                   Iterable<? extends I> inputs) {
46
        return () -> definedInputsIterator(dts, state, inputs.iterator());
×
47
    }
48

49
    public static <S, I> Iterator<I> definedInputsIterator(TransitionSystem<S, I, ?> ts,
50
                                                           S state,
51
                                                           Iterator<? extends I> inputsIt) {
52
        return new DefinedInputsIterator<>(ts, state, inputsIt);
2✔
53
    }
54

55
    public static <S, I> Iterable<TransRef<S, I, ?>> allDefinedInputs(TransitionSystem<S, I, ?> ts,
56
                                                                      Iterable<? extends S> states,
57
                                                                      Iterable<? extends I> inputs) {
58
        return () -> allDefinedInputsIterator(ts, states.iterator(), inputs);
2✔
59
    }
60

61
    public static <S, I> Iterator<TransRef<S, I, ?>> allDefinedInputsIterator(TransitionSystem<S, I, ?> ts,
62
                                                                              Iterator<? extends S> stateIt,
63
                                                                              Iterable<? extends I> inputs) {
64
        return new AllDefinedInputsIterator<>(stateIt, ts, inputs);
2✔
65
    }
66

67
    public static <S, I> Iterable<I> undefinedInputs(TransitionSystem<S, I, ?> ts,
68
                                                     S state,
69
                                                     Iterable<? extends I> inputs) {
70
        return () -> undefinedInputsIterator(ts, state, inputs.iterator());
×
71
    }
72

73
    public static <S, I> Iterator<I> undefinedInputsIterator(TransitionSystem<S, I, ?> ts,
74
                                                             S state,
75
                                                             Iterator<? extends I> inputsIt) {
76
        return new UndefinedInputsIterator<>(ts, state, inputsIt);
2✔
77
    }
78

79
    public static <S, I> Iterable<TransRef<S, I, ?>> allUndefinedTransitions(TransitionSystem<S, I, ?> ts,
80
                                                                             Iterable<? extends S> states,
81
                                                                             Iterable<? extends I> inputs) {
82
        return () -> allUndefinedTransitionsIterator(ts, states.iterator(), inputs);
2✔
83
    }
84

85
    public static <S, I> Iterator<TransRef<S, I, ?>> allUndefinedTransitionsIterator(TransitionSystem<S, I, ?> ts,
86
                                                                                     Iterator<? extends S> stateIt,
87
                                                                                     Iterable<? extends I> inputs) {
88
        return new AllUndefinedInputsIterator<>(stateIt, ts, inputs);
2✔
89
    }
90

91
    public static final class TransRef<S, I, T> {
92

93
        public final S state;
94
        public final I input;
95
        public final T transition;
96

97
        public TransRef(S state, I input, T transition) {
2✔
98
            this.state = state;
2✔
99
            this.input = input;
2✔
100
            this.transition = transition;
2✔
101
        }
2✔
102
    }
103

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