Class StateMachine

  • All Implemented Interfaces:
    org.hamcrest.SelfDescribing, States, StatesClause

    public class StateMachine
    extends java.lang.Object
    implements States
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.String currentState  
      private java.lang.String name  
    • Constructor Summary

      Constructors 
      Constructor Description
      StateMachine​(java.lang.String name)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void become​(java.lang.String nextState)
      Put the state machine into state nextState.
      void describeTo​(org.hamcrest.Description description)  
      State is​(java.lang.String state)  
      StatePredicate isNot​(java.lang.String state)  
      States startsAs​(java.lang.String initialState)
      Put the state machine into state initialState.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • name

        private final java.lang.String name
      • currentState

        private java.lang.String currentState
    • Constructor Detail

      • StateMachine

        public StateMachine​(java.lang.String name)
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • startsAs

        public States startsAs​(java.lang.String initialState)
        Description copied from interface: States
        Put the state machine into state initialState.
        Specified by:
        startsAs in interface States
        Parameters:
        initialState - The initial state of the state machine.
        Returns:
        Itself.
      • become

        public void become​(java.lang.String nextState)
        Description copied from interface: States
        Put the state machine into state nextState.
        Specified by:
        become in interface States
        Parameters:
        nextState - The next state of the state machine.
      • is

        public State is​(java.lang.String state)
        Specified by:
        is in interface StatesClause
      • describeTo

        public void describeTo​(org.hamcrest.Description description)
        Specified by:
        describeTo in interface org.hamcrest.SelfDescribing