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

LearnLib / learnlib / 6433387082

06 Oct 2023 03:10PM UTC coverage: 92.296% (-0.007%) from 92.303%
6433387082

push

github

mtf90
update Falk's developer id

11573 of 12539 relevant lines covered (92.3%)

1.67 hits per line

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

25.0
/api/src/main/java/de/learnlib/api/oracle/OmegaMembershipOracle.java
1
/* Copyright (C) 2013-2023 TU Dortmund
2
 * This file is part of LearnLib, http://www.learnlib.de/.
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 de.learnlib.api.oracle;
17

18
import java.util.Collection;
19
import java.util.Collections;
20

21
import de.learnlib.api.ObservableSUL;
22
import de.learnlib.api.oracle.MembershipOracle.DFAMembershipOracle;
23
import de.learnlib.api.oracle.MembershipOracle.MealyMembershipOracle;
24
import de.learnlib.api.oracle.parallelism.BatchProcessor;
25
import de.learnlib.api.query.OmegaQuery;
26
import net.automatalib.commons.util.Pair;
27
import net.automatalib.words.Word;
28
import org.checkerframework.checker.nullness.qual.Nullable;
29

30
/**
31
 * Answers {@link OmegaQuery}s, similar to a {@link MembershipOracle}. Additionally, one can ask whether two states
32
 * are equal to each other.
33
 *
34
 * @param <S> the state type
35
 * @param <I> the input type
36
 * @param <D> the output type
37
 */
38
public interface OmegaMembershipOracle<S, I, D> extends OmegaQueryAnswerer<S, I, D>, BatchProcessor<OmegaQuery<I, D>> {
39

40
    @Override
41
    default Pair<@Nullable D, Integer> answerQuery(Word<I> prefix, Word<I> loop, int repeat) {
42
        final OmegaQuery<I, D> query = new OmegaQuery<>(prefix, loop, repeat);
×
43
        processQuery(query);
×
44
        return Pair.of(query.getOutput(), query.getPeriodicity());
×
45
    }
46

47
    @Override
48
    default void processBatch(Collection<? extends OmegaQuery<I, D>> batch) {
49
        this.processQueries(batch);
1✔
50
    }
1✔
51

52
    default void processQuery(OmegaQuery<I, D> query) {
53
        processQueries(Collections.singleton(query));
×
54
    }
×
55

56
    void processQueries(Collection<? extends OmegaQuery<I, D>> queries);
57

58
    @Override
59
    default OmegaMembershipOracle<S, I, D> asOracle() {
60
        return this;
×
61
    }
62

63
    /**
64
     * Returns a regular membership oracle.
65
     *
66
     * @return a regular membership oracle.
67
     */
68
    MembershipOracle<I, D> getMembershipOracle();
69

70
    /**
71
     * Returns whether two states are equal, or if both access sequences {@code w1}, and {@code w2} end up in the
72
     * same state. If both access sequences end up in the same state then {@code s1.equals(s2)} must hold.
73
     *
74
     * @see ObservableSUL#getState()
75
     *
76
     * @param w1 the first access sequence.
77
     * @param s1 the first state.
78
     * @param w2 the second access sequence.
79
     * @param s2 the second state.
80
     *
81
     * @return whether both states, or states via the given access sequences are equal.
82
     */
83
    boolean isSameState(Word<I> w1, S s1, Word<I> w2, S s2);
84

85
    interface DFAOmegaMembershipOracle<S, I> extends OmegaMembershipOracle<S, I, Boolean> {
86

87
        @Override
88
        DFAMembershipOracle<I> getMembershipOracle();
89
    }
90

91
    interface MealyOmegaMembershipOracle<S, I, O> extends OmegaMembershipOracle<S, I, Word<O>> {
92

93
        @Override
94
        MealyMembershipOracle<I, O> getMembershipOracle();
95
    }
96
}
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