- Type Parameters:
I- input symbol typeT- transition typeSP- state property typeTP- transition property type
- All Implemented Interfaces:
Iterable<Integer>,SupportsGrowingAlphabet<I>,Automaton<Integer,,I, T> FiniteRepresentation,InitialStates<Integer>,InputAlphabetHolder<I>,StateIDs<Integer>,StateLocalInput<Integer,,I> FiniteAlphabetAutomaton<Integer,,I, T> MutableAutomaton<Integer,,I, T, SP, TP> SimpleAutomaton<Integer,,I> UniversalAutomaton<Integer,,I, T, SP, TP> UniversalFiniteAlphabetAutomaton<Integer,,I, T, SP, TP> GraphViewable,SimpleTS<Integer,,I> TransitionSystem<Integer,,I, T> UniversalTransitionSystem<Integer,I, T, SP, TP>
- Direct Known Subclasses:
AbstractCompactDeterministic,AbstractCompactMTS,AbstractCompactSimpleNondet
This class provides basic implementations (as far as possible on this abstract level) for several of the implemented concepts and offers utility methods to subclasses, for updating their array-based automata data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classA utility class that encapsulates necessary information for performing an update of the stored automata data.Nested classes/interfaces inherited from interface net.automatalib.automaton.Automaton
Automaton.RegularAutomaton<S,I, T> Nested classes/interfaces inherited from interface net.automatalib.automaton.MutableAutomaton
MutableAutomaton.RegularAutomaton<S,I, T, SP, TP> Nested classes/interfaces inherited from interface net.automatalib.automaton.UniversalAutomaton
UniversalAutomaton.RegularAutomaton<S,I, T, SP, TP> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected static final floatprotected static final int -
Constructor Summary
ConstructorsConstructorDescriptionAbstractCompact(Alphabet<I> alphabet, int stateCapacity, float resizeFactor) AbstractCompact(Alphabet<I> alphabet, AbstractCompact<?, ?, ?, ?> other) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddAlphabetSymbol(I symbol) Notifies the data structure that a new symbol should be added to the alphabet.intaddIntState(@Nullable SP property) final IntegerAdds a new state with the given property to the automaton.voidclear()Removes all states and transitions.getLocalInputs(Integer state) Returns the collection of input symbols for which a successor state is defined.getState(int id) Return for a given id the state of the automaton identified by it.intgetStateId(Integer state) Returns for a given state of the automaton an integer uniquely identifying the state.abstract SPgetStateProperty(int state) getStateProperty(Integer state) Retrieves the state property for the given state.Retrieves all states of the transition system.protected final intgetSymbolIndex(I input) final intabstract voidsetStateProperty(int state, SP property) voidsetStateProperty(Integer state, SP property) intsize()Retrieves the size (number of states) of this transition system.stateIDs()protected static intprotected final inttoMemoryIndex(int stateId, int inputId) Returns for a given state id and input symbol index, the memory location for its associated data.toState(int id) protected final Object[]updateStateStorage(@Nullable Object[] oldStorage, @Nullable Object defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.protected voidImplementing classes should override this method in order to react to changes to the layout of their array-based state data, e.g. due to calls toMutableAutomaton.addState().protected final int[]updateTransitionStorage(int[] oldStorage, int defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.updateTransitionStorage(@Nullable Object[] oldStorage, @Nullable Object defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.protected final <S> @Nullable S[]updateTransitionStorage(@Nullable S[] oldStorage, IntFunction<@Nullable S[]> arrayConstructor, @Nullable S defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.protected voidImplementing classes should override this method in order to react to changes to the layout of their array-based transition data, e.g. due to calls toMutableAutomaton.addState()oraddAlphabetSymbol(Object).Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.automatalib.automaton.FiniteAlphabetAutomaton
getTransitions, graphViewMethods inherited from interface net.automatalib.automaton.concept.InitialStates
getInitialStatesMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface net.automatalib.automaton.MutableAutomaton
addInitialState, addInitialState, addState, addTransition, addTransition, addTransitions, copyTransition, createTransition, removeAllTransitions, removeAllTransitions, removeTransition, setInitial, setTransitionProperty, setTransitionsMethods inherited from interface net.automatalib.automaton.simple.SimpleAutomaton
createDynamicStateMapping, createStaticStateMapping, iteratorMethods inherited from interface net.automatalib.ts.simple.SimpleTS
getStates, getSuccessorsMethods inherited from interface net.automatalib.ts.TransitionSystem
getSuccessor, getSuccessors, getTransitions, powersetViewMethods inherited from interface net.automatalib.automaton.UniversalAutomaton
transitionGraphViewMethods inherited from interface net.automatalib.automaton.UniversalFiniteAlphabetAutomaton
transitionGraphViewMethods inherited from interface net.automatalib.ts.UniversalTransitionSystem
getTransitionProperty
-
Field Details
-
DEFAULT_RESIZE_FACTOR
protected static final float DEFAULT_RESIZE_FACTOR- See Also:
-
DEFAULT_INIT_CAPACITY
protected static final int DEFAULT_INIT_CAPACITY- See Also:
-
INVALID_STATE
protected static final int INVALID_STATE- See Also:
-
-
Constructor Details
-
AbstractCompact
-
AbstractCompact
-
-
Method Details
-
getStates
Description copied from interface:SimpleAutomatonRetrieves all states of the transition system. Implementing classes should return an unmodifiable collection- Specified by:
getStatesin interfaceSimpleAutomaton<I,T> - Returns:
- all states in the transition system
-
stateIDs
- Specified by:
stateIDsin interfaceSimpleAutomaton<I,T>
-
size
public int size()Description copied from interface:SimpleAutomatonRetrieves the size (number of states) of this transition system.- Specified by:
sizein interfaceFiniteRepresentation- Specified by:
sizein interfaceSimpleAutomaton<I,T> - Returns:
- the number of states of this transition system
-
getStateId
Description copied from interface:StateIDsReturns 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:
getStateIdin interfaceStateIDs<I>- Parameters:
state- the state whose id should be retrieved- Returns:
- the (positive) id of the given automaton state
-
getState
Description copied from interface:StateIDsReturn for a given id the state of the automaton identified by it. -
clear
public void clear()Description copied from interface:MutableAutomatonRemoves all states and transitions. -
addState
Description copied from interface:MutableAutomatonAdds a new state with the given property to the automaton. -
addIntState
-
getInputAlphabet
- Specified by:
getInputAlphabetin interfaceInputAlphabetHolder<I>
-
addAlphabetSymbol
Description copied from interface:SupportsGrowingAlphabetNotifies 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, aGrowingAlphabetNotSupportedExceptioncan be thrown.- Specified by:
addAlphabetSymbolin interfaceSupportsGrowingAlphabet<I>- Parameters:
symbol- the symbol to add to the alphabet.
-
getLocalInputs
Description copied from interface:StateLocalInputReturns the collection of input symbols for which a successor state is defined.- Specified by:
getLocalInputsin interfaceStateLocalInput<I,T> - Parameters:
state- the state for which the defined inputs should be returned- Returns:
- the collection of input symbols for which a successor state is defined.
-
setStateProperty
- Specified by:
setStatePropertyin interfaceMutableAutomaton<Integer,I, T, SP, TP>
-
setStateProperty
-
getStateProperty
Description copied from interface:UniversalTransitionSystemRetrieves the state property for the given state.- Specified by:
getStatePropertyin interfaceUniversalTransitionSystem<Integer,I, T, SP, TP> - Parameters:
state- the state.- Returns:
- the corresponding property.
-
getStateProperty
-
updateStateStorage
Implementing classes should override this method in order to react to changes to the layout of their array-based state data, e.g. due to calls toMutableAutomaton.addState().Subclasses may use one of the
updateStateStorage(Object[], Object, Payload)... methods to conveniently delegate this task to this base class. This leaves subclasses only with the task to invoke the provided update methods for each of their local array storages.- Parameters:
payload- the payload containing the necessary information for the update operation. This object must be passed as-is to theupdateStateStorage(Object[], Object, Payload)... methods.
-
updateStateStorage
protected final Object[] updateStateStorage(@Nullable Object[] oldStorage, @Nullable Object defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.- Parameters:
oldStorage- the current arraydefaultValue- default value for newly allocated array positionspayload- the payload object- Returns:
- a copy of the provided array with updated memory layout.
-
updateTransitionStorage
Implementing classes should override this method in order to react to changes to the layout of their array-based transition data, e.g. due to calls toMutableAutomaton.addState()oraddAlphabetSymbol(Object).Subclasses may use one of the
updateTransitionStorage(Object[], IntFunction, Object, Payload)... methods to conveniently delegate this task to this base class. This leaves subclasses only with the task to invoke the provided update methods for each of their local array storages.- Parameters:
payload- the payload containing the necessary information for the update operation. This object must be passed as-is to theupdateTransitionStorage(Object[], IntFunction, Object, Payload)... methods.
-
updateTransitionStorage
protected final int[] updateTransitionStorage(int[] oldStorage, int defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.- Parameters:
oldStorage- the current arraydefaultValue- default value for newly allocated array positionspayload- the payload object- Returns:
- a copy of the provided array with updated memory layout.
- See Also:
-
updateTransitionStorage
protected final @Nullable Object[] updateTransitionStorage(@Nullable Object[] oldStorage, @Nullable Object defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.- Parameters:
oldStorage- the current arraydefaultValue- default value for newly allocated array positionspayload- the payload object- Returns:
- a copy of the provided array with updated memory layout.
- See Also:
-
updateTransitionStorage
protected final <S> @Nullable S[] updateTransitionStorage(@Nullable S[] oldStorage, IntFunction<@Nullable S[]> arrayConstructor, @Nullable S defaultValue, AbstractCompact.Payload payload) Return a copy of the provided array with updated memory layout.- Type Parameters:
S- the storage type- Parameters:
oldStorage- the current arrayarrayConstructor- the constructor for creating the new arraydefaultValue- default value for newly allocated array positionspayload- the payload object- Returns:
- a copy of the provided array with updated memory layout.
- See Also:
-
toState
-
toId
-
toMemoryIndex
protected final int toMemoryIndex(int stateId, int inputId) Returns for a given state id and input symbol index, the memory location for its associated data.- Parameters:
stateId- the state idinputId- the index of input symbol- Returns:
- the memory location for the given state id and input symbol index
- See Also:
-
getSymbolIndex
-
numInputs
public final int numInputs(@UnknownInitialization(AbstractCompact.class) AbstractCompact<I, T, SP, TP> this)
-