FileSystem.pattern.metamodel 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. {
  2. "types": {
  3. "__pFolder": [
  4. {
  5. "name": "__pLabel",
  6. "type": "string",
  7. "default": ""
  8. },
  9. {
  10. "name": "__pMatchSubtypes",
  11. "type": "boolean",
  12. "default": false
  13. },
  14. {
  15. "name": "path",
  16. "type": "code",
  17. "default": "getAttr()"
  18. }
  19. ],
  20. "__pFile": [
  21. {
  22. "name": "__pLabel",
  23. "type": "string",
  24. "default": ""
  25. },
  26. {
  27. "name": "__pMatchSubtypes",
  28. "type": "boolean",
  29. "default": false
  30. },
  31. {
  32. "name": "content",
  33. "type": "code",
  34. "default": "getAttr()"
  35. },
  36. {
  37. "name": "path",
  38. "type": "code",
  39. "default": "getAttr()"
  40. }
  41. ],
  42. "__pFSEntity": [
  43. {
  44. "name": "__pLabel",
  45. "type": "string",
  46. "default": ""
  47. },
  48. {
  49. "name": "__pMatchSubtypes",
  50. "type": "boolean",
  51. "default": false
  52. },
  53. {
  54. "name": "path",
  55. "type": "code",
  56. "default": "getAttr()"
  57. }
  58. ],
  59. "__pContains": [
  60. {
  61. "name": "__pLabel",
  62. "type": "string",
  63. "default": ""
  64. },
  65. {
  66. "name": "__pMatchSubtypes",
  67. "type": "boolean",
  68. "default": false
  69. }
  70. ]
  71. },
  72. "constraints": [
  73. {
  74. "name": "noAbstractInstances",
  75. "event": "pre-create",
  76. "code": "/* comment next line to enable this constraint */\nthrow \"IgnoredConstraint\"\nfalse",
  77. "targetType": "FSEntity"
  78. }
  79. ],
  80. "actions": [
  81. {
  82. "name": "distinctPLabels",
  83. "event": "post-create",
  84. "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}",
  85. "targetType": "*"
  86. }
  87. ],
  88. "cardinalities": {
  89. "__pFolder": [
  90. {
  91. "dir": "out",
  92. "type": "__pContains",
  93. "min": 0,
  94. "max": "Infinity"
  95. },
  96. {
  97. "dir": "in",
  98. "type": "__pContains",
  99. "min": 0,
  100. "max": "Infinity"
  101. }
  102. ],
  103. "__pFile": [
  104. {
  105. "dir": "in",
  106. "type": "__pContains",
  107. "min": 0,
  108. "max": "Infinity"
  109. }
  110. ],
  111. "__pFSEntity": [
  112. {
  113. "dir": "in",
  114. "type": "__pContains",
  115. "min": 0,
  116. "max": "Infinity"
  117. }
  118. ],
  119. "__pContains": [
  120. {
  121. "dir": "in",
  122. "type": "__pFolder",
  123. "min": 0,
  124. "max": "1"
  125. },
  126. {
  127. "dir": "out",
  128. "type": "__pFSEntity",
  129. "min": 0,
  130. "max": "1"
  131. },
  132. {
  133. "dir": "out",
  134. "type": "__pFolder",
  135. "min": 0,
  136. "max": "1"
  137. },
  138. {
  139. "dir": "out",
  140. "type": "__pFile",
  141. "min": 0,
  142. "max": "1"
  143. }
  144. ]
  145. },
  146. "legalConnections": {
  147. "__pFolder": {
  148. "__pFSEntity": [
  149. "__pContains"
  150. ],
  151. "__pFolder": [
  152. "__pContains"
  153. ],
  154. "__pFile": [
  155. "__pContains"
  156. ]
  157. }
  158. },
  159. "connectorTypes": {
  160. "__pContains": "containment"
  161. },
  162. "types2parentTypes": {
  163. "__pFolder": [
  164. "__pFSEntity"
  165. ],
  166. "__pFile": [
  167. "__pFSEntity"
  168. ],
  169. "__pFSEntity": [],
  170. "__pContains": []
  171. }
  172. }