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

LearnLib / automatalib / 10248696670

05 Aug 2024 12:21PM UTC coverage: 90.741% (+0.7%) from 90.072%
10248696670

push

github

web-flow
Serialization Overhaul (#81)

* 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

* taf cleanups

* fix wording

343 of 358 new or added lines in 33 files covered. (95.81%)

7 existing lines in 2 files now uncovered.

15994 of 17626 relevant lines covered (90.74%)

1.68 hits per line

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

91.67
/serialization/taf/src/main/java/net/automatalib/serialization/taf/writer/TAFAnyWriter.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.writer;
17

18
import java.io.IOException;
19
import java.io.OutputStream;
20

21
import net.automatalib.alphabet.Alphabet;
22
import net.automatalib.automaton.FiniteAlphabetAutomaton;
23
import net.automatalib.automaton.fsa.DFA;
24
import net.automatalib.automaton.transducer.MealyMachine;
25
import net.automatalib.serialization.InputModelSerializer;
26

27
class TAFAnyWriter<S, I, T, O, A extends FiniteAlphabetAutomaton<S, I, T>> implements InputModelSerializer<I, A> {
2✔
28

29
    @Override
30
    public void writeModel(OutputStream os, A automaton, Alphabet<I> inputs) throws IOException {
31
        if (automaton instanceof DFA) {
2✔
32
            @SuppressWarnings("unchecked")
33
            final DFA<S, I> dfa = (DFA<S, I>) automaton;
2✔
34
            final TAFConcreteWriter<S, I, ?, ?, DFA<S, I>> writer =
2✔
35
                    new TAFConcreteWriter<>("dfa", TAFWriters::extractSPDFA);
36
            writer.writeModel(os, dfa, inputs);
2✔
37
        } else if (automaton instanceof MealyMachine) {
2✔
38
            @SuppressWarnings("unchecked")
39
            final MealyMachine<S, I, T, O> mealy = (MealyMachine<S, I, T, O>) automaton;
2✔
40
            final TAFConcreteWriter<S, I, T, O, MealyMachine<S, I, T, O>> writer =
2✔
41
                    new TAFConcreteWriter<>("mealy", TAFWriters::extractSPMealy);
42
            writer.writeModel(os, mealy, inputs);
2✔
43
        } else {
2✔
NEW
44
            throw new IllegalArgumentException("Unknown type " + automaton.getClass().getSimpleName());
×
45
        }
46
    }
2✔
47
}
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