Package net.maswag.falcaun.oracle
Class TimeoutEQOracle<I,O>
java.lang.Object
net.maswag.falcaun.oracle.TimeoutEQOracle<I,O>
- Type Parameters:
I- Input symbolO- Output symbol
- All Implemented Interfaces:
EquivalenceOracle<net.automatalib.automaton.transducer.MealyMachine<?,,I, ?, O>, I, net.automatalib.word.Word<O>> EquivalenceOracle.MealyEquivalenceOracle<I,O>
public class TimeoutEQOracle<I,O>
extends Object
implements EquivalenceOracle.MealyEquivalenceOracle<I,O>
An equivalence oracle to add timeout in addition to the original oracle.
The timeout is checked only when findCounterExample(net.automatalib.automaton.transducer.MealyMachine<?, I, ?, O>, java.util.Collection<? extends I>) is called: if the elapsed time since start()
exceeds the timeout, the wrapped oracle is skipped. An ongoing invocation of the wrapped oracle is not interrupted,
so this is not a strict timeout of the entire black-box checking.
- Author:
- Masaki Waga <masakiwaga@gmail.com>
-
Nested Class Summary
Nested classes/interfaces inherited from interface de.learnlib.oracle.EquivalenceOracle
EquivalenceOracle.DFAEquivalenceOracle<I>, EquivalenceOracle.MealyEquivalenceOracle<I,O>, EquivalenceOracle.MMLTEquivalenceOracle<I, O>, EquivalenceOracle.MooreEquivalenceOracle<I, O> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EquivalenceOracle.MealyEquivalenceOracle<I, O> private static final org.slf4j.Loggerprivate final LongSupplierClock supplier for reading the current time.private longprivate booleanWhether the wrapped oracle has been skipped because of the timeout since the laststart().private final long -
Constructor Summary
ConstructorsConstructorDescriptionTimeoutEQOracle(EquivalenceOracle.MealyEquivalenceOracle<I, O> eqOracle, long timeout) TimeoutEQOracle(EquivalenceOracle.MealyEquivalenceOracle<I, O> eqOracle, long timeout, LongSupplier nanoTime) -
Method Summary
Modifier and TypeMethodDescription@Nullable DefaultQuery<I, net.automatalib.word.Word<O>> findCounterExample(net.automatalib.automaton.transducer.MealyMachine<?, I, ?, O> objects, Collection<? extends I> collection) booleanvoidstart()Start ticking the clock
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
timeout
private final long timeout -
startTime
private long startTime -
timedOut
private boolean timedOutWhether the wrapped oracle has been skipped because of the timeout since the laststart(). -
eqOracle
-
nanoTime
Clock supplier for reading the current time. In production this isSystem.nanoTime(); for testing it may be a fake clock (e.g. returning synthetic nanosecond values) so that timeout behaviour can be verified without sleeping or wall-clock timing.
-
-
Constructor Details
-
TimeoutEQOracle
- Parameters:
eqOracle- the wrapped equivalence oracletimeout- timeout in seconds.
-
TimeoutEQOracle
TimeoutEQOracle(EquivalenceOracle.MealyEquivalenceOracle<I, O> eqOracle, long timeout, LongSupplier nanoTime) - Parameters:
eqOracle- the wrapped equivalence oracletimeout- timeout in seconds.nanoTime- aLongSupplierthat returns current time in nanoseconds. In production this is typicallySystem::nanoTime; for testing provide a fake clock that returns controllable values (e.g.() -> fakeClockValue) so timeout behaviour can be verified without sleeping or wall-clock timing.
-
-
Method Details
-
start
public void start()Start ticking the clock -
hasTimedOut
public boolean hasTimedOut()- Returns:
trueif and only if the wrapped oracle has been skipped because of the timeout since the laststart().
-
findCounterExample
@Nullable public @Nullable DefaultQuery<I,net.automatalib.word.Word<O>> findCounterExample(net.automatalib.automaton.transducer.MealyMachine<?, I, ?, O> objects, Collection<? extends I> collection) - Specified by:
findCounterExamplein interfaceEquivalenceOracle<net.automatalib.automaton.transducer.MealyMachine<?,I, ?, O>, I, net.automatalib.word.Word<O>>
-