statechart_fig20_invar.xml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. <param type="int"/>
  15. <param type="int"/>
  16. </event>
  17. </outport>
  18. <root initial="Invar">
  19. <parallel id="Invar">
  20. <state id="I1" initial="S1">
  21. <state id="S1">
  22. <transition target="../S2">
  23. <code> b = 2 * b; </code>
  24. </transition>
  25. </state>
  26. <state id="S2">
  27. <transition target="../S3">
  28. <code> b = 2 * a + b; </code>
  29. </transition>
  30. </state>
  31. <state id="S3"/>
  32. </state>
  33. <state id="I2" initial="S4">
  34. <state id="S4">
  35. <transition target="../S5">
  36. <code> a = a + b; </code>
  37. </transition>
  38. </state>
  39. <state id="S5">
  40. <transition target="../S6">
  41. <code> a = 3 * a; </code>
  42. </transition>
  43. </state>
  44. <state id="S6">
  45. <transition cond='@in("/Invar/I1/S3")' target="/Done"/>
  46. </state>
  47. </state>
  48. </parallel>
  49. <!-- 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 -->
  50. <state id="Done">
  51. <onentry>
  52. <raise port="out" event="done">
  53. <param expr="a"/>
  54. <param expr="b"/>
  55. </raise>
  56. </onentry>
  57. </state>
  58. </root>
  59. </statechart>