Package io.github.frizman21.common.sm
Class StateMachine
java.lang.Object
io.github.frizman21.common.sm.StateMachine
- All Implemented Interfaces:
Runnable
- Author:
- Mike Frizzell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(StateMachineListener listener) createStartState(String name) createState(String name) createState(String name, boolean isEndState) voideventHappens(Event event) getState()booleanvoidkill()This will kill the internal thread that fires the next event.putFromMachineState(String key, Object value) booleanvoidrun()voidstartMachine(boolean startThread) booleanwaitUntilDone(long timeout)
-
Constructor Details
-
StateMachine
-
-
Method Details
-
register
-
add
-
createStartState
- Throws:
ConfigException
-
createState
-
createState
-
startMachine
- Throws:
ConfigException
-
eventHappens
- Throws:
ConfigException
-
run
public void run() -
kill
public void kill()This will kill the internal thread that fires the next event. -
isMachineRunning
public boolean isMachineRunning() -
waitUntilDone
public boolean waitUntilDone(long timeout) - Returns:
-
getState
-
getFromMachineState
-
putFromMachineState
-