SimpleClassDiagram.pattern.metamodel 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  1. {
  2. "types": {
  3. "__pClass": [
  4. {
  5. "name": "__pLabel",
  6. "type": "string",
  7. "default": ""
  8. },
  9. {
  10. "name": "__pMatchSubtypes",
  11. "type": "boolean",
  12. "default": false
  13. },
  14. {
  15. "name": "name",
  16. "type": "code",
  17. "default": "getAttr()"
  18. },
  19. {
  20. "name": "attributes",
  21. "type": "code",
  22. "default": "getAttr()"
  23. },
  24. {
  25. "name": "constraints",
  26. "type": "code",
  27. "default": "getAttr()"
  28. },
  29. {
  30. "name": "actions",
  31. "type": "code",
  32. "default": "getAttr()"
  33. },
  34. {
  35. "name": "cardinalities",
  36. "type": "code",
  37. "default": "getAttr()"
  38. },
  39. {
  40. "name": "abstract",
  41. "type": "code",
  42. "default": "getAttr()"
  43. }
  44. ],
  45. "__pGlobalConstraint": [
  46. {
  47. "name": "__pLabel",
  48. "type": "string",
  49. "default": ""
  50. },
  51. {
  52. "name": "__pMatchSubtypes",
  53. "type": "boolean",
  54. "default": false
  55. },
  56. {
  57. "name": "name",
  58. "type": "code",
  59. "default": "getAttr()"
  60. },
  61. {
  62. "name": "event",
  63. "type": "code",
  64. "default": "getAttr()"
  65. },
  66. {
  67. "name": "code",
  68. "type": "code",
  69. "default": "getAttr()"
  70. }
  71. ],
  72. "__pGlobalAction": [
  73. {
  74. "name": "__pLabel",
  75. "type": "string",
  76. "default": ""
  77. },
  78. {
  79. "name": "__pMatchSubtypes",
  80. "type": "boolean",
  81. "default": false
  82. },
  83. {
  84. "name": "name",
  85. "type": "code",
  86. "default": "getAttr()"
  87. },
  88. {
  89. "name": "event",
  90. "type": "code",
  91. "default": "getAttr()"
  92. },
  93. {
  94. "name": "code",
  95. "type": "code",
  96. "default": "getAttr()"
  97. }
  98. ],
  99. "__pAssociation": [
  100. {
  101. "name": "__pLabel",
  102. "type": "string",
  103. "default": ""
  104. },
  105. {
  106. "name": "__pMatchSubtypes",
  107. "type": "boolean",
  108. "default": false
  109. },
  110. {
  111. "name": "name",
  112. "type": "code",
  113. "default": "getAttr()"
  114. },
  115. {
  116. "name": "attributes",
  117. "type": "code",
  118. "default": "getAttr()"
  119. },
  120. {
  121. "name": "constraints",
  122. "type": "code",
  123. "default": "getAttr()"
  124. },
  125. {
  126. "name": "actions",
  127. "type": "code",
  128. "default": "getAttr()"
  129. },
  130. {
  131. "name": "cardinalities",
  132. "type": "code",
  133. "default": "getAttr()"
  134. },
  135. {
  136. "name": "linktype",
  137. "type": "code",
  138. "default": "getAttr()"
  139. }
  140. ],
  141. "__pInheritance": [
  142. {
  143. "name": "__pLabel",
  144. "type": "string",
  145. "default": ""
  146. },
  147. {
  148. "name": "__pMatchSubtypes",
  149. "type": "boolean",
  150. "default": false
  151. }
  152. ]
  153. },
  154. "constraints": [
  155. {
  156. "name": "noInheritanceLoops",
  157. "event": "post-create",
  158. "code": "/* comment next line to enable this constraint */\nthrow \"IgnoredConstraint\"\n/*newline*/var mm = '/Formalisms/__LanguageSyntax__/SimpleClassDiagram/SimpleClassDiagram/',/*newline*/ nout = getNeighbors('>',mm+'Class'),/*newline*/ visited = [];/*newline*/function dfs(to_visit)/*newline*/{/*newline*/ var curr = to_visit.pop();/*newline*/ if( curr == undefined )/*newline*/ return true;/*newline*/ else if( visited.indexOf(curr) > -1 )/*newline*/ return false;/*newline*/ else/*newline*/ {/*newline*/ visited.push(curr);/*newline*/ var ntype = (getAttr('$type',curr) == mm+'Class' ? /*newline*/ mm+'Inheritance' : mm+'Class');/*newline*/ return dfs( to_visit.concat(getNeighbors('>',ntype,curr)) );/*newline*/ }/*newline*/}/*newline*/dfs(nout);",
  159. "targetType": "Inheritance"
  160. }
  161. ],
  162. "actions": [
  163. {
  164. "name": "distinctPLabels",
  165. "event": "post-create",
  166. "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}",
  167. "targetType": "*"
  168. }
  169. ],
  170. "cardinalities": {
  171. "__pClass": [
  172. {
  173. "dir": "out",
  174. "type": "__pAssociation",
  175. "min": 0,
  176. "max": "Infinity"
  177. },
  178. {
  179. "dir": "in",
  180. "type": "__pAssociation",
  181. "min": 0,
  182. "max": "Infinity"
  183. },
  184. {
  185. "dir": "out",
  186. "type": "__pInheritance",
  187. "min": 0,
  188. "max": "Infinity"
  189. },
  190. {
  191. "dir": "in",
  192. "type": "__pInheritance",
  193. "min": 0,
  194. "max": "Infinity"
  195. }
  196. ],
  197. "__pGlobalConstraint": [],
  198. "__pGlobalAction": [],
  199. "__pAssociation": [
  200. {
  201. "dir": "in",
  202. "type": "__pClass",
  203. "min": 0,
  204. "max": "1"
  205. },
  206. {
  207. "dir": "out",
  208. "type": "__pClass",
  209. "min": 0,
  210. "max": "1"
  211. }
  212. ],
  213. "__pInheritance": [
  214. {
  215. "dir": "in",
  216. "type": "__pClass",
  217. "min": 0,
  218. "max": "1"
  219. },
  220. {
  221. "dir": "out",
  222. "type": "__pClass",
  223. "min": 0,
  224. "max": "1"
  225. }
  226. ]
  227. },
  228. "legalConnections": {
  229. "__pClass": {
  230. "__pClass": [
  231. "__pAssociation",
  232. "__pInheritance"
  233. ]
  234. }
  235. },
  236. "connectorTypes": {
  237. "__pAssociation": "visual",
  238. "__pInheritance": "visual"
  239. },
  240. "types2parentTypes": {
  241. "__pClass": [],
  242. "__pGlobalConstraint": [],
  243. "__pGlobalAction": [],
  244. "__pAssociation": [],
  245. "__pInheritance": []
  246. }
  247. }