org.squirrelframework.foundation.fsm.StateContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of squirrel-foundation Show documentation
Show all versions of squirrel-foundation Show documentation
foundation module of squirrel framework which provided event driven infrastructure and a finite state machine implementation.
package org.squirrelframework.foundation.fsm;
import java.util.List;
/**
* Then context of state machine when processing any events
*
* @author Henry.He
*
* @param state machine type
* @param state type
* @param event type
* @param context type
*/
public interface StateContext, S, E, C> {
/**
* @return current state machine object
*/
MutableStateMachine getStateMachine();
/**
* @return source state of state machine
*/
ImmutableState getSourceState();
/**
* @return external context object
*/
C getContext();
/**
* @return event
*/
E getEvent();
/**
* Search state machine active child state store and return last active child state of parent state
* @param parentState parent state
* @return last active child state of parent state
*/
ImmutableState getLastActiveChildStateOf(ImmutableState parentState);
/**
* Update state machine active child state store
* @param parentState parent state
* @param childState last active child state
*/
void setLastActiveChildState(ImmutableState parentState, ImmutableState childState);
/**
* @param parentState parent state
* @return sub-states of parent parallel stae
*/
List> getSubStatesOn(ImmutableState parentState);
/**
* @return transition result
*/
TransitionResult getResult();
/**
* @return action executor
*/
ActionExecutor getExecutor();
}