All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.learnlib.oracle.emptiness.LassoEmptinessOracleImpl Maven / Gradle / Ivy

There is a newer version: 0.17.0
Show newest version
/* Copyright (C) 2013-2019 TU Dortmund
 * This file is part of LearnLib, http://www.learnlib.de/.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.learnlib.oracle.emptiness;

import java.util.Collection;

import javax.annotation.Nullable;

import de.learnlib.api.oracle.LassoEmptinessOracle;
import de.learnlib.api.oracle.LassoOracle;
import de.learnlib.api.oracle.OmegaMembershipOracle;
import de.learnlib.api.query.DefaultQuery;
import de.learnlib.api.query.OmegaQuery;
import net.automatalib.automata.concepts.Output;
import net.automatalib.modelchecking.Lasso;
import net.automatalib.words.Word;

public class LassoEmptinessOracleImpl, S, I, D>
        implements LassoEmptinessOracle, LassoOracle {

    /**
     * The {@link OmegaMembershipOracle} used to answer {@link OmegaQuery}s.
     */
    private final OmegaMembershipOracle omegaMembershipOracle;

    public LassoEmptinessOracleImpl(OmegaMembershipOracle omegaMembershipOracle) {
        this.omegaMembershipOracle = omegaMembershipOracle;
    }

    public OmegaMembershipOracle getOmegaMembershipOracle() {
        return omegaMembershipOracle;
    }

    @Override
    public OmegaQuery processInput(Word prefix, Word loop, int repeat) {
        final OmegaQuery query = new OmegaQuery<>(prefix, loop, repeat);
        omegaMembershipOracle.processQuery(query);

        return query;
    }

    @Override
    public boolean isCounterExample(Output hypothesis, Iterable input, @Nullable D output) {
        return LassoEmptinessOracle.super.isCounterExample(hypothesis, input, output);
    }

    @Nullable
    @Override
    public DefaultQuery findCounterExample(L hypothesis, Collection inputs) {
        return LassoOracle.super.findCounterExample(hypothesis, inputs);
    }

    @Override
    public boolean isOmegaCounterExample(boolean isUltimatelyPeriodic) {
        return LassoEmptinessOracle.super.isOmegaCounterExample(isUltimatelyPeriodic);
    }
}