statechart_fig20_invar.xml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?xml version="1.0" ?>
  2. <statechart>
  3. <semantics
  4. big_step_maximality="take_many"/>
  5. <datamodel>
  6. a = 7;
  7. b = 2;
  8. </datamodel>
  9. <inport name="in">
  10. <event name="start"/>
  11. </inport>
  12. <outport name="out">
  13. <event name="done"/>
  14. </outport>
  15. <root initial="Invar">
  16. <parallel id="Invar">
  17. <state id="I1" initial="S1">
  18. <state id="S1">
  19. <transition target="../S2">
  20. <code> b = 2 * b; </code>
  21. </transition>
  22. </state>
  23. <state id="S2">
  24. <transition target="../S3">
  25. <code> b = 2 * a + b; </code>
  26. </transition>
  27. </state>
  28. <state id="S3"/>
  29. </state>
  30. <state id="I2" initial="S4">
  31. <state id="S4">
  32. <transition target="../S5">
  33. <code> a = a + b; </code>
  34. </transition>
  35. </state>
  36. <state id="S5">
  37. <transition target="../S6">
  38. <code> a = 3 * a; </code>
  39. </transition>
  40. </state>
  41. <state id="S6">
  42. <transition cond='@in("/Invar/I1/S3")' target="/Done"/>
  43. </state>
  44. </state>
  45. </parallel>
  46. <!-- this state is not in the example, but we introduce it to allow a final transition with output event the values of a and b -->
  47. <state id="Done">
  48. <onentry>
  49. <raise port="out" event="done">
  50. <param expr="a"/>
  51. <param expr="b"/>
  52. </raise>
  53. </onentry>
  54. </state>
  55. </root>
  56. </statechart>