• 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

81.82
/serialization/taf/src/main/java/net/automatalib/serialization/taf/parser/TAFMealyParser.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 java.io.IOException;
19
import java.io.InputStream;
20
import java.io.Reader;
21

22
import net.automatalib.automaton.AutomatonCreator;
23
import net.automatalib.automaton.transducer.MutableMealyMachine;
24
import net.automatalib.common.util.IOUtil;
25
import net.automatalib.exception.FormatException;
26
import net.automatalib.serialization.InputModelData;
27
import net.automatalib.serialization.InputModelDeserializer;
28

29
final class TAFMealyParser<S, T, A extends MutableMealyMachine<S, String, T, String>>
30
        implements InputModelDeserializer<String, A> {
31

32
    private final AutomatonCreator<A, String> creator;
33

34
    TAFMealyParser(AutomatonCreator<A, String> creator) {
2✔
35
        this.creator = creator;
2✔
36
    }
2✔
37

38
    @Override
39
    public InputModelData<String, A> readModel(InputStream is) throws IOException, FormatException {
40

41
        try (Reader r = IOUtil.asNonClosingUTF8Reader(is)) {
2✔
42
            final InternalTAFParser parser = new InternalTAFParser(r);
2✔
43
            final DefaultTAFBuilderMealy<A, S, T> builder = new DefaultTAFBuilderMealy<>(parser, creator);
2✔
44

45
            try {
46
                parser.mealy(builder);
2✔
NEW
47
            } catch (ParseException ex) {
×
NEW
48
                throw new FormatException(ex);
×
49
            }
2✔
50

51
            return new InputModelData<>(builder.finish(), builder.getAlphabet());
2✔
52
        }
53
    }
54
}
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