• 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

86.67
/oracles/property-oracles/src/main/java/de/learnlib/oracle/property/AbstractPropertyOracle.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.oracle.property;
17

18
import java.util.Collection;
19

20
import de.learnlib.api.oracle.EmptinessOracle;
21
import de.learnlib.api.oracle.InclusionOracle;
22
import de.learnlib.api.oracle.PropertyOracle;
23
import de.learnlib.api.query.DefaultQuery;
24
import net.automatalib.automata.concepts.Output;
25
import org.checkerframework.checker.nullness.qual.Nullable;
26

27
/**
28
 * A {@link PropertyOracle} that uses {@link InclusionOracle}s and {@link EmptinessOracle}s to find counter examples and
29
 * disprove properties.
30
 *
31
 * @param <I>
32
 *         the input type
33
 * @param <A>
34
 *         the automaton type
35
 * @param <P>
36
 *         the property type
37
 * @param <D>
38
 *         the output type
39
 * @param <R>
40
 *         the result type of model checker
41
 */
42
abstract class AbstractPropertyOracle<I, A extends Output<I, D>, P, D, R extends A>
43
        implements PropertyOracle<I, A, P, D> {
44

45
    private final InclusionOracle<A, I, D> inclusionOracle;
46
    private final EmptinessOracle<R, I, D> emptinessOracle;
47
    private P property;
48
    private @Nullable DefaultQuery<I, D> counterExample;
49

50
    protected AbstractPropertyOracle(P property,
51
                                     InclusionOracle<A, I, D> inclusionOracle,
52
                                     EmptinessOracle<R, I, D> emptinessOracle) {
2✔
53
        this.property = property;
2✔
54
        this.inclusionOracle = inclusionOracle;
2✔
55
        this.emptinessOracle = emptinessOracle;
2✔
56
    }
2✔
57

58
    protected @Nullable DefaultQuery<I, D> setCounterExample(@Nullable DefaultQuery<I, D> counterExample) {
59
        this.counterExample = counterExample;
2✔
60
        return counterExample;
2✔
61
    }
62

63
    @Override
64
    public void setProperty(P property) {
65
        this.property = property;
×
66
    }
×
67

68
    @Override
69
    public P getProperty() {
70
        return property;
2✔
71
    }
72

73
    @Override
74
    public @Nullable DefaultQuery<I, D> getCounterExample() {
75
        return counterExample;
2✔
76
    }
77

78
    protected abstract R modelCheck(A hypothesis, Collection<? extends I> inputs);
79

80
    @Override
81
    public @Nullable DefaultQuery<I, D> doFindCounterExample(A hypothesis, Collection<? extends I> inputs) {
82
        final A result = modelCheck(hypothesis, inputs);
2✔
83
        return result != null ? inclusionOracle.findCounterExample(result, inputs) : null;
2✔
84
    }
85

86
    @Override
87
    public @Nullable DefaultQuery<I, D> disprove(A hypothesis, Collection<? extends I> inputs) {
88
        final R ce = modelCheck(hypothesis, inputs);
2✔
89

90
        return ce != null ? setCounterExample(emptinessOracle.findCounterExample(ce, inputs)) : null;
2✔
91
    }
92
}
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