org.squirrelframework.foundation.fsm.ImmutableTransition 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;
import org.squirrelframework.foundation.component.SquirrelComponent;
/**
* Transition A directed relationship between two states which represents the complete response
* of a state machine to an occurrence of an event of a particular type.
*
* Condition A constraint which must evaluate to true after the trigger occurs in order for the
* transition to complete.
*
* Transition Action An activity which is executed when performing a certain transition.
*
* Trigger(Event) A triggering activity that causes a transition to occur.
*
* @author Henry.He
*
* @param type of State Machine
* @param type of State
* @param type of Event
* @param type of Context
*/
public interface ImmutableTransition, S, E, C> extends Visitable, SquirrelComponent {
/**
* @return Transition source state
*/
ImmutableState getSourceState();
/**
* @return Transition destination state
*/
ImmutableState getTargetState();
/**
* @return Transition action list
*/
List> getActions();
/**
* Execute transition under state context
* @param stateContext
* @return state when transition finished
*/
ImmutableState transit(StateContext stateContext);
/**
* @return Condition of the transition
*/
Condition getCondition();
/**
* @return Event that can trigger the transition
*/
E getEvent();
/**
* @return type of transition
*/
TransitionType getType();
boolean isMatch(S fromState, S toState, E event);
boolean isMatch(S fromState, S toState, E event, Class> condClazz, TransitionType type);
/**
* Notify transition when receiving event
* @param stateContext
*/
void internalFire(StateContext stateContext);
/**
* Verify tranistion correctness
*/
void verify();
}