com.alibaba.cola.statemachine.StateMachine Maven / Gradle / Ivy
package com.alibaba.cola.statemachine;
/**
* StateMachine
*
* @author Frank Zhang
*
* @param the type of state
* @param the type of event
* @param the user defined context
* @date 2020-02-07 2:13 PM
*/
public interface StateMachine extends Visitable{
/**
* Send an event {@code E} to the state machine.
*
* @param sourceState the source state
* @param event the event to send
* @param ctx the user defined context
* @return the target state
*/
S fireEvent(S sourceState, E event, C ctx);
/**
* MachineId is the identifier for a State Machine
* @return
*/
String getMachineId();
/**
* Use visitor pattern to display the structure of the state machine
*/
void showStateMachine();
String generatePlantUML();
}