Module net.automatalib.core
Package net.automatalib.automaton.base
Class AbstractFastMutable<S extends AbstractFastState<?>,I,T,SP,TP>
- java.lang.Object
-
- net.automatalib.automaton.base.AbstractFastMutable<S,I,T,SP,TP>
-
- All Implemented Interfaces:
Iterable<S>
,SupportsGrowingAlphabet<I>
,Automaton<S,I,T>
,FiniteRepresentation
,InputAlphabetHolder<I>
,StateIDs<S>
,StateLocalInput<S,I>
,FiniteAlphabetAutomaton<S,I,T>
,MutableAutomaton<S,I,T,SP,TP>
,ShrinkableAutomaton<S,I,T,SP,TP>
,SimpleAutomaton<S,I>
,UniversalAutomaton<S,I,T,SP,TP>
,UniversalFiniteAlphabetAutomaton<S,I,T,SP,TP>
,GraphViewable
,SimpleTS<S,I>
,TransitionSystem<S,I,T>
,UniversalTransitionSystem<S,I,T,SP,TP>
- Direct Known Subclasses:
AbstractFastMutableDet
,AbstractFastMutableNondet
public abstract class AbstractFastMutable<S extends AbstractFastState<?>,I,T,SP,TP> extends Object implements ShrinkableAutomaton<S,I,T,SP,TP>, UniversalFiniteAlphabetAutomaton<S,I,T,SP,TP>, StateIDs<S>, SupportsGrowingAlphabet<I>, StateLocalInput<S,I>
Shared functionality for (non-) deterministic mutable automata.
-
-
Field Summary
Fields Modifier and Type Field Description protected Alphabet<I>
inputAlphabet
-
Constructor Summary
Constructors Constructor Description AbstractFastMutable(Alphabet<I> inputAlphabet)
-
Method Summary
All Methods Instance Methods Abstract 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.S
addState(@Nullable SP property)
Adds a new state with the given property to the automaton.void
clear()
Removes all states and transitions.<V> MutableMapping<S,V>
createDynamicStateMapping()
Creates aMutableMapping
allowing to associate arbitrary data with this transition system's states.protected abstract S
createState(@Nullable SP property)
Alphabet<I>
getInputAlphabet()
S
getState(int id)
Return for a given id the state of the automaton identified by it.int
getStateId(S state)
Returns for a given state of the automaton an integer uniquely identifying the state.Collection<S>
getStates()
Retrieves all states of the transition system.void
removeAllTransitions(S state)
void
removeState(S state, @Nullable S replacement)
Removes a state from the automaton.StateIDs<S>
stateIDs()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.automatalib.automaton.FiniteAlphabetAutomaton
getTransitions, graphView
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface net.automatalib.automaton.MutableAutomaton
addInitialState, addInitialState, addState, addTransition, addTransition, addTransitions, copyTransition, createTransition, removeAllTransitions, removeTransition, setInitial, setStateProperty, setTransitionProperty, setTransitions
-
Methods inherited from interface net.automatalib.automaton.ShrinkableAutomaton
removeState
-
Methods inherited from interface net.automatalib.automaton.simple.SimpleAutomaton
createStaticStateMapping, iterator, size
-
Methods inherited from interface net.automatalib.ts.simple.SimpleTS
getInitialStates, getStates, getSuccessors
-
Methods inherited from interface net.automatalib.automaton.concept.StateLocalInput
getLocalInputs
-
Methods inherited from interface net.automatalib.ts.TransitionSystem
getSuccessor, getSuccessors, getTransitions, powersetView
-
Methods inherited from interface net.automatalib.automaton.UniversalAutomaton
transitionGraphView
-
Methods inherited from interface net.automatalib.automaton.UniversalFiniteAlphabetAutomaton
transitionGraphView
-
Methods inherited from interface net.automatalib.ts.UniversalTransitionSystem
getStateProperty, getTransitionProperty
-
-
-
-
Method Detail
-
getStateId
public int getStateId(S state)
Description copied from interface:StateIDs
Returns for a given state of the automaton an integer uniquely identifying the state. The returned ids should be within the range of the number of states of the automaton so that they can be used for array-based indexing.- Specified by:
getStateId
in interfaceStateIDs<S extends AbstractFastState<?>>
- Parameters:
state
- the state whose id should be retrieved- Returns:
- the (positive) id of the given automaton state
-
getState
public S getState(int id)
Description copied from interface:StateIDs
Return for a given id the state of the automaton identified by it.- Specified by:
getState
in interfaceStateIDs<S extends AbstractFastState<?>>
- Parameters:
id
- the id of the state to be returned- Returns:
- the automaton state identified by the given
id
.
-
addState
public S addState(@Nullable SP property)
Description copied from interface:MutableAutomaton
Adds a new state with the given property to the automaton.- Specified by:
addState
in interfaceMutableAutomaton<S extends AbstractFastState<?>,I,T,SP,TP>
- Parameters:
property
- the property of the new state- Returns:
- the newly created state
-
removeAllTransitions
public void removeAllTransitions(S state)
- Specified by:
removeAllTransitions
in interfaceMutableAutomaton<S extends AbstractFastState<?>,I,T,SP,TP>
-
removeState
public void removeState(S state, @Nullable S replacement)
Description copied from interface:ShrinkableAutomaton
Removes a state from the automaton. All ingoing transitions to this state are redirected to the given replacement state. If anull
replacement is given, then this method behaves like the aboveShrinkableAutomaton.removeState(Object)
.- Specified by:
removeState
in interfaceShrinkableAutomaton<S extends AbstractFastState<?>,I,T,SP,TP>
- Parameters:
state
- the state to removereplacement
- the replacement state, ornull
-
clear
public void clear()
Description copied from interface:MutableAutomaton
Removes all states and transitions.- Specified by:
clear
in interfaceMutableAutomaton<S extends AbstractFastState<?>,I,T,SP,TP>
-
getInputAlphabet
public Alphabet<I> getInputAlphabet()
- Specified by:
getInputAlphabet
in interfaceInputAlphabetHolder<S extends AbstractFastState<?>>
-
createDynamicStateMapping
public <V> MutableMapping<S,V> createDynamicStateMapping()
Description copied from interface:SimpleTS
Creates aMutableMapping
allowing to associate arbitrary data with this transition system's states. The returned mapping maintains the association even when the transition system is modified.- Specified by:
createDynamicStateMapping
in interfaceSimpleAutomaton<S extends AbstractFastState<?>,I>
- Specified by:
createDynamicStateMapping
in interfaceSimpleTS<S extends AbstractFastState<?>,I>
- Type Parameters:
V
- the value type of the mapping- Returns:
- the mutable mapping
-
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<S extends AbstractFastState<?>>
- Parameters:
symbol
- the symbol to add to the alphabet.
-
getStates
public Collection<S> getStates()
Description copied from interface:SimpleAutomaton
Retrieves all states of the transition system. Implementing classes should return an unmodifiable collection- Specified by:
getStates
in interfaceSimpleAutomaton<S extends AbstractFastState<?>,I>
- Returns:
- all states in the transition system
-
stateIDs
public StateIDs<S> stateIDs()
- Specified by:
stateIDs
in interfaceSimpleAutomaton<S extends AbstractFastState<?>,I>
-
-