TrainDoor.pattern.metamodel 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  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. "__pOpen": [
  31. {
  32. "name": "__pLabel",
  33. "type": "string",
  34. "default": ""
  35. },
  36. {
  37. "name": "__pPivotIn",
  38. "type": "string",
  39. "default": ""
  40. },
  41. {
  42. "name": "__pPivotOut",
  43. "type": "string",
  44. "default": ""
  45. },
  46. {
  47. "name": "__pMatchSubtypes",
  48. "type": "boolean",
  49. "default": false
  50. },
  51. {
  52. "name": "name",
  53. "type": "code",
  54. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  55. }
  56. ],
  57. "__pClosed": [
  58. {
  59. "name": "__pLabel",
  60. "type": "string",
  61. "default": ""
  62. },
  63. {
  64. "name": "__pPivotIn",
  65. "type": "string",
  66. "default": ""
  67. },
  68. {
  69. "name": "__pPivotOut",
  70. "type": "string",
  71. "default": ""
  72. },
  73. {
  74. "name": "__pMatchSubtypes",
  75. "type": "boolean",
  76. "default": false
  77. },
  78. {
  79. "name": "name",
  80. "type": "code",
  81. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  82. }
  83. ],
  84. "__pTransition": [
  85. {
  86. "name": "__pLabel",
  87. "type": "string",
  88. "default": ""
  89. },
  90. {
  91. "name": "__pPivotIn",
  92. "type": "string",
  93. "default": ""
  94. },
  95. {
  96. "name": "__pPivotOut",
  97. "type": "string",
  98. "default": ""
  99. },
  100. {
  101. "name": "__pMatchSubtypes",
  102. "type": "boolean",
  103. "default": false
  104. },
  105. {
  106. "name": "condition",
  107. "type": "code",
  108. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  109. },
  110. {
  111. "name": "event",
  112. "type": "code",
  113. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  114. }
  115. ]
  116. },
  117. "constraints": [
  118. {
  119. "name": "noAbstractInstances",
  120. "event": "pre-create",
  121. "code": "/* comment next line to enable this constraint */\nthrow \"IgnoredConstraint\"\nfalse",
  122. "targetType": "State"
  123. }
  124. ],
  125. "actions": [
  126. {
  127. "name": "distinctPLabels",
  128. "event": "post-create",
  129. "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}",
  130. "targetType": "*"
  131. }
  132. ],
  133. "cardinalities": {
  134. "__pState": [
  135. {
  136. "dir": "out",
  137. "type": "__pTransition",
  138. "min": 0,
  139. "max": "Infinity"
  140. },
  141. {
  142. "dir": "in",
  143. "type": "__pTransition",
  144. "min": 0,
  145. "max": "Infinity"
  146. }
  147. ],
  148. "__pOpen": [
  149. {
  150. "dir": "out",
  151. "type": "__pTransition",
  152. "min": 0,
  153. "max": "Infinity"
  154. },
  155. {
  156. "dir": "in",
  157. "type": "__pTransition",
  158. "min": 0,
  159. "max": "Infinity"
  160. }
  161. ],
  162. "__pClosed": [
  163. {
  164. "dir": "out",
  165. "type": "__pTransition",
  166. "min": 0,
  167. "max": "Infinity"
  168. },
  169. {
  170. "dir": "in",
  171. "type": "__pTransition",
  172. "min": 0,
  173. "max": "Infinity"
  174. }
  175. ],
  176. "__pTransition": [
  177. {
  178. "dir": "in",
  179. "type": "__pState",
  180. "min": 0,
  181. "max": "1"
  182. },
  183. {
  184. "dir": "out",
  185. "type": "__pState",
  186. "min": 0,
  187. "max": "1"
  188. },
  189. {
  190. "dir": "in",
  191. "type": "__pOpen",
  192. "min": 0,
  193. "max": "1"
  194. },
  195. {
  196. "dir": "out",
  197. "type": "__pOpen",
  198. "min": 0,
  199. "max": "1"
  200. },
  201. {
  202. "dir": "in",
  203. "type": "__pClosed",
  204. "min": 0,
  205. "max": "1"
  206. },
  207. {
  208. "dir": "out",
  209. "type": "__pClosed",
  210. "min": 0,
  211. "max": "1"
  212. }
  213. ]
  214. },
  215. "legalConnections": {
  216. "__pState": {
  217. "__pState": [
  218. "__pTransition"
  219. ],
  220. "__pOpen": [
  221. "__pTransition"
  222. ],
  223. "__pClosed": [
  224. "__pTransition"
  225. ]
  226. },
  227. "__pOpen": {
  228. "__pState": [
  229. "__pTransition"
  230. ],
  231. "__pOpen": [
  232. "__pTransition"
  233. ],
  234. "__pClosed": [
  235. "__pTransition"
  236. ]
  237. },
  238. "__pClosed": {
  239. "__pState": [
  240. "__pTransition"
  241. ],
  242. "__pOpen": [
  243. "__pTransition"
  244. ],
  245. "__pClosed": [
  246. "__pTransition"
  247. ]
  248. }
  249. },
  250. "connectorTypes": {
  251. "__pTransition": "visual"
  252. },
  253. "types2parentTypes": {
  254. "__pState": [],
  255. "__pOpen": [
  256. "__pState"
  257. ],
  258. "__pClosed": [
  259. "__pState"
  260. ],
  261. "__pTransition": []
  262. }
  263. }