TrafficLight.pattern.metamodel 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. {
  2. "types": {
  3. "__pState": [
  4. {
  5. "name": "__pLabel",
  6. "type": "string",
  7. "default": ""
  8. },
  9. {
  10. "name": "__pPivotIn",
  11. "type": "string",
  12. "default": ""
  13. },
  14. {
  15. "name": "__pPivotOut",
  16. "type": "string",
  17. "default": ""
  18. },
  19. {
  20. "name": "__pMatchSubtypes",
  21. "type": "boolean",
  22. "default": false
  23. },
  24. {
  25. "name": "name",
  26. "type": "code",
  27. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  28. },
  29. {
  30. "name": "initial",
  31. "type": "code",
  32. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  33. },
  34. {
  35. "name": "current",
  36. "type": "code",
  37. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  38. }
  39. ],
  40. "__pInterrupt": [
  41. {
  42. "name": "__pLabel",
  43. "type": "string",
  44. "default": ""
  45. },
  46. {
  47. "name": "__pPivotIn",
  48. "type": "string",
  49. "default": ""
  50. },
  51. {
  52. "name": "__pPivotOut",
  53. "type": "string",
  54. "default": ""
  55. },
  56. {
  57. "name": "__pMatchSubtypes",
  58. "type": "boolean",
  59. "default": false
  60. },
  61. {
  62. "name": "at",
  63. "type": "code",
  64. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  65. },
  66. {
  67. "name": "event",
  68. "type": "code",
  69. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  70. },
  71. {
  72. "name": "current",
  73. "type": "code",
  74. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  75. }
  76. ],
  77. "__pTimedTransition": [
  78. {
  79. "name": "__pLabel",
  80. "type": "string",
  81. "default": ""
  82. },
  83. {
  84. "name": "__pPivotIn",
  85. "type": "string",
  86. "default": ""
  87. },
  88. {
  89. "name": "__pPivotOut",
  90. "type": "string",
  91. "default": ""
  92. },
  93. {
  94. "name": "__pMatchSubtypes",
  95. "type": "boolean",
  96. "default": false
  97. },
  98. {
  99. "name": "after",
  100. "type": "code",
  101. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  102. }
  103. ],
  104. "__pInterruptTransition": [
  105. {
  106. "name": "__pLabel",
  107. "type": "string",
  108. "default": ""
  109. },
  110. {
  111. "name": "__pPivotIn",
  112. "type": "string",
  113. "default": ""
  114. },
  115. {
  116. "name": "__pPivotOut",
  117. "type": "string",
  118. "default": ""
  119. },
  120. {
  121. "name": "__pMatchSubtypes",
  122. "type": "boolean",
  123. "default": false
  124. },
  125. {
  126. "name": "interrupt",
  127. "type": "code",
  128. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  129. }
  130. ],
  131. "__pTime": [
  132. {
  133. "name": "__pLabel",
  134. "type": "string",
  135. "default": ""
  136. },
  137. {
  138. "name": "__pPivotIn",
  139. "type": "string",
  140. "default": ""
  141. },
  142. {
  143. "name": "__pPivotOut",
  144. "type": "string",
  145. "default": ""
  146. },
  147. {
  148. "name": "__pMatchSubtypes",
  149. "type": "boolean",
  150. "default": false
  151. },
  152. {
  153. "name": "clock",
  154. "type": "code",
  155. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  156. }
  157. ],
  158. "__pAbstractInterrupt": [
  159. {
  160. "name": "__pLabel",
  161. "type": "string",
  162. "default": ""
  163. },
  164. {
  165. "name": "__pPivotIn",
  166. "type": "string",
  167. "default": ""
  168. },
  169. {
  170. "name": "__pPivotOut",
  171. "type": "string",
  172. "default": ""
  173. },
  174. {
  175. "name": "__pMatchSubtypes",
  176. "type": "boolean",
  177. "default": false
  178. },
  179. {
  180. "name": "current",
  181. "type": "code",
  182. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  183. }
  184. ],
  185. "__pNext": [
  186. {
  187. "name": "__pLabel",
  188. "type": "string",
  189. "default": ""
  190. },
  191. {
  192. "name": "__pPivotIn",
  193. "type": "string",
  194. "default": ""
  195. },
  196. {
  197. "name": "__pPivotOut",
  198. "type": "string",
  199. "default": ""
  200. },
  201. {
  202. "name": "__pMatchSubtypes",
  203. "type": "boolean",
  204. "default": false
  205. }
  206. ],
  207. "__pEnd": [
  208. {
  209. "name": "__pLabel",
  210. "type": "string",
  211. "default": ""
  212. },
  213. {
  214. "name": "__pPivotIn",
  215. "type": "string",
  216. "default": ""
  217. },
  218. {
  219. "name": "__pPivotOut",
  220. "type": "string",
  221. "default": ""
  222. },
  223. {
  224. "name": "__pMatchSubtypes",
  225. "type": "boolean",
  226. "default": false
  227. },
  228. {
  229. "name": "current",
  230. "type": "code",
  231. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  232. }
  233. ],
  234. "__pVisualisation": [
  235. {
  236. "name": "__pLabel",
  237. "type": "string",
  238. "default": ""
  239. },
  240. {
  241. "name": "__pPivotIn",
  242. "type": "string",
  243. "default": ""
  244. },
  245. {
  246. "name": "__pPivotOut",
  247. "type": "string",
  248. "default": ""
  249. },
  250. {
  251. "name": "__pMatchSubtypes",
  252. "type": "boolean",
  253. "default": false
  254. },
  255. {
  256. "name": "red",
  257. "type": "code",
  258. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  259. },
  260. {
  261. "name": "yellow",
  262. "type": "code",
  263. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  264. },
  265. {
  266. "name": "green",
  267. "type": "code",
  268. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  269. }
  270. ],
  271. "__pVisualisedBy": [
  272. {
  273. "name": "__pLabel",
  274. "type": "string",
  275. "default": ""
  276. },
  277. {
  278. "name": "__pPivotIn",
  279. "type": "string",
  280. "default": ""
  281. },
  282. {
  283. "name": "__pPivotOut",
  284. "type": "string",
  285. "default": ""
  286. },
  287. {
  288. "name": "__pMatchSubtypes",
  289. "type": "boolean",
  290. "default": false
  291. }
  292. ]
  293. },
  294. "constraints": [
  295. {
  296. "name": "noAbstractInstances",
  297. "event": "pre-create",
  298. "code": "/* comment next line to enable this constraint */\nthrow \"IgnoredConstraint\"\nfalse",
  299. "targetType": "AbstractInterrupt"
  300. }
  301. ],
  302. "actions": [
  303. {
  304. "name": "distinctPLabels",
  305. "event": "post-create",
  306. "code": "if( getAttr(\"__pLabel\") == \"\" )\n{\n\tvar pLabels = getAllNodes().\n\t\t\t\t\t\t\tfilter( function(n) {return hasAttr(\"__pLabel\",n);} ).\n\t\t\t\t\t\t\t\tmap( function(n) {return getAttr(\"__pLabel\",n);} ),\n\t\t i\t\t\t= \"0\";\n\n\twhile( _utils.contains(pLabels,i) )\n\t\ti = String(parseInt(i)+1);\n\tsetAttr(\"__pLabel\",i);\n}",
  307. "targetType": "*"
  308. }
  309. ],
  310. "cardinalities": {
  311. "__pState": [
  312. {
  313. "dir": ">",
  314. "type": "__pTimedTransition",
  315. "min": 0,
  316. "max": "1"
  317. },
  318. {
  319. "dir": ">",
  320. "type": "__pVisualisedBy",
  321. "min": 0,
  322. "max": "1"
  323. },
  324. {
  325. "dir": "out",
  326. "type": "__pTimedTransition",
  327. "min": 0,
  328. "max": "Infinity"
  329. },
  330. {
  331. "dir": "in",
  332. "type": "__pTimedTransition",
  333. "min": 0,
  334. "max": "Infinity"
  335. },
  336. {
  337. "dir": "out",
  338. "type": "__pInterruptTransition",
  339. "min": 0,
  340. "max": "Infinity"
  341. },
  342. {
  343. "dir": "in",
  344. "type": "__pInterruptTransition",
  345. "min": 0,
  346. "max": "Infinity"
  347. },
  348. {
  349. "dir": "out",
  350. "type": "__pVisualisedBy",
  351. "min": 0,
  352. "max": "Infinity"
  353. }
  354. ],
  355. "__pInterrupt": [
  356. {
  357. "dir": ">",
  358. "type": "__pNext",
  359. "min": 0,
  360. "max": "1"
  361. },
  362. {
  363. "dir": "<",
  364. "type": "__pNext",
  365. "min": 0,
  366. "max": "1"
  367. },
  368. {
  369. "dir": "out",
  370. "type": "__pNext",
  371. "min": 0,
  372. "max": "Infinity"
  373. },
  374. {
  375. "dir": "in",
  376. "type": "__pNext",
  377. "min": 0,
  378. "max": "Infinity"
  379. }
  380. ],
  381. "__pTimedTransition": [
  382. {
  383. "dir": "in",
  384. "type": "__pState",
  385. "min": 0,
  386. "max": "1"
  387. },
  388. {
  389. "dir": "out",
  390. "type": "__pState",
  391. "min": 0,
  392. "max": "1"
  393. }
  394. ],
  395. "__pInterruptTransition": [
  396. {
  397. "dir": "in",
  398. "type": "__pState",
  399. "min": 0,
  400. "max": "1"
  401. },
  402. {
  403. "dir": "out",
  404. "type": "__pState",
  405. "min": 0,
  406. "max": "1"
  407. }
  408. ],
  409. "__pTime": [],
  410. "__pAbstractInterrupt": [
  411. {
  412. "dir": "<",
  413. "type": "__pNext",
  414. "min": 0,
  415. "max": "1"
  416. },
  417. {
  418. "dir": "in",
  419. "type": "__pNext",
  420. "min": 0,
  421. "max": "Infinity"
  422. }
  423. ],
  424. "__pNext": [
  425. {
  426. "dir": "in",
  427. "type": "__pInterrupt",
  428. "min": 0,
  429. "max": "1"
  430. },
  431. {
  432. "dir": "out",
  433. "type": "__pAbstractInterrupt",
  434. "min": 0,
  435. "max": "1"
  436. },
  437. {
  438. "dir": "out",
  439. "type": "__pInterrupt",
  440. "min": 0,
  441. "max": "1"
  442. },
  443. {
  444. "dir": "out",
  445. "type": "__pEnd",
  446. "min": 0,
  447. "max": "1"
  448. }
  449. ],
  450. "__pEnd": [
  451. {
  452. "dir": "<",
  453. "type": "__pNext",
  454. "min": 0,
  455. "max": "1"
  456. },
  457. {
  458. "dir": "in",
  459. "type": "__pNext",
  460. "min": 0,
  461. "max": "Infinity"
  462. }
  463. ],
  464. "__pVisualisation": [
  465. {
  466. "dir": "in",
  467. "type": "__pVisualisedBy",
  468. "min": 0,
  469. "max": "Infinity"
  470. }
  471. ],
  472. "__pVisualisedBy": [
  473. {
  474. "dir": "in",
  475. "type": "__pState",
  476. "min": 0,
  477. "max": "1"
  478. },
  479. {
  480. "dir": "out",
  481. "type": "__pVisualisation",
  482. "min": 0,
  483. "max": "1"
  484. }
  485. ]
  486. },
  487. "legalConnections": {
  488. "__pState": {
  489. "__pState": [
  490. "__pTimedTransition",
  491. "__pInterruptTransition"
  492. ],
  493. "__pVisualisation": [
  494. "__pVisualisedBy"
  495. ]
  496. },
  497. "__pInterrupt": {
  498. "__pAbstractInterrupt": [
  499. "__pNext"
  500. ],
  501. "__pInterrupt": [
  502. "__pNext"
  503. ],
  504. "__pEnd": [
  505. "__pNext"
  506. ]
  507. }
  508. },
  509. "connectorTypes": {
  510. "__pTimedTransition": "visual",
  511. "__pInterruptTransition": "visual",
  512. "__pNext": "visual",
  513. "__pVisualisedBy": "visual"
  514. },
  515. "types2parentTypes": {
  516. "__pState": [],
  517. "__pInterrupt": [
  518. "__pAbstractInterrupt"
  519. ],
  520. "__pTimedTransition": [],
  521. "__pInterruptTransition": [],
  522. "__pTime": [],
  523. "__pAbstractInterrupt": [],
  524. "__pNext": [],
  525. "__pEnd": [
  526. "__pAbstractInterrupt"
  527. ],
  528. "__pVisualisation": [],
  529. "__pVisualisedBy": []
  530. }
  531. }