commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
Subject Re: SCXML undo?
Date Tue, 12 Jun 2007 15:51:11 GMT
On 6/12/07, sungchan <schanpark@gmail.com> wrote:
> I invented some FSM with SCXML.
> As a reserverd word "reset", I think we need the "undo" command.
> "Undo" steps back to from-state.
> Let me give one example.
>
> <scxml initialstate="root">
> <state id="root">
> <initial>
> <transition target="S0"/>
> </initial>
> <state id="S0"><transition target="S00" event="0"/></state>
> <state id="S00"><transition target="S100000" event="~"/><transition
> target="S000" event="0"/></state>
> <state id="S000"><transition target="S100000" event="~"/><transition
> target="S100000" event="0"/></state>
> </state>
> <state id="S100000" final="true"/>
> </scxml>
>
> In state S00, it moves back S0 when we typed "undo".
> Now how can we make this "undo"?
> Is SCXML engine equipped to stack data structure for supporting it?
>

There is no plan to support a programmatic "undo()" like we have a
"reset()". This is primarily for two reasons:
 * It raises a bunch of related questions (whether the data models get
rolled back, whether the histories are revisited etc.)
 * It allows the state machine to traverse arcs that haven't been
modeled (so the model is no longer complete)

However, there are a couple of ways to support undo:
 * For complex states, one can use the <history> element, see this
wiki page [1] for an example
 * For simple states (such as your example above), that isn't
possible. You can keep track of the previous state(s) yourself (in
application code) and set the executor's current status (see
SCXMLExecutor#getCurrentStatus() ) accordingly on undo. Ofcourse, this
wouldn't do any undo'ing of the datamodels, triggering executable
content etc.

-Rahul

[1] http://wiki.apache.org/jakarta-commons/SCXML/Tutorials/History

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message