TrafficLight.metamodel 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. {
  2. "types": {
  3. "State": [
  4. {
  5. "name": "name",
  6. "type": "string",
  7. "default": ""
  8. },
  9. {
  10. "name": "initial",
  11. "type": "boolean",
  12. "default": false
  13. },
  14. {
  15. "name": "current",
  16. "type": "boolean",
  17. "default": false
  18. }
  19. ],
  20. "Interrupt": [
  21. {
  22. "name": "at",
  23. "type": "int",
  24. "default": 0
  25. },
  26. {
  27. "name": "event",
  28. "type": "string",
  29. "default": "E"
  30. },
  31. {
  32. "name": "current",
  33. "type": "boolean",
  34. "default": false
  35. }
  36. ],
  37. "TimedTransition": [
  38. {
  39. "name": "after",
  40. "type": "int",
  41. "default": 0
  42. }
  43. ],
  44. "InterruptTransition": [
  45. {
  46. "name": "interrupt",
  47. "type": "string",
  48. "default": "E"
  49. }
  50. ],
  51. "Time": [
  52. {
  53. "name": "clock",
  54. "type": "int",
  55. "default": 0
  56. }
  57. ],
  58. "AbstractInterrupt": [
  59. {
  60. "name": "current",
  61. "type": "boolean",
  62. "default": false
  63. }
  64. ],
  65. "Next": [],
  66. "End": [
  67. {
  68. "name": "current",
  69. "type": "boolean",
  70. "default": false
  71. }
  72. ],
  73. "Visualisation": [
  74. {
  75. "name": "red",
  76. "type": "boolean",
  77. "default": false
  78. },
  79. {
  80. "name": "yellow",
  81. "type": "boolean",
  82. "default": false
  83. },
  84. {
  85. "name": "green",
  86. "type": "boolean",
  87. "default": false
  88. }
  89. ],
  90. "VisualisedBy": []
  91. },
  92. "constraints": [
  93. {
  94. "name": "max-one-instance",
  95. "event": "pre-create",
  96. "code": "getAllNodes(['/Formalisms/TrafficLight/TrafficLight/Time']).length == 0",
  97. "targetType": "Time"
  98. },
  99. {
  100. "name": "noAbstractInstances",
  101. "event": "pre-create",
  102. "code": "false",
  103. "targetType": "AbstractInterrupt"
  104. },
  105. {
  106. "name": "one-time-instance",
  107. "event": "",
  108. "targetType": "*",
  109. "code": "var time_instances = getAllNodes(['/Formalisms/TrafficLight/TrafficLight/Time']);\ntime_instances.length == 1"
  110. }
  111. ],
  112. "actions": [
  113. {
  114. "name": "set-clock",
  115. "event": "post-create",
  116. "code": "setAttr('clock', 1)",
  117. "targetType": "Time"
  118. },
  119. {
  120. "name": "set-clock",
  121. "event": "post-create",
  122. "targetType": "*",
  123. "code": "var instances = getAllNodes(['/Formalisms/TrafficLight/TrafficLight/Time']);\nconsole.log(instances.length);\nif (instances.length) {\n setAttr('clock', 0, instances[0]);\n}"
  124. }
  125. ],
  126. "cardinalities": {
  127. "State": [
  128. {
  129. "dir": "out",
  130. "type": "TimedTransition",
  131. "min": 0,
  132. "max": 1
  133. },
  134. {
  135. "dir": "out",
  136. "type": "VisualisedBy",
  137. "min": 1,
  138. "max": 1
  139. },
  140. {
  141. "dir": "in",
  142. "type": "TimedTransition",
  143. "min": "0",
  144. "max": "Infinity"
  145. },
  146. {
  147. "dir": "out",
  148. "type": "InterruptTransition",
  149. "min": "0",
  150. "max": "Infinity"
  151. },
  152. {
  153. "dir": "in",
  154. "type": "InterruptTransition",
  155. "min": "0",
  156. "max": "Infinity"
  157. }
  158. ],
  159. "Interrupt": [
  160. {
  161. "dir": "out",
  162. "type": "Next",
  163. "min": "0",
  164. "max": "1"
  165. },
  166. {
  167. "dir": "in",
  168. "type": "Next",
  169. "min": "0",
  170. "max": "1"
  171. }
  172. ],
  173. "TimedTransition": [
  174. {
  175. "dir": "in",
  176. "type": "State",
  177. "min": "0",
  178. "max": "1"
  179. },
  180. {
  181. "dir": "out",
  182. "type": "State",
  183. "min": "0",
  184. "max": "1"
  185. }
  186. ],
  187. "InterruptTransition": [
  188. {
  189. "dir": "in",
  190. "type": "State",
  191. "min": "0",
  192. "max": "1"
  193. },
  194. {
  195. "dir": "out",
  196. "type": "State",
  197. "min": "0",
  198. "max": "1"
  199. }
  200. ],
  201. "Time": [],
  202. "AbstractInterrupt": [
  203. {
  204. "dir": "in",
  205. "type": "Next",
  206. "min": "0",
  207. "max": "1"
  208. }
  209. ],
  210. "Next": [
  211. {
  212. "dir": "in",
  213. "type": "Interrupt",
  214. "min": "0",
  215. "max": "1"
  216. },
  217. {
  218. "dir": "out",
  219. "type": "AbstractInterrupt",
  220. "min": "0",
  221. "max": "1"
  222. },
  223. {
  224. "dir": "out",
  225. "type": "Interrupt",
  226. "min": "0",
  227. "max": "1"
  228. },
  229. {
  230. "dir": "out",
  231. "type": "End",
  232. "min": "0",
  233. "max": "1"
  234. }
  235. ],
  236. "End": [
  237. {
  238. "dir": "in",
  239. "type": "Next",
  240. "min": "0",
  241. "max": "1"
  242. }
  243. ],
  244. "Visualisation": [
  245. {
  246. "dir": "in",
  247. "type": "VisualisedBy",
  248. "min": "0",
  249. "max": "Infinity"
  250. }
  251. ],
  252. "VisualisedBy": [
  253. {
  254. "dir": "in",
  255. "type": "State",
  256. "min": "0",
  257. "max": "1"
  258. },
  259. {
  260. "dir": "out",
  261. "type": "Visualisation",
  262. "min": "0",
  263. "max": "1"
  264. }
  265. ]
  266. },
  267. "legalConnections": {
  268. "State": {
  269. "State": [
  270. "TimedTransition",
  271. "InterruptTransition"
  272. ],
  273. "Visualisation": [
  274. "VisualisedBy"
  275. ]
  276. },
  277. "Interrupt": {
  278. "AbstractInterrupt": [
  279. "Next"
  280. ],
  281. "Interrupt": [
  282. "Next"
  283. ],
  284. "End": [
  285. "Next"
  286. ]
  287. }
  288. },
  289. "connectorTypes": {
  290. "TimedTransition": "visual",
  291. "InterruptTransition": "visual",
  292. "Next": "visual",
  293. "VisualisedBy": "visual"
  294. },
  295. "types2parentTypes": {
  296. "State": [],
  297. "Interrupt": [
  298. "AbstractInterrupt"
  299. ],
  300. "TimedTransition": [],
  301. "InterruptTransition": [],
  302. "Time": [],
  303. "AbstractInterrupt": [],
  304. "Next": [],
  305. "End": [
  306. "AbstractInterrupt"
  307. ],
  308. "Visualisation": [],
  309. "VisualisedBy": [],
  310. "one-time-instance": [],
  311. "set-clock": []
  312. }
  313. }