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

LearnLib / learnlib / 6412002873

04 Oct 2023 10:05PM UTC coverage: 92.303% (+0.02%) from 92.282%
6412002873

push

github

mtf90
further tweak versions

* downgrade maven-javadoc-plugin version because it (for whatever reason) doesn't work on Java 11+
* update previously missed doc skin version

11573 of 12538 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
 * @author Jeroen Meijer
43
 */
44
abstract class AbstractPropertyOracle<I, A extends Output<I, D>, P, D, R extends A>
45
        implements PropertyOracle<I, A, P, D> {
46

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

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

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

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

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

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

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

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

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

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