Class AbstractCompact<I,​T,​SP,​TP>

    • Constructor Detail

      • AbstractCompact

        public AbstractCompact​(Alphabet<I> alphabet,
                               int stateCapacity,
                               float resizeFactor)
    • Method Detail

      • getStates

        public Collection<Integer> getStates()
        Description copied from interface: SimpleAutomaton
        Retrieves all states of the transition system. Implementing classes should return an unmodifiable collection
        Specified by:
        getStates in interface SimpleAutomaton<I,​T>
        Returns:
        all states in the transition system
      • size

        public int size()
        Description copied from interface: SimpleAutomaton
        Retrieves the size (number of states) of this transition system.
        Specified by:
        size in interface FiniteRepresentation
        Specified by:
        size in interface SimpleAutomaton<I,​T>
        Returns:
        the number of states of this transition system
      • getStateId

        public int getStateId​(Integer 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 interface StateIDs<I>
        Parameters:
        state - the state whose id should be retrieved
        Returns:
        the (positive) id of the given automaton state
      • getState

        public Integer 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 interface StateIDs<I>
        Parameters:
        id - the id of the state to be returned
        Returns:
        the automaton state identified by the given id.
      • addIntState

        public int addIntState​(@Nullable SP property)
      • addAlphabetSymbol

        public final 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.
        Some data structures may need to be properly initialized (e.g. with a GrowingAlphabet) to handle potentially shared state across multiple instances. If the needed requirements are not met, a GrowingAlphabetNotSupportedException can be thrown.
        Specified by:
        addAlphabetSymbol in interface SupportsGrowingAlphabet<I>
        Parameters:
        symbol - the symbol to add to the alphabet.
      • getLocalInputs

        public Collection<I> getLocalInputs​(Integer state)
        Description copied from interface: StateLocalInput
        Returns the collection of input symbols for which a successor state is defined.
        Specified by:
        getLocalInputs in interface StateLocalInput<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

        public abstract void setStateProperty​(int state,
                                              SP property)
      • getStateProperty

        public abstract SP getStateProperty​(int state)
      • updateStateStorage

        protected void updateStateStorage​(AbstractCompact.Payload payload)
        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 to MutableAutomaton.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 the updateStateStorage(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 array
        defaultValue - default value for newly allocated array positions
        payload - the payload object
        Returns:
        a copy of the provided array with updated memory layout.
      • 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 id
        inputId - the index of input symbol
        Returns:
        the memory location for the given state id and input symbol index
        See Also:
        getSymbolIndex(Object)
      • getSymbolIndex

        protected final int getSymbolIndex​(I input)