@Override public InputModelData<Integer, DFA<Integer, Integer>> readModel(InputStream is) throws IOException { final CompactDFA<Integer> automaton = readGenericDFA(is); return new InputModelData<>(automaton, automaton.getInputAlphabet()); }
@Override public InputModelData<Integer, DFA<Integer, Integer>> readModel(InputStream is) throws IOException { final CompactDFA<Integer> automaton = readGenericDFA(is); return new InputModelData<>(automaton, automaton.getInputAlphabet()); }
@Override public InputModelData<String, MealyMachine<?, String, ?, String>> readModel(InputStream is) throws IOException { final CompactMealy<String, String> automaton = TAFParser.parseMealy(is, PrintStreamDiagnosticListener.getStderrDiagnosticListener()); return new InputModelData<>(automaton, automaton.getInputAlphabet()); } }
@Override public InputModelData<String, DFA<Integer, String>> readModel(InputStream is) throws IOException { final CompactDFA<String> automaton = TAFParser.parseDFA(is, PrintStreamDiagnosticListener.getStderrDiagnosticListener()); return new InputModelData<>(automaton, automaton.getInputAlphabet()); } }
public <I> InputModelData<I, SimpleAutomaton<Integer, I>> parse(Function<String, I> inputTransformer) throws IOException { try (Reader isr = IOUtil.asUTF8Reader(inputStream); BufferedReader bisr = new BufferedReader(isr)) { // parsing parseHeader(bisr); while (parseTransition(bisr)) {} // automaton construction final Map<String, I> inputMap = alphabetSymbols.stream().collect(Collectors.toMap(Function.identity(), inputTransformer)); final Alphabet<I> alphabet = Alphabets.fromCollection(inputMap.values()); final CompactNFA<I> result = new CompactNFA<>(alphabet, transitionMap.size()); for (int i = 0; i < transitionMap.size(); i++) { result.addState(); } for (final Map.Entry<Integer, Map<String, Integer>> outgoing : transitionMap.entrySet()) { final Integer src = outgoing.getKey(); for (final Map.Entry<String, Integer> targets : outgoing.getValue().entrySet()) { final String input = targets.getKey(); final Integer dest = targets.getValue(); result.addTransition(src, inputMap.get(input), dest); } } result.setInitial(initialState, true); return new InputModelData<>(result, alphabet); } }
@Override public InputModelData<String, MealyMachine<?, String, ?, String>> readModel(InputStream is) throws TAFParseException { final CompactMealy<String, String> automaton = TAFParser.parseMealy(is, PrintStreamDiagnosticListener.getStderrDiagnosticListener()); return new InputModelData<>(automaton, automaton.getInputAlphabet()); } }
@Override public InputModelData<String, DFA<Integer, String>> readModel(InputStream is) throws TAFParseException { final CompactDFA<String> automaton = TAFParser.parseDFA(is, PrintStreamDiagnosticListener.getStderrDiagnosticListener()); return new InputModelData<>(automaton, automaton.getInputAlphabet()); } }
@Override public InputModelData<Integer, NFA<Integer, Integer>> readModel(InputStream is) throws IOException { final InputStream uncompressedStream = IOUtil.asUncompressedInputStream(is); SAFInput in = new SAFInput(uncompressedStream); final CompactNFA<Integer> automaton = in.readNativeNFA(); return new InputModelData<>(automaton, automaton.getInputAlphabet()); }
@Override public InputModelData<Integer, DFA<Integer, Integer>> readModel(InputStream is) throws IOException { final InputStream uncompressedStream = IOUtil.asUncompressedInputStream(is); SAFInput in = new SAFInput(uncompressedStream); final CompactDFA<Integer> automaton = in.readNativeDFA(); return new InputModelData<>(automaton, automaton.getInputAlphabet()); }
@Override public InputModelData<Integer, NFA<Integer, Integer>> readModel(InputStream is) throws IOException { final InputStream uncompressedStream = IOUtil.asUncompressedInputStream(is); SAFInput in = new SAFInput(uncompressedStream); final CompactNFA<Integer> automaton = in.readNativeNFA(); return new InputModelData<>(automaton, automaton.getInputAlphabet()); }
@Override public InputModelData<Integer, DFA<Integer, Integer>> readModel(InputStream is) throws IOException { final InputStream uncompressedStream = IOUtil.asUncompressedInputStream(is); SAFInput in = new SAFInput(uncompressedStream); final CompactDFA<Integer> automaton = in.readNativeDFA(); return new InputModelData<>(automaton, automaton.getInputAlphabet()); }