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, the two actions are merged into one.
TurnLightsOffAction + TurnLightsOnAction = TurnLightsAction
The new action decides whether to switch the lights on or off based on the current state.
public void execute(StateContext context) throws ActionException { Switch powerSwitch = (Switch) stateContext; if (powerSwitch.isOn()) { System.out.println("Action: Turned the lights off!"); } else { System.out.println("Action: Turned the lights on!"); } }
This is possible because the action has access to the state context.
The complete declaration is under conf/context-example4.xml.
Run src/test/java/gr.ekt.fsmengine.example4.Run to see the execution flow.