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] more Evaluator/Context questions
Date Thu, 05 Mar 2009 18:03:16 GMT
On Thu, Mar 5, 2009 at 11:33 AM, Linda Erlenhov
<linda.erlenhov@gmail.com> wrote:
> Hello!
>
> This is my plan:
> My guards are boolean expressions and the boolean variables that the
> expression consists of are updated in "onEntry"/"onExit". I use a listner
> for _when_ the update should be done.
>
<snip/>

Its better to model the state machine in as much completeness as
possible using an SCXML document. Investigate whether you actually
need to use a listener. See the canonical microwave samples or any
datamodel test cases for examples of updates during <onentry> and
<onexit>, here are the JEXL variants:

  http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/


> The trouble is that I´m not shure _where/how_ the updating is done. Since
> this should be done during runtime a guess is that it is some kind of update
> in the context, but I have clearly not understood properly how this
> (context)  works.
>
<snap/>

The Java API merely serves to support the mechanics of SCXML
execution. Whether you need to understand it really depends on the
nature of the usecase. Often, <assign> is sufficient for updating data
model variables etc.


> So if I create a simple example then maybe someone could use it to explain
> this to me:
>
> The statemachine has three states. A, B and C. There are transitions between
> A & B both ways, and also transitions between B & C both ways. You can
> trigger events that are "go to A", "go to B" "go to C". You start in A. On
> the transition from B to A there is a guard for "been in C" that is set when
> you visit C. So you have to visit C atleast once before you enter state A
> the second time.
>
> A<=>B<=>C
>
> How/where do I set the "been in C" state to true when i enter the state?
>
<snip/>

IIUC, use the 'beenInC' variable below in the guard condition for
entering A the second time:

  <scxml ...>

    <datamodel>
      <data name="beenInC" expr="false"/>
    </datamodel>

    <state id="C">
      <onentry>
        <assign name="beenInC" expr="true"/>
      </onentry>
      ...
    </state>

    ...

  </scxml>

-Rahul


>
> Best Regards
>
> //Linda
>

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


Mime
View raw message