- java.lang.Object
-
- de.learnlib.filter.reuse.ReuseOracle<S,I,O>
-
- Type Parameters:
S
- system state typeI
- input symbol typeO
- output symbol type
- All Implemented Interfaces:
BatchProcessor<Query<I,net.automatalib.word.Word<O>>>
,MembershipOracle<I,net.automatalib.word.Word<O>>
,MembershipOracle.MealyMembershipOracle<I,O>
,QueryAnswerer<I,net.automatalib.word.Word<O>>
,SingleQueryOracle<I,net.automatalib.word.Word<O>>
,SingleQueryOracle.SingleQueryOracleMealy<I,O>
public final class ReuseOracle<S,I,O> extends Object implements SingleQueryOracle.SingleQueryOracleMealy<I,O>
The reuse oracle is aMembershipOracle.MealyMembershipOracle
that is able to- Cache queries: Each processed query will
not be delegated again (instead the answer will be retrieved from the
ReuseTree
) - Pump queries: If
the
ReuseTree
is configured to know which symbols are model invariant input symbols viaReuseOracleBuilder.withInvariantInputs(Set)
(like a read from a database which does not change the SUL) or configured for failure output symbols viaReuseOracleBuilder.withFailureOutputs(Set)
(e.g. a roll back mechanism exists for the invoked symbol) the oracle could ''pump'' those symbols inside a query once seen. - Reuse system states: There are a lot of situations where a prefix of a query is already known and a system state
is available. In this situation the oracle is able to reuse the available system state and only process the remaining
suffix. Whether a system state will be removed after it is used is decided upon construction (see
ReuseOracleBuilder(Alphabet, Supplier)
.
ReuseTree
.The usage of model invariant input symbols and failure output symbols is disabled by default and can be enabled upon construction (see
ReuseOracleBuilder.withFailureOutputs(Set)
andReuseOracleBuilder.withInvariantInputs(Set)
).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface de.learnlib.oracle.MembershipOracle
MembershipOracle.DFAMembershipOracle<I>, MembershipOracle.MealyMembershipOracle<I,O>, MembershipOracle.MooreMembershipOracle<I,O>
-
Nested classes/interfaces inherited from interface de.learnlib.oracle.SingleQueryOracle
SingleQueryOracle.SingleQueryOracleDFA<I>, SingleQueryOracle.SingleQueryOracleMealy<I,O>, SingleQueryOracle.SingleQueryOracleMoore<I,O>
-
-
Constructor Summary
Constructors Constructor Description ReuseOracle(net.automatalib.alphabet.Alphabet<I> alphabet, Supplier<? extends ReuseCapableOracle<S,I,O>> oracleSupplier, boolean enabledSystemStateInvalidation, SystemStateHandler<S> systemStateHandler, Set<I> invariantInputs, Set<O> failureOutputs, int maxSystemStates, BoundedDeque.AccessPolicy accessPolicy, BoundedDeque.EvictPolicy evictPolicy)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description net.automatalib.word.Word<O>
answerQuery(net.automatalib.word.Word<I> input)
net.automatalib.word.Word<O>
answerQuery(net.automatalib.word.Word<I> prefix, net.automatalib.word.Word<I> suffix)
ReuseCapableOracle<S,I,O>
getReuseCapableOracle()
Returns theReuseCapableOracle
used by this instance.ReuseTree<S,I,O>
getReuseTree()
Returns theReuseTree
used by this instance.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.learnlib.oracle.MembershipOracle
asOracle, processBatch
-
Methods inherited from interface de.learnlib.oracle.SingleQueryOracle
processQueries, processQuery
-
-
-
-
Constructor Detail
-
ReuseOracle
public ReuseOracle(net.automatalib.alphabet.Alphabet<I> alphabet, Supplier<? extends ReuseCapableOracle<S,I,O>> oracleSupplier, boolean enabledSystemStateInvalidation, SystemStateHandler<S> systemStateHandler, Set<I> invariantInputs, Set<O> failureOutputs, int maxSystemStates, BoundedDeque.AccessPolicy accessPolicy, BoundedDeque.EvictPolicy evictPolicy)
Default constructor.- Parameters:
alphabet
- the input alphabet of the systemoracleSupplier
- a supplier for reusable oraclesenabledSystemStateInvalidation
- a flag whether system states should be invalidated after retrievalsystemStateHandler
- the handler for notification about system state removalsinvariantInputs
- the set of symbols that behave invariantfailureOutputs
- the set of symbols of failed system outputsmaxSystemStates
- the maximum number of stored system statesaccessPolicy
- the strategy for accessing elementsevictPolicy
- the strategy for evicting elements of the capacity is reached
-
-
Method Detail
-
answerQuery
public net.automatalib.word.Word<O> answerQuery(net.automatalib.word.Word<I> prefix, net.automatalib.word.Word<I> suffix)
- Specified by:
answerQuery
in interfaceMembershipOracle<S,I>
- Specified by:
answerQuery
in interfaceQueryAnswerer<S,I>
- Specified by:
answerQuery
in interfaceSingleQueryOracle<S,I>
-
answerQuery
public net.automatalib.word.Word<O> answerQuery(net.automatalib.word.Word<I> input)
- Specified by:
answerQuery
in interfaceMembershipOracle<S,I>
- Specified by:
answerQuery
in interfaceQueryAnswerer<S,I>
-
getReuseCapableOracle
public ReuseCapableOracle<S,I,O> getReuseCapableOracle()
Returns theReuseCapableOracle
used by this instance.- Returns:
- the oracle used by this instance
-
-