S
- system state classI
- input symbol classO
- output symbol classpublic final class ReuseTree<S,I,O> extends Object implements net.automatalib.graphs.Graph<ReuseNode<S,I,O>,ReuseEdge<S,I,O>>
ReuseTree
is a tree like structure consisting of nodes (see ReuseNode
) and edges (see ReuseEdge
) that is used by the ReuseOracle
: ReuseNode.fetchSystemState(boolean)
) that could be used for executing suffixes of membership queries. Each node
consists of a (possible empty) set of outgoing edges. ReuseTree
is the central data structure that maintains observed behavior from the
SUL and maintains also available system states. The ReuseTree
is only 'tree like' since it may contain
reflexive edges at nodes (only possible if ReuseTree.ReuseTreeBuilder.withFailureOutputs(Set)
or ReuseTree.ReuseTreeBuilder.withInvariantInputs(Set)
is set).Modifier and Type | Class and Description |
---|---|
static class |
ReuseTree.ReuseTreeBuilder<S,I,O> |
Modifier and Type | Method and Description |
---|---|
void |
clearTree()
Clears the whole tree which means the root will be reinitialized by a new
ReuseNode and all existing
system states will be disposed. |
void |
disposeSystemstates()
This method removes all system states from the tree.
|
ReuseNode.NodeResult<S,I,O> |
fetchSystemState(net.automatalib.words.Word<I> query)
Returns a reuseable
ReuseNode.NodeResult with system state or null if none such exists. |
Collection<ReuseNode<S,I,O>> |
getNodes() |
Collection<ReuseEdge<S,I,O>> |
getOutgoingEdges(ReuseNode<S,I,O> node) |
net.automatalib.words.Word<O> |
getOutput(net.automatalib.words.Word<I> query)
Returns the known output for the given query or
null if not known. |
net.automatalib.words.Word<O> |
getPartialOutput(net.automatalib.words.Word<I> query)
Returns the known output for "reflexive" edges in the tree for the given query.
|
ReuseNode<S,I,O> |
getRoot()
|
ReuseNode<S,I,O> |
getTarget(ReuseEdge<S,I,O> edge) |
net.automatalib.visualization.VisualizationHelper<ReuseNode<S,I,O>,ReuseEdge<S,I,O>> |
getVisualizationHelper() |
void |
insert(net.automatalib.words.Word<I> query,
ReuseCapableOracle.QueryResult<S,O> queryResult)
Inserts the given
Word with ReuseCapableOracle.QueryResult into the tree starting from the root
node of the tree. |
void |
insert(net.automatalib.words.Word<I> query,
ReuseNode<S,I,O> sink,
ReuseCapableOracle.QueryResult<S,O> queryResult)
Inserts the given
Word (suffix of a membership query) with ReuseCapableOracle.QueryResult (suffix
output) into the tree starting from the ReuseNode (contains prefix with prefix output) in the tree. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
adjacentTargetsIterator, adjacentTargetsStream, getAdjacentTargets, getEdgesBetween, outgoingEdges, outgoingEdgesIterator, outgoingEdgesStream
iterator, nodeIDs, nodesStream, size
adjacentTargets, createDynamicNodeMapping, createStaticNodeMapping, isConnected
forEach, spliterator
public net.automatalib.words.Word<O> getOutput(net.automatalib.words.Word<I> query)
null
if not known.query
- Not allowed to be null
.query
if already known from the ReuseTree
or null
if unknown.public net.automatalib.words.Word<O> getPartialOutput(net.automatalib.words.Word<I> query)
null
.query
- Not allowed to be null
.query
from the ReuseTree
with outputs for "reflexive" edges filled
with null
for "non-reflexive" and not-known parts of the input word.public void disposeSystemstates()
The SystemStateHandler
will be informed about all disposings.
public void clearTree()
ReuseNode
and all existing
system states will be disposed. All invariant input symbols as well as all failure output symbols will remain.
The SystemStateHandler
will not be informed about any disposings.
public ReuseNode.NodeResult<S,I,O> fetchSystemState(net.automatalib.words.Word<I> query)
ReuseNode.NodeResult
with system state or null
if none such exists. If
''oldInvalidated'' was set to true
(in the ReuseOracle
) the system state is already removed from
the tree whenever one was available.query
- Not allowed to be null
.public void insert(net.automatalib.words.Word<I> query, ReuseCapableOracle.QueryResult<S,O> queryResult)
Word
with ReuseCapableOracle.QueryResult
into the tree starting from the root
node of the tree. For the longest known prefix of the given Word
there will be no new nodes or edges
created.
Will be called from the ReuseOracle
if no system state was available for reusage for the query (otherwise
insert(Word, ReuseNode, ReuseCapableOracle.QueryResult)
would be called). The last node reached by the
last symbol of the query will hold the system state from the given ReuseCapableOracle.QueryResult
.
This method should only be invoked internally from the ReuseOracle
unless you know exactly what you are
doing (you may want to create a predefined reuse tree before start learning).
ReuseException
- if non deterministic behavior is detectedpublic void insert(net.automatalib.words.Word<I> query, ReuseNode<S,I,O> sink, ReuseCapableOracle.QueryResult<S,O> queryResult)
Word
(suffix of a membership query) with ReuseCapableOracle.QueryResult
(suffix
output) into the tree starting from the ReuseNode
(contains prefix with prefix output) in the tree. For
the longest known prefix of the suffix from the given Word
there will be no new nodes or edges created.
Will be called from the ReuseOracle
if an available system state was reused for the query (otherwise
insert(Word, ReuseCapableOracle.QueryResult)
would be called). The old system state was already removed
from the ReuseNode
(through fetchSystemState(Word)
) if the ''invalidateSystemstates'' flag in
the ReuseOracle
was set to true
.
This method should only be invoked internally from the ReuseOracle
unless you know exactly what you are
doing (you may want to create a predefined reuse tree before start learning).
ReuseException
- if non deterministic behavior is detectedpublic Collection<ReuseNode<S,I,O>> getNodes()
Copyright © 2018. All rights reserved.