| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.hazelcast.util.StateMachine<T>
T - public class StateMachine<T extends Enum<T>>
Simple state machine using an Enum as possible states.
| Constructor Summary | |
|---|---|
| StateMachine(T initialState) | |
| Method Summary | ||
|---|---|---|
|  boolean | is(T state,
   T... otherStates)Check if current state is one of given states | |
|  StateMachine<T> | next(T nextState)Transition to next state | |
|  void | nextOrStay(T nextState)Transition to next state if not already there | |
| static
 | of(T initialState) | |
|  String | toString() | |
|  StateMachine<T> | withTransition(T from,
               T to,
               T... moreTo)Add a valid transition from one state to one or more states | |
| Methods inherited from class java.lang.Object | 
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait | 
| Constructor Detail | 
|---|
public StateMachine(T initialState)
| Method Detail | 
|---|
public static <T extends Enum<T>> StateMachine<T> of(T initialState)
public StateMachine<T> withTransition(T from,
                                      T to,
                                      T... moreTo)
public StateMachine<T> next(T nextState)
                                     throws IllegalStateException
IllegalStateException - if transition is not allowedpublic void nextOrStay(T nextState)
public boolean is(T state,
                  T... otherStates)
public String toString()
toString in class Object| 
 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||