Class IncrementalMealyDAGBuilder<I,O>
- java.lang.Object
-
- net.automatalib.incremental.mealy.dag.IncrementalMealyDAGBuilder<I,O>
-
- Type Parameters:
I
- input symbol classO
- output symbol class
- All Implemented Interfaces:
SupportsGrowingAlphabet<I>
,InputAlphabetHolder<I>
,IncrementalConstruction<MealyMachine<?,I,?,O>,I>
,IncrementalMealyBuilder<I,O>
,MealyBuilder<I,O>
public class IncrementalMealyDAGBuilder<I,O> extends Object implements IncrementalMealyBuilder<I,O>, InputAlphabetHolder<I>
Incrementally builds an (acyclic) Mealy machine, from a set of input and corresponding output words.
-
-
Constructor Summary
Constructors Constructor Description IncrementalMealyDAGBuilder(Alphabet<I> inputAlphabet)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAlphabetSymbol(I symbol)
Notifies the data structure that a new symbol should be added to the alphabet.Graph<?,?>
asGraph()
Retrieves a graph view of the current state of the construction.MealyTransitionSystem<?,I,?,O>
asTransitionSystem()
Retrieves a transition system view of the current state of the construction.@Nullable Word<I>
findSeparatingWord(MealyMachine<?,I,?,O> target, Collection<? extends I> inputs, boolean omitUndefined)
Checks the current state of the construction against a given target model, and returns a word exposing a difference if there is one.Alphabet<I>
getInputAlphabet()
boolean
hasDefinitiveInformation(Word<? extends I> word)
Checks whether this class has definitive information about a given word.void
insert(Word<? extends I> word, Word<? extends O> outputWord)
Incorporates a pair of input/output words into the stored information.boolean
lookup(Word<? extends I> word, List<? super O> output)
Retrieves the output word for the given input word.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.automatalib.incremental.mealy.MealyBuilder
lookup
-
-
-
-
Method Detail
-
addAlphabetSymbol
public void addAlphabetSymbol(I symbol)
Description copied from interface:SupportsGrowingAlphabet
Notifies the data structure that a new symbol should be added to the alphabet. Behavior depends on the implementation:- After adding a new symbol, the symbol-related data may either be initialized with default values or undefined.
- Duplicate symbols may: (1) be handled accordingly, (2) be ignored or (3) result in an error.
GrowingAlphabet
) to handle potentially shared state across multiple instances. If the needed requirements are not met, aGrowingAlphabetNotSupportedException
can be thrown.- Specified by:
addAlphabetSymbol
in interfaceSupportsGrowingAlphabet<I>
- Parameters:
symbol
- the symbol to add to the alphabet.
-
hasDefinitiveInformation
public boolean hasDefinitiveInformation(Word<? extends I> word)
Description copied from interface:IncrementalConstruction
Checks whether this class has definitive information about a given word.- Specified by:
hasDefinitiveInformation
in interfaceIncrementalConstruction<I,O>
- Specified by:
hasDefinitiveInformation
in interfaceMealyBuilder<I,O>
- Parameters:
word
- the word- Returns:
true
if this class has definitive information about the word,false
otherwise.
-
lookup
public boolean lookup(Word<? extends I> word, List<? super O> output)
Description copied from interface:MealyBuilder
Retrieves the output word for the given input word. If no definitive information for the input word exists, the output for the longest known prefix will be returned.- Specified by:
lookup
in interfaceMealyBuilder<I,O>
- Parameters:
word
- the input wordoutput
- a consumer for constructing the output word- Returns:
true
if the information contained was complete (in this case,word.length() == output.size()
will hold),false
otherwise.
-
insert
public void insert(Word<? extends I> word, Word<? extends O> outputWord)
Description copied from interface:IncrementalMealyBuilder
Incorporates a pair of input/output words into the stored information.- Specified by:
insert
in interfaceIncrementalMealyBuilder<I,O>
- Parameters:
word
- the input wordoutputWord
- the corresponding output word
-
findSeparatingWord
public @Nullable Word<I> findSeparatingWord(MealyMachine<?,I,?,O> target, Collection<? extends I> inputs, boolean omitUndefined)
Description copied from interface:IncrementalConstruction
Checks the current state of the construction against a given target model, and returns a word exposing a difference if there is one.- Specified by:
findSeparatingWord
in interfaceIncrementalConstruction<I,O>
- Parameters:
target
- the target automaton modelinputs
- the set of input symbols to consideromitUndefined
- if this is set totrue
, then undefined transitions in thetarget
model will be interpreted as "unspecified/don't know" and omitted in the equivalence test. Otherwise, they will be interpreted in the usual manner (e.g., non-accepting sink in case of DFAs).- Returns:
- a separating word, or
null
if no difference could be found.
-
getInputAlphabet
public Alphabet<I> getInputAlphabet()
- Specified by:
getInputAlphabet
in interfaceInputAlphabetHolder<I>
-
asTransitionSystem
public MealyTransitionSystem<?,I,?,O> asTransitionSystem()
Description copied from interface:IncrementalConstruction
Retrieves a transition system view of the current state of the construction. The transition system model should be backed by the construction, i.e., subsequent changes will be reflected in the transition system.- Specified by:
asTransitionSystem
in interfaceIncrementalConstruction<I,O>
- Specified by:
asTransitionSystem
in interfaceMealyBuilder<I,O>
- Returns:
- a transition system view on the current state of the construction
-
asGraph
public Graph<?,?> asGraph()
Description copied from interface:IncrementalConstruction
Retrieves a graph view of the current state of the construction. The graph model should be backed by the construction, i.e., subsequent changes will be reflected in the graph model.- Specified by:
asGraph
in interfaceIncrementalConstruction<I,O>
- Returns:
- a graph view on the current state of the construction
-
-