|
20 | 20 | import java.util.Objects; |
21 | 21 | import java.util.stream.Stream; |
22 | 22 |
|
| 23 | +import de.learnlib.TestWordGenerator; |
23 | 24 | import de.learnlib.logging.Category; |
24 | 25 | import de.learnlib.oracle.EquivalenceOracle; |
25 | 26 | import de.learnlib.oracle.MembershipOracle; |
|
33 | 34 |
|
34 | 35 | /** |
35 | 36 | * An abstract equivalence oracle that takes care of query batching and hypothesis checking and allows extending classes |
36 | | - * to solely focus on test word generation by implementing {@link #generateTestWords(Output, Collection)}. |
| 37 | + * to solely focus on test word generation by implementing {@link #generateTestWords(Object, Collection)}}. |
37 | 38 | * <p> |
38 | 39 | * Being {@link Stream stream}-based, this oracle encourages the lazy computation of counterexamples, so that all |
39 | 40 | * counterexamples do not have to be computed upfront, but only until the first valid counterexample is found. |
|
45 | 46 | * @param <D> |
46 | 47 | * output (domain) type |
47 | 48 | */ |
48 | | -public abstract class AbstractTestWordEQOracle<A extends Output<I, D>, I, D> implements EquivalenceOracle<A, I, D> { |
| 49 | +public abstract class AbstractTestWordEQOracle<A extends Output<I, D>, I, D> |
| 50 | + implements EquivalenceOracle<A, I, D>, TestWordGenerator<A, I> { |
49 | 51 |
|
50 | 52 | private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTestWordEQOracle.class); |
51 | 53 |
|
@@ -82,20 +84,6 @@ public AbstractTestWordEQOracle(MembershipOracle<I, D> membershipOracle, int bat |
82 | 84 | return ceStream.findFirst().orElse(null); |
83 | 85 | } |
84 | 86 |
|
85 | | - /** |
86 | | - * Generate the stream of test words that should be used for the current equivalence check cycle. |
87 | | - * |
88 | | - * @param hypothesis |
89 | | - * the current hypothesis of the learning algorithm |
90 | | - * @param inputs |
91 | | - * the collection of inputs to consider |
92 | | - * |
93 | | - * @return the stream of test words used for equivalence testing |
94 | | - * |
95 | | - * @see EquivalenceOracle#findCounterExample(Object, Collection) |
96 | | - */ |
97 | | - protected abstract Stream<Word<I>> generateTestWords(A hypothesis, Collection<? extends I> inputs); |
98 | | - |
99 | 87 | private Stream<DefaultQuery<I, D>> answerQueries(Stream<DefaultQuery<I, D>> stream) { |
100 | 88 | if (isBatched()) { |
101 | 89 | return IteratorUtil.stream(IteratorUtil.batch(stream.iterator(), this.batchSize)) |
|
0 commit comments