minimal_SCCD.mvc 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. onEntryScript = $
  33. Void function entry(attributes : Element):
  34. log("ENTRY xa")
  35. return!
  36. $
  37. onExitScript = $
  38. Void function exit(attributes : Element):
  39. log("EXIT xa")
  40. return!
  41. $
  42. }
  43. {composite_children} BasicState x_b {
  44. name = "xb"
  45. isInitial = False
  46. onEntryScript = $
  47. Void function entry(attributes : Element):
  48. log("ENTRY xb")
  49. return!
  50. $
  51. onExitScript = $
  52. Void function exit(attributes : Element):
  53. log("EXIT xb")
  54. return!
  55. $
  56. }
  57. {composite_children} BasicState x_c {
  58. name = "xc"
  59. isInitial = False
  60. }
  61. {composite_children} BasicState x_d {
  62. name = "xd"
  63. isInitial = False
  64. }
  65. }
  66. {parallel_children} CompositeState parallel_y {
  67. {composite_children} BasicState y_a {
  68. name = "ya"
  69. isInitial = True
  70. }
  71. {composite_children} BasicState y_b {
  72. name = "yb"
  73. isInitial = False
  74. }
  75. }
  76. }
  77. }
  78. transition (x_a, x_b) {
  79. name = "X"
  80. event = "X"
  81. script = $
  82. Void function script(attributes : Element):
  83. log("In script")
  84. dict_overwrite(attributes, "a", 1)
  85. dict_overwrite(attributes, "b", 2)
  86. return!
  87. $
  88. }
  89. transition (x_a, x_d) {
  90. name = "timeout"
  91. after = $
  92. Float function after(attributes : Element):
  93. log("In after")
  94. return 3.0!
  95. $
  96. }
  97. transition (x_b, x_c) {
  98. name = "Z"
  99. cond = $
  100. Boolean function cond(attributes : Element):
  101. log("In condition")
  102. return integer_lt(attributes["a"], attributes["b"])!
  103. $
  104. }
  105. transition (y_a, y_b) {
  106. name = "Y"
  107. event = "Y"
  108. }
  109. transition (init, main_parallel) {
  110. name = "init"
  111. event = "init"
  112. }
  113. diagram_classes (my_SCCD, main) {}
  114. behaviour (main, main_statechart) {}