Interface State<S,E>

Type Parameters:
S - the type of state
E - the type of event
All Known Implementing Classes:
AbstractSimpleState, AbstractState, EnumState, ObjectState, RegionState, StateMachineState

public interface State<S,E>
State is an interface representing possible state in a state machine.
  • Method Details

    • sendEvent

      reactor.core.publisher.Flux<StateMachineEventResult<S,E>> sendEvent(org.springframework.messaging.Message<E> event)
      Send an event E wrapped with a Message to the state and return a StateMachineEventResult for results.
      Parameters:
      event - the wrapped event to send
      Returns:
      the state machine event results
    • shouldDefer

      boolean shouldDefer(org.springframework.messaging.Message<E> event)
      Checks if state wants to defer an event.
      Parameters:
      event - the wrapped event
      Returns:
      true if event should be deferred
    • exit

      reactor.core.publisher.Mono<Void> exit(StateContext<S,E> context)
      Initiate an exit sequence for the state.
      Parameters:
      context - the state context
      Returns:
      Mono for completion
    • entry

      reactor.core.publisher.Mono<Void> entry(StateContext<S,E> context)
      Initiate an entry sequence for the state.
      Parameters:
      context - the state context
      Returns:
      Mono for completion
    • getId

      S getId()
      Gets the state identifier.
      Returns:
      the state identifiers
    • getIds

      Collection<S> getIds()
      Gets the state identifiers. Usually returned collection contains only one identifier except in a case where state is an orthogonal.
      Returns:
      the state identifiers
    • getStates

      Collection<State<S,E>> getStates()
      Gets all possible states this state knows about including itself and substates.
      Returns:
      all state including itself and nested states
    • getPseudoState

      PseudoState<S,E> getPseudoState()
      Gets a PseudoState attached to a State. PseudoState is not required and thus this method return NULL if it's not set.
      Returns:
      pseudostate or null if state doesn't have one
    • getDeferredEvents

      Collection<E> getDeferredEvents()
      Gets the deferred events for this state.
      Returns:
      the state deferred events
    • getEntryActions

      Collection<Function<StateContext<S,E>,reactor.core.publisher.Mono<Void>>> getEntryActions()
      Gets Actions executed entering in this state.
      Returns:
      the state entry actions
    • getStateActions

      Collection<Function<StateContext<S,E>,reactor.core.publisher.Mono<Void>>> getStateActions()
      Gets Actions executed once in this state.
      Returns:
      the state actions
    • getExitActions

      Collection<Function<StateContext<S,E>,reactor.core.publisher.Mono<Void>>> getExitActions()
      Gets Actions executed exiting from this state.
      Returns:
      the state exit actions
    • isSimple

      boolean isSimple()
      Checks if state is a simple state. A simple state does not have any regions and it does not refer to any submachine state machine.
      Returns:
      true, if state is a simple state
    • isComposite

      boolean isComposite()
      Checks if state is a composite state. A composite state is a state that contains at least one region.
      Returns:
      true, if state is a composite state
    • isOrthogonal

      boolean isOrthogonal()
      Checks if state is an orthogonal state. An orthogonal composite state contains two or more regions. If this method returns TRUE, isComposite() will also always return TRUE.
      Returns:
      true, if state is an orthogonal state
    • isSubmachineState

      boolean isSubmachineState()
      Checks if state is a submachine state. This kind of state refers to a state machine(submachine).
      Returns:
      true, if state is a submachine state
    • addStateListener

      void addStateListener(StateListener<S,E> listener)
      Adds the state listener.
      Parameters:
      listener - the listener
    • removeStateListener

      void removeStateListener(StateListener<S,E> listener)
      Removes the state listener.
      Parameters:
      listener - the listener
    • addActionListener

      void addActionListener(ActionListener<S,E> listener)
      Adds the action listener.
      Parameters:
      listener - the listener
    • removeActionListener

      void removeActionListener(ActionListener<S,E> listener)
      Removes the action listener.
      Parameters:
      listener - the listener