We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Extending the previous example, when the event press arrives at STATE_ON, the state is moved back to STATE_OFF.
So we have a second transition from STATE_ON to STATE_OFF. For this transition we define a new action to be performed.
public class TurnLightsOffAction extends AbstractAction { @Override public void execute(StateContext context) throws ActionException { System.out.println("Action: Turned the lights off!"); } }
<bean id="actionTurnLightsOff" class=" gr.ekt.fsmengine.example3.TurnLightsOffAction" /> <bean id="transitionB" class="gr.ekt.fsmengine.api.DefaultTransition"> <property name="fromState" ref="stateOn" /> <property name="toState" ref="stateOff" /> <property name="actions"> <list> <ref bean="actionTurnLightsOff"/> </list> </property> </bean>
The complete declaration is under conf/context-example3.xml.
Run src/test/java/gr.ekt.fsmengine.example3.Run to see the execution flow.