Class SimpleState

  • All Implemented Interfaces:
    State

    public class SimpleState
    extends java.lang.Object
    implements State
    Minimal implementation of the State interface that can be used in state machines.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleState​(java.lang.String name, float duration, State next, boolean interruptable)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static SimpleState create​(java.lang.String name)
      Convenience method to create a simple state that will remain active until it is interrupted by changing to a different state.
      boolean equals​(java.lang.Object o)  
      float getDuration()  
      java.lang.String getName()  
      State getNext()  
      int hashCode()  
      boolean isInterruptable()  
      static SimpleState permanent​(java.lang.String name)
      Convenience method to create a simple state that will remain active forever and cannot be interrupted by changing to another state.
      static SimpleState timed​(java.lang.String name, float duration, State next)
      Convenience method to create a simple state that is only active for a finite amount of time, after which it will change to the specified new state.
      java.lang.String toString()  
      static SimpleState uninterruptable​(java.lang.String name, float duration, State next)
      Creates a state that is only active for a finite amount of time, and cannot be interrupted within this period.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • SimpleState

        public SimpleState​(java.lang.String name,
                           float duration,
                           State next,
                           boolean interruptable)
    • Method Detail

      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface State
      • getDuration

        public float getDuration()
        Specified by:
        getDuration in interface State
      • isInterruptable

        public boolean isInterruptable()
        Specified by:
        isInterruptable in interface State
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

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

        public static SimpleState create​(java.lang.String name)
        Convenience method to create a simple state that will remain active until it is interrupted by changing to a different state.
      • timed

        public static SimpleState timed​(java.lang.String name,
                                        float duration,
                                        State next)
        Convenience method to create a simple state that is only active for a finite amount of time, after which it will change to the specified new state.
      • uninterruptable

        public static SimpleState uninterruptable​(java.lang.String name,
                                                  float duration,
                                                  State next)
        Creates a state that is only active for a finite amount of time, and cannot be interrupted within this period.
      • permanent

        public static SimpleState permanent​(java.lang.String name)
        Convenience method to create a simple state that will remain active forever and cannot be interrupted by changing to another state.