Package com.tnsai.fsm

Class StateMachine.Builder

java.lang.Object
com.tnsai.fsm.StateMachine.Builder
Enclosing class:
StateMachine

public static class StateMachine.Builder extends Object
Builder for StateMachine.
  • Method Details

    • state

      public StateMachine.Builder state(State state)
      Adds a state.
      Parameters:
      state - the state
      Returns:
      this builder
    • states

      public StateMachine.Builder states(State... states)
      Adds multiple states.
      Parameters:
      states - the states
      Returns:
      this builder
    • transition

      public StateMachine.Builder transition(Transition transition)
      Adds a transition.
      Parameters:
      transition - the transition
      Returns:
      this builder
    • transition

      public StateMachine.Builder transition(Transition.Builder transitionBuilder)
      Adds a transition using builder.
      Parameters:
      transitionBuilder - the transition builder
      Returns:
      this builder
    • initialState

      public StateMachine.Builder initialState(State state)
      Sets the initial state explicitly.
      Parameters:
      state - the initial state
      Returns:
      this builder
    • maxTransitions

      public StateMachine.Builder maxTransitions(int max)
      Sets the maximum number of transitions allowed.
      Parameters:
      max - maximum transitions
      Returns:
      this builder
    • build

      public StateMachine build()
      Builds the state machine.
      Returns:
      new state machine
      Throws:
      StateMachineException - if configuration is invalid