minimal_SCCD.mvc 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. include "primitives.alh"
  2. Diagram my_SCCD {
  3. name = "SimpleSCCD"
  4. author = "Yentl"
  5. }
  6. Class main {
  7. name = "Main"
  8. default = True
  9. }
  10. Attribute attr_a {
  11. name = "a"
  12. }
  13. Attribute attr_b {
  14. name = "b"
  15. }
  16. class_attributes (main, attr_a) {}
  17. class_attributes (main, attr_b) {}
  18. CompositeState main_statechart {
  19. name = "root"
  20. isInitial = True
  21. {composite_children} BasicState init {
  22. name = "initial"
  23. isInitial = True
  24. }
  25. {composite_children} ParallelState main_parallel {
  26. name = "parallel"
  27. isInitial = False
  28. {parallel_children} CompositeState parallel_x {
  29. {composite_children} BasicState x_a {
  30. name = "xa"
  31. isInitial = True
  32. }
  33. {composite_children} BasicState x_b {
  34. name = "xb"
  35. isInitial = False
  36. }
  37. {composite_children} BasicState x_c {
  38. name = "xc"
  39. isInitial = False
  40. }
  41. {composite_children} BasicState x_d {
  42. name = "xd"
  43. isInitial = False
  44. }
  45. }
  46. {parallel_children} CompositeState parallel_y {
  47. {composite_children} BasicState y_a {
  48. name = "ya"
  49. isInitial = True
  50. }
  51. {composite_children} BasicState y_b {
  52. name = "yb"
  53. isInitial = False
  54. }
  55. }
  56. }
  57. }
  58. transition (x_a, x_b) {
  59. name = "X"
  60. event = "X"
  61. script = $
  62. Void function script(attributes : Element):
  63. log("In script")
  64. dict_overwrite(attributes, "a", 1)
  65. dict_overwrite(attributes, "b", 2)
  66. return!
  67. $
  68. }
  69. transition (x_a, x_d) {
  70. name = "timeout"
  71. after = $
  72. Float function after(attributes : Element):
  73. log("In after")
  74. return 3.0!
  75. $
  76. }
  77. transition (x_b, x_c) {
  78. name = "Z"
  79. cond = $
  80. Boolean function cond(attributes : Element):
  81. log("In condition")
  82. return integer_lt(attributes["a"], attributes["b"])!
  83. $
  84. }
  85. transition (y_a, y_b) {
  86. name = "Y"
  87. event = "Y"
  88. }
  89. transition (init, main_parallel) {
  90. name = "init"
  91. event = "init"
  92. }
  93. diagram_classes (my_SCCD, main) {}
  94. behaviour (main, main_statechart) {}