<?xml version="1.0" ?>
<statechart>
  <datamodel>
    i = 0;
  </datamodel>

  <inport name="in">
    <event name="e"/>
  </inport>

  <outport name="out">
    <event name="inc"/>
    <event name="done"/>
  </outport>

  <root>
    <parallel id="p">
      <state id="increment">
        <state id="a">
          <transition event="e" target="." cond='not INSTATE(["/p/status/done"])'>
            <raise event="inc"/>
            <code> i += 1; </code>
          </transition>
        </state>
      </state>

      <state id="status" initial="counting">
        <state id="counting">
          <transition cond="i == 2" target="../done"/>
        </state>
        <state id="done">
          <onentry>
            <raise event="done"/>
          </onentry>
        </state>
      </state>
    </parallel>
  </root>
</statechart>
