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

LearnLib / automatalib / 19995144613

06 Dec 2025 10:24PM UTC coverage: 92.834% (+0.04%) from 92.796%
19995144613

push

github

mtf90
simplify procedural implementations

since the output semantics now better handle partial systems, get rid of explicit sink management

42 of 45 new or added lines in 5 files covered. (93.33%)

4 existing lines in 4 files now uncovered.

17191 of 18518 relevant lines covered (92.83%)

1.72 hits per line

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

83.33
/api/src/main/java/net/automatalib/automaton/concept/Output.java
1
/* Copyright (C) 2013-2025 TU Dortmund University
2
 * This file is part of AutomataLib <https://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.automaton.concept;
17

18
import java.util.Collection;
19

20
import net.automatalib.exception.UndefinedPropertyAccessException;
21
import net.automatalib.word.Word;
22
import net.automatalib.word.WordBuilder;
23

24
/**
25
 * Feature for transition systems that compute an output. Here, output refers to the <i>complete</i> output that is made
26
 * when an input word is read, not a single symbol.
27
 *
28
 * @param <I>
29
 *         input symbol type
30
 * @param <D>
31
 *         output domain type
32
 */
33
@FunctionalInterface
34
public interface Output<I, D> {
35

36
    /**
37
     * Computes the output for the given sequence of input symbols.
38
     *
39
     * @param input
40
     *         the sequence of input symbols
41
     *
42
     * @return the computed output
43
     *
44
     * @throws UndefinedPropertyAccessException
45
     *         if the computation encountered undefined transitions that would have been required for computing the
46
     *         output
47
     */
48
    D computeOutput(Iterable<? extends I> input);
49

50
    /**
51
     * Convenience method for {@link #getBuilderFor(Iterable, int)} which uses {@code 0} for
52
     * {@code additionalElements}.
53
     *
54
     * @param iterable
55
     *         the sequence of input symbols
56
     * @param <T>
57
     *         symbol type
58
     *
59
     * @return a pre-sized builder (may use the default size if no information could be extracted from the iterable)
60
     */
61
    static <T> WordBuilder<T> getBuilderFor(Iterable<?> iterable) {
62
        return getBuilderFor(iterable, 0);
1✔
63
    }
64

65
    /**
66
     * Utility method for constructing a pre-sized builder (if possible) for storing responses generated when applying
67
     * the provided sequence of input symbols.
68
     *
69
     * @param iterable
70
     *         the sequence of input symbols
71
     * @param additionalElements
72
     *         number of elements that is added to the size of the iterable
73
     * @param <T>
74
     *         symbol type
75
     *
76
     * @return a pre-sized builder (may use the default size if no information could be extracted from the iterable)
77
     */
78
    static <T> WordBuilder<T> getBuilderFor(Iterable<?> iterable, int additionalElements) {
79
        if (iterable instanceof Word<?> w) {
1✔
80
            return new WordBuilder<>(w.length() + additionalElements);
1✔
81
        } else if (iterable instanceof Collection<?> c) {
1✔
82
            return new WordBuilder<>(c.size() + additionalElements);
1✔
83
        } else {
UNCOV
84
            return new WordBuilder<>();
×
85
        }
86
    }
87
}
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