DiningRoom.pattern.metamodel 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. {
  2. "types": {
  3. "__pTable": [
  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": "x",
  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": "y",
  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. "__pChair": [
  36. {
  37. "name": "__pLabel",
  38. "type": "string",
  39. "default": ""
  40. },
  41. {
  42. "name": "__pPivotIn",
  43. "type": "string",
  44. "default": ""
  45. },
  46. {
  47. "name": "__pPivotOut",
  48. "type": "string",
  49. "default": ""
  50. },
  51. {
  52. "name": "__pMatchSubtypes",
  53. "type": "boolean",
  54. "default": false
  55. },
  56. {
  57. "name": "order",
  58. "type": "code",
  59. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  60. }
  61. ],
  62. "__paround": [
  63. {
  64. "name": "__pLabel",
  65. "type": "string",
  66. "default": ""
  67. },
  68. {
  69. "name": "__pPivotIn",
  70. "type": "string",
  71. "default": ""
  72. },
  73. {
  74. "name": "__pPivotOut",
  75. "type": "string",
  76. "default": ""
  77. },
  78. {
  79. "name": "__pMatchSubtypes",
  80. "type": "boolean",
  81. "default": false
  82. },
  83. {
  84. "name": "",
  85. "type": "code",
  86. "default": "\"[PYTHON]\"\n\"Example:\t result = True\"\n\"Example:\t result = getAttr()\"\n\n\"[JAVASCRIPT]\"\n\"Example:\t true\"\n\"Example:\t getAttr()\""
  87. }
  88. ]
  89. },
  90. "constraints": [
  91. {
  92. "name": "GC_UniqueTable",
  93. "event": "",
  94. "targetType": "*",
  95. "code": "/* comment next line to enable this constraint */\nthrow \"IgnoredConstraint\"\n(getAllNodes(['/Formalisms/DiningRoom/DiningRoom/Table']).length <= 1)"
  96. }
  97. ],
  98. "actions": [
  99. {
  100. "name": "distinctPLabels",
  101. "event": "post-create",
  102. "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}",
  103. "targetType": "*"
  104. }
  105. ],
  106. "cardinalities": {
  107. "__pTable": [
  108. {
  109. "dir": "out",
  110. "type": "__paround",
  111. "min": 0,
  112. "max": "Infinity"
  113. }
  114. ],
  115. "__pChair": [
  116. {
  117. "dir": "in",
  118. "type": "__paround",
  119. "min": 0,
  120. "max": "Infinity"
  121. }
  122. ],
  123. "__paround": [
  124. {
  125. "dir": "in",
  126. "type": "__paround",
  127. "min": 0,
  128. "max": "1"
  129. },
  130. {
  131. "dir": "in",
  132. "type": "__pTable",
  133. "min": 0,
  134. "max": "1"
  135. },
  136. {
  137. "dir": "out",
  138. "type": "__pChair",
  139. "min": 0,
  140. "max": "1"
  141. }
  142. ]
  143. },
  144. "legalConnections": {
  145. "__pTable": {
  146. "__pChair": [
  147. "__paround"
  148. ]
  149. }
  150. },
  151. "connectorTypes": {
  152. "__paround": "visual"
  153. },
  154. "types2parentTypes": {
  155. "__pTable": [],
  156. "__pChair": [],
  157. "__paround": [],
  158. "__pGC_UniqueTable": []
  159. }
  160. }