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

LearnLib / automatalib / 10220057657

02 Aug 2024 06:06PM UTC coverage: 90.366% (+0.3%) from 90.072%
10220057657

push

github

mtf90
overhaul serizalition code

* unify access to Input(De)Serializers behind facades to leverage the default methods for various input/output channels
* drop implicit buffering/decompressing as this should be decided where the stream are constructed (user-land)
* remove/cleanup the (now) unused code

300 of 349 new or added lines in 33 files covered. (85.96%)

9 existing lines in 3 files now uncovered.

15927 of 17625 relevant lines covered (90.37%)

1.67 hits per line

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

80.0
/serialization/taf/src/main/java/net/automatalib/serialization/taf/parser/TAFParsers.java
1
/* Copyright (C) 2013-2024 TU Dortmund University
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.serialization.taf.parser;
17

18
import net.automatalib.automaton.AutomatonCreator;
19
import net.automatalib.automaton.FiniteAlphabetAutomaton;
20
import net.automatalib.automaton.fsa.DFA;
21
import net.automatalib.automaton.fsa.MutableDFA;
22
import net.automatalib.automaton.fsa.impl.CompactDFA;
23
import net.automatalib.automaton.transducer.MealyMachine;
24
import net.automatalib.automaton.transducer.MutableMealyMachine;
25
import net.automatalib.automaton.transducer.impl.CompactMealy;
26
import net.automatalib.serialization.InputModelDeserializer;
27
import net.automatalib.serialization.ModelDeserializer;
28

29
/**
30
 * Facade for TAF (textual automaton format) parsing. This class provides several static methods to access
31
 * {@link InputModelDeserializer}s for TAF descriptions of {@link DFA}s and {@link MealyMachine}s.
32
 */
33
public final class TAFParsers {
34

35
    private TAFParsers() {
36
        // prevent instantiation
37
    }
38

39
    /**
40
     * Constructs an {@link InputModelDeserializer} that reads a {@link DFA} description and writes it into a
41
     * {@link CompactDFA}. Convenience method for {@link #dfa(AutomatonCreator)}.
42
     *
43
     * @return an {@link InputModelDeserializer} that reads a {@link DFA} description
44
     *
45
     * @see #dfa(AutomatonCreator)
46
     */
47
    public static InputModelDeserializer<String, CompactDFA<String>> dfa() {
48
        return dfa(new CompactDFA.Creator<>());
2✔
49
    }
50

51
    /**
52
     * Constructs an {@link InputModelDeserializer} that reads a {@link DFA} description and writes it into a provided
53
     * {@link MutableDFA}.
54
     *
55
     * @param creator
56
     *         the creator to construct the concrete automaton instance
57
     * @param <S>
58
     *         state type
59
     * @param <A>
60
     *         (concrete) automaton type
61
     *
62
     * @return an {@link InputModelDeserializer} that reads a {@link DFA} description
63
     */
64
    public static <S, A extends MutableDFA<S, String>> InputModelDeserializer<String, A> dfa(AutomatonCreator<A, String> creator) {
65
        return new TAFDFAParser<>(creator);
2✔
66
    }
67

68
    /**
69
     * Constructs an {@link InputModelDeserializer} that reads a {@link MealyMachine} description and writes it into a
70
     * {@link CompactMealy}. Convenience method for {@link #mealy(AutomatonCreator)}.
71
     *
72
     * @return an {@link InputModelDeserializer} that reads a {@link MealyMachine} description
73
     *
74
     * @see #mealy(AutomatonCreator)
75
     */
76
    public static InputModelDeserializer<String, CompactMealy<String, String>> mealy() {
77
        return mealy(new CompactMealy.Creator<>());
2✔
78
    }
79

80
    /**
81
     * Constructs an {@link InputModelDeserializer} that reads a {@link MealyMachine} description and writes it into a
82
     * provided {@link MutableMealyMachine}.
83
     *
84
     * @param creator
85
     *         the creator to construct the concrete automaton instance
86
     * @param <S>
87
     *         state type
88
     * @param <T>
89
     *         transition type
90
     * @param <A>
91
     *         (concrete) automaton type
92
     *
93
     * @return an {@link InputModelDeserializer} that reads a {@link MealyMachine} description
94
     */
95
    public static <S, T, A extends MutableMealyMachine<S, String, T, String>> InputModelDeserializer<String, A> mealy(
96
            AutomatonCreator<A, String> creator) {
97
        return new TAFMealyParser<>(creator);
2✔
98
    }
99

100
    /**
101
     * Constructs an {@link InputModelDeserializer} that reads either a {@link DFA} or a {@link MealyMachine}
102
     * description and writes it into a {@link FiniteAlphabetAutomaton}.
103
     *
104
     * @return an {@link InputModelDeserializer} that reads either a {@link DFA} or a {@link MealyMachine} description
105
     *
106
     * @see #dfa()
107
     * @see #mealy()
108
     */
109
    public static ModelDeserializer<FiniteAlphabetAutomaton<?, String, ?>> any() {
NEW
110
        return new TAFAnyParser();
×
111
    }
112
}
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

© 2026 Coveralls, Inc