Skip to content

Commit

Permalink
remove mutability from PropertyOracles
Browse files Browse the repository at this point in the history
  • Loading branch information
mtf90 committed Jul 5, 2024
1 parent 97cc60e commit fd769e5
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 33 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

* The `de.learnlib.tooling:learnlib-annotation-processor` artifact has been dropped. The functionality has been moved to a [standalone project](https://github.com/LearnLib/build-tools).
* The `de.learnlib:learnlib-rpni-edsm` and `de.learnlib:learnlib-rpni-mdl` artifacts have been dropped. The code has been merged with the `de.learnlib:learnlib-rpni` artifact.
* `PropertyOracle`s can no longer set a property. This value is now immutable and must be provided during instantiation. Previously, the internal state wasn't updated accordingly if a property was overridden.


## [0.17.0] - 2023-11-15
Expand Down
8 changes: 0 additions & 8 deletions api/src/main/java/de/learnlib/oracle/PropertyOracle.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,6 @@ default boolean isDisproved() {
return getCounterExample() != null;
}

/**
* Set the property.
*
* @param property
* the property to set
*/
void setProperty(P property);

/**
* Returns the property.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ abstract class AbstractPropertyOracle<I, A extends Output<I, D>, P, D, R extends

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

protected AbstractPropertyOracle(P property,
Expand All @@ -60,11 +60,6 @@ protected AbstractPropertyOracle(P property,
return counterExample;
}

@Override
public void setProperty(P property) {
this.property = property;
}

@Override
public P getProperty() {
return property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ public boolean isDisproved() {
return propertyOracle.isDisproved();
}

@Override
public void setProperty(P property) {
this.propertyOracle.setProperty(property);
}

@Override
public P getProperty() {
return propertyOracle.getProperty();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public MealyFinitePropertyOracle(P property,

@Override
protected MealyMachine<?, I, ?, O> modelCheck(MealyMachine<?, I, ?, O> hypothesis, Collection<? extends I> inputs) {

return modelChecker.findCounterExample(hypothesis, inputs, getProperty());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
generics = {@Generic("I"), @Generic("O"), @Generic("P")}))
public class PropertyOracleChain<I, A extends Output<I, D>, @Nullable P, D> implements PropertyOracle<I, A, P, D> {

private P property;
private final P property;

private @Nullable DefaultQuery<I, D> counterExample;

Expand All @@ -97,12 +97,6 @@ public PropertyOracleChain(Collection<? extends PropertyOracle<I, ? super A, P,
}
}

public void addOracle(PropertyOracle<I, ? super A, P, D> oracle) {
assert oracle.getProperty() == null || oracle.getProperty().equals(property);
oracle.setProperty(property);
oracles.add(oracle);
}

@Override
public @Nullable DefaultQuery<I, D> doFindCounterExample(A hypothesis, Collection<? extends I> inputs) {
for (PropertyOracle<I, ? super A, P, D> oracle : oracles) {
Expand All @@ -128,12 +122,6 @@ public void addOracle(PropertyOracle<I, ? super A, P, D> oracle) {
return null;
}

@Override
public void setProperty(P property) {
oracles.forEach(o -> o.setProperty(property));
this.property = property;
}

@Override
public P getProperty() {
return property;
Expand Down

0 comments on commit fd769e5

Please sign in to comment.