Package owl.automaton

## Interface MutableAutomaton<S,A extends OmegaAcceptance>

- Type Parameters:
    `S` - the type of the states of the automaton
    `A` - the type of the omega-acceptance condition of the automaton
  All Superinterfaces:
    `Automaton<S,A>`

      public interface MutableAutomaton<S,A extends OmegaAcceptance>
      extends Automaton<S,A>

  A mutation interface extending `Automaton`. As the super interface requires that only from the initial states reachable states are present, after any operation that might introduce unreachable states (a list is given below) it is required to call `trim()` before calling any method of the `Automaton` interface. For methods that do not change the reachability (a list is given below) calling `trim()` has no effect and is not required.

  Methods that do require calling `trim()` afterwards:

  - `initialStates(Collection)`
  - `removeInitialState(Object)`
  - `addState(Object)`
  - `removeState(Object)`
  - `removeStateIf(Predicate)`
  - `removeEdge(Object, BitSet, Object)`
  - `removeEdge(Object, ValuationSet, Object)`
  - `updateEdges(BiFunction)`
  - `updateEdges(Set, BiFunction)`

  Methods that do not require calling `trim()` afterwards:

  - `name(String)`
  - `acceptance(OmegaAcceptance)`
  - `updateAcceptance(Function)`
  - `addInitialState(Object)`
  - `addEdge(Object, BitSet, Edge)`
  - `addEdge(Object, ValuationSet, Edge)`
  - `trim()`

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface owl.automaton.Automaton

      `Automaton.EdgeVisitor<S>, Automaton.HybridVisitor<S>, Automaton.LabelledEdgeVisitor<S>, Automaton.Property, Automaton.Visitor<S>`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `acceptance​(A acceptance)` |
    `default void` | `addEdge​(S source, BitSet valuation, Edge<? extends S> edge)` | Adds a transition from the `source` state under `valuation`.
    `void` | `addEdge​(S source, ValuationSet valuations, Edge<? extends S> edge)` | Adds transitions from the `source` state under `valuations`.
    `void` | `addInitialState​(S initialState)` | Set the initial state of the automaton.
    `void` | `addState​(S state)` | Adds a `state` without outgoing edges to the set of states.
    `void` | `initialStates​(Collection<? extends S> initialStates)` | Sets the set of initial states of the automaton.
    `void` | `name​(String name)` | Sets the name of the automaton.
    `default void` | `removeEdge​(S source, BitSet valuation, S destination)` | Removes all transition from `source` under `valuation` to `destination`.
    `void` | `removeEdge​(S source, ValuationSet valuations, S destination)` | Removes all transition from `source` under `valuations` to `destination`.
    `void` | `removeInitialState​(S state)` |
    `default void` | `removeState​(S state)` | Removes a state and all transitions involving it from the automaton.
    `void` | `removeStateIf​(Predicate<? super S> states)` | Removes the specified `states` and all transitions involving them from the automaton.
    `void` | `trim()` | Removes unreachable states and adjust internal data structures after mutation.
    `default void` | `updateAcceptance​(Function<? super A,? extends A> updater)` |
    `void` | `updateEdges​(BiFunction<S,Edge<S>,Edge<S>> updater)` | Remaps each edge of the automaton according to `updater`.
    `void` | `updateEdges​(Set<? extends S> states, BiFunction<? super S,Edge<S>,Edge<S>> updater)` | Remaps each outgoing edge of the specified `states` according to `updater`.

    - ### Methods inherited from interface owl.automaton.Automaton

      `accept, accept, accept, acceptance, edge, edges, edges, factory, forEachEdge, forEachLabelledEdge, initialStates, is, labelledEdges, name, onlyInitialState, predecessors, prefersLabelled, size, states, successor, successors, successors`

- - ### Method Detail

    - #### name

          void name​(String name)

      Sets the name of the automaton.
      Parameters:
        `name` - The new name of the automaton.

    - #### acceptance

          void acceptance​(A acceptance)

    - #### updateAcceptance

          default void updateAcceptance​(Function<? super A,? extends A> updater)

    - #### initialStates

          void initialStates​(Collection<? extends S> initialStates)

      Sets the set of initial states of the automaton.
      Parameters:
        `initialStates` - The new set of initial states (potentially empty)

    - #### addInitialState

          void addInitialState​(S initialState)

      Set the initial state of the automaton.
      Parameters:
        `initialState` - The new initial state.

    - #### removeInitialState

          void removeInitialState​(S state)

    - #### addState

          void addState​(S state)

      Adds a `state` without outgoing edges to the set of states. If the state is already present, nothing is changed.
      Parameters:
        `state` - The state to be added.

    - #### removeState

          default void removeState​(S state)

      Removes a state and all transitions involving it from the automaton. If the automaton does not contain the specified state, nothing is changed.
      Parameters:
        `state` - The state to be removed.

    - #### removeStateIf

          void removeStateIf​(Predicate<? super S> states)

      Removes the specified `states` and all transitions involving them from the automaton.
      Parameters:
        `states` - The states to be removed.

    - #### addEdge

          default void addEdge​(S source,
                               BitSet valuation,
                               Edge<? extends S> edge)

      Adds a transition from the `source` state under `valuation`.
      Parameters:
        `source` - The source state.
        `valuation` - The valuation under which this transition is possible.
        `edge` - The respective edge, containing destination and acceptance information. If the successor is not already present, it gets added to the transition table.
      Throws:
        `IllegalArgumentException` - If `source` is not contained in the automaton.

    - #### addEdge

          void addEdge​(S source,
                       ValuationSet valuations,
                       Edge<? extends S> edge)

      Adds transitions from the `source` state under `valuations`.
      Parameters:
        `source` - The source state.
        `valuations` - The valuations under which this transition is possible.
        `edge` - The respective edge, containing destination and acceptance information.
      Throws:
        `IllegalArgumentException` - If `source` is not contained in the automaton

    - #### removeEdge

          default void removeEdge​(S source,
                                  BitSet valuation,
                                  S destination)

      Removes all transition from `source` under `valuation` to `destination`. Requires both states to be present in the automaton.
      Parameters:
        `source` - The source state.
        `valuation` - The valuation.
        `destination` - The destination state.
      Throws:
        `IllegalArgumentException` - If either `source` or `destination` are not present in the automaton.
      See Also:
        `removeEdge(Object, ValuationSet, Object)`

    - #### removeEdge

          void removeEdge​(S source,
                          ValuationSet valuations,
                          S destination)

      Removes all transition from `source` under `valuations` to `destination`. Requires both states to be present in the automaton.
      Parameters:
        `source` - The source state.
        `valuations` - The valuations.
        `destination` - The destination state.
      Throws:
        `IllegalArgumentException` - If either `source` or `destination` are not present in the automaton.

    - #### updateEdges

          void updateEdges​(Set<? extends S> states,
                           BiFunction<? super S,Edge<S>,Edge<S>> updater)

      Remaps each outgoing edge of the specified `states` according to `updater`.

      The function is allowed to return `null` which indicates that the edge should be removed. Requires all `states` to be present in the automaton.

      Parameters:
        `states` - The states whose outgoing edges are to be remapped.
        `updater` - The remapping function. The updater needs to be stateless, since it might be called with unreachable states.
      Throws:
        `IllegalArgumentException` - If any state of `states` is not present in the automaton.

    - #### updateEdges

          void updateEdges​(BiFunction<S,Edge<S>,Edge<S>> updater)

      Remaps each edge of the automaton according to `updater`.

      The function is allowed to return `null` which indicates that the edge should be removed.

      Parameters:
        `updater` - The remapping function. The updater needs to be stateless, since it might be called with unreachable states.
      See Also:
        `updateEdges(Set, BiFunction)`

    - #### trim

          void trim()

      Removes unreachable states and adjust internal data structures after mutation.