UNPKG

awv3

Version:
1,560 lines 1.06 MB
{ "type": "Program", "body": [ { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportDefaultSpecifier", "local": { "type": "Identifier", "name": "Constraint", "range": [ 7, 17 ], "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } } }, "range": [ 7, 17 ], "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } } } ], "source": { "type": "Literal", "value": "../sketcher/constraint", "raw": "'../sketcher/constraint'", "range": [ 23, 47 ], "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 47 } } }, "range": [ 0, 48 ], "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 48 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportDefaultSpecifier", "local": { "type": "Identifier", "name": "Sketch", "range": [ 56, 62 ], "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } } }, "range": [ 56, 62 ], "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } } } ], "source": { "type": "Literal", "value": "../sketcher/sketch", "raw": "'../sketcher/sketch'", "range": [ 68, 88 ], "loc": { "start": { "line": 2, "column": 19 }, "end": { "line": 2, "column": 39 } } }, "range": [ 49, 89 ], "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 40 } } }, { "type": "ImportDeclaration", "specifiers": [ { "type": "ImportNamespaceSpecifier", "local": { "type": "Identifier", "name": "THREE", "range": [ 102, 107 ], "loc": { "start": { "line": 3, "column": 12 }, "end": { "line": 3, "column": 17 } } }, "range": [ 97, 107 ], "loc": { "start": { "line": 3, "column": 7 }, "end": { "line": 3, "column": 17 } } } ], "source": { "type": "Literal", "value": "three", "raw": "'three'", "range": [ 113, 120 ], "loc": { "start": { "line": 3, "column": 23 }, "end": { "line": 3, "column": 30 } } }, "range": [ 90, 121 ], "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 31 } }, "trailingComments": [ { "type": "Line", "value": "====================== Disjoint Set Union ========================", "range": [ 123, 191 ], "loc": { "start": { "line": 5, "column": 0 }, "end": { "line": 5, "column": 68 } } } ] }, { "type": "ExportNamedDeclaration", "declaration": { "type": "ClassDeclaration", "id": { "type": "Identifier", "name": "DSU", "range": [ 205, 208 ], "loc": { "start": { "line": 6, "column": 13 }, "end": { "line": 6, "column": 16 } } }, "superClass": null, "body": { "type": "ClassBody", "body": [ { "type": "MethodDefinition", "key": { "type": "Identifier", "name": "constructor", "range": [ 215, 226 ], "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 7, "column": 15 } } }, "value": { "type": "FunctionExpression", "id": null, "params": [], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "AssignmentExpression", "operator": "=", "left": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 239, 243 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 12 } } }, "property": { "type": "Identifier", "name": "parents", "range": [ 244, 251 ], "loc": { "start": { "line": 8, "column": 13 }, "end": { "line": 8, "column": 20 } } }, "range": [ 239, 251 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 20 } } }, "right": { "type": "NewExpression", "callee": { "type": "Identifier", "name": "Map", "range": [ 258, 261 ], "loc": { "start": { "line": 8, "column": 27 }, "end": { "line": 8, "column": 30 } } }, "arguments": [], "range": [ 254, 263 ], "loc": { "start": { "line": 8, "column": 23 }, "end": { "line": 8, "column": 32 } } }, "range": [ 239, 263 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 32 } } }, "range": [ 239, 264 ], "loc": { "start": { "line": 8, "column": 8 }, "end": { "line": 8, "column": 33 } } } ], "range": [ 229, 270 ], "loc": { "start": { "line": 7, "column": 18 }, "end": { "line": 9, "column": 5 } } }, "generator": false, "expression": false, "range": [ 226, 270 ], "loc": { "start": { "line": 7, "column": 15 }, "end": { "line": 9, "column": 5 } } }, "kind": "constructor", "computed": false, "range": [ 215, 270 ], "loc": { "start": { "line": 7, "column": 4 }, "end": { "line": 9, "column": 5 } }, "static": false }, { "type": "MethodDefinition", "key": { "type": "Identifier", "name": "getParent", "range": [ 276, 285 ], "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 11, "column": 13 } } }, "value": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "obj", "range": [ 286, 289 ], "loc": { "start": { "line": 11, "column": 14 }, "end": { "line": 11, "column": 17 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ReturnStatement", "argument": { "type": "LogicalExpression", "operator": "||", "left": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 308, 312 ], "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 19 } } }, "property": { "type": "Identifier", "name": "parents", "range": [ 313, 320 ], "loc": { "start": { "line": 12, "column": 20 }, "end": { "line": 12, "column": 27 } } }, "range": [ 308, 320 ], "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 27 } } }, "property": { "type": "Identifier", "name": "get", "range": [ 321, 324 ], "loc": { "start": { "line": 12, "column": 28 }, "end": { "line": 12, "column": 31 } } }, "range": [ 308, 324 ], "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 31 } } }, "arguments": [ { "type": "Identifier", "name": "obj", "range": [ 325, 328 ], "loc": { "start": { "line": 12, "column": 32 }, "end": { "line": 12, "column": 35 } } } ], "range": [ 308, 329 ], "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 36 } } }, "right": { "type": "Identifier", "name": "obj", "range": [ 333, 336 ], "loc": { "start": { "line": 12, "column": 40 }, "end": { "line": 12, "column": 43 } } }, "range": [ 308, 336 ], "loc": { "start": { "line": 12, "column": 15 }, "end": { "line": 12, "column": 43 } } }, "range": [ 301, 337 ], "loc": { "start": { "line": 12, "column": 8 }, "end": { "line": 12, "column": 44 } } } ], "range": [ 291, 343 ], "loc": { "start": { "line": 11, "column": 19 }, "end": { "line": 13, "column": 5 } } }, "generator": false, "expression": false, "range": [ 285, 343 ], "loc": { "start": { "line": 11, "column": 13 }, "end": { "line": 13, "column": 5 } } }, "kind": "method", "computed": false, "range": [ 276, 343 ], "loc": { "start": { "line": 11, "column": 4 }, "end": { "line": 13, "column": 5 } }, "static": false }, { "type": "MethodDefinition", "key": { "type": "Identifier", "name": "setParent", "range": [ 349, 358 ], "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 15, "column": 13 } } }, "value": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "obj", "range": [ 359, 362 ], "loc": { "start": { "line": 15, "column": 14 }, "end": { "line": 15, "column": 17 } } }, { "type": "Identifier", "name": "par", "range": [ 364, 367 ], "loc": { "start": { "line": 15, "column": 19 }, "end": { "line": 15, "column": 22 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 379, 383 ], "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 12 } } }, "property": { "type": "Identifier", "name": "parents", "range": [ 384, 391 ], "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 16, "column": 20 } } }, "range": [ 379, 391 ], "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 20 } } }, "property": { "type": "Identifier", "name": "set", "range": [ 392, 395 ], "loc": { "start": { "line": 16, "column": 21 }, "end": { "line": 16, "column": 24 } } }, "range": [ 379, 395 ], "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 24 } } }, "arguments": [ { "type": "Identifier", "name": "obj", "range": [ 396, 399 ], "loc": { "start": { "line": 16, "column": 25 }, "end": { "line": 16, "column": 28 } } }, { "type": "Identifier", "name": "par", "range": [ 401, 404 ], "loc": { "start": { "line": 16, "column": 30 }, "end": { "line": 16, "column": 33 } } } ], "range": [ 379, 405 ], "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 34 } } }, "range": [ 379, 406 ], "loc": { "start": { "line": 16, "column": 8 }, "end": { "line": 16, "column": 35 } } } ], "range": [ 369, 412 ], "loc": { "start": { "line": 15, "column": 24 }, "end": { "line": 17, "column": 5 } } }, "generator": false, "expression": false, "range": [ 358, 412 ], "loc": { "start": { "line": 15, "column": 13 }, "end": { "line": 17, "column": 5 } } }, "kind": "method", "computed": false, "range": [ 349, 412 ], "loc": { "start": { "line": 15, "column": 4 }, "end": { "line": 17, "column": 5 } }, "static": false }, { "type": "MethodDefinition", "key": { "type": "Identifier", "name": "touch", "range": [ 418, 423 ], "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 19, "column": 9 } } }, "value": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "obj", "range": [ 424, 427 ], "loc": { "start": { "line": 19, "column": 10 }, "end": { "line": 19, "column": 13 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "IfStatement", "test": { "type": "UnaryExpression", "operator": "!", "argument": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 444, 448 ], "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 17 } } }, "property": { "type": "Identifier", "name": "parents", "range": [ 449, 456 ], "loc": { "start": { "line": 20, "column": 18 }, "end": { "line": 20, "column": 25 } } }, "range": [ 444, 456 ], "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 25 } } }, "property": { "type": "Identifier", "name": "has", "range": [ 457, 460 ], "loc": { "start": { "line": 20, "column": 26 }, "end": { "line": 20, "column": 29 } } }, "range": [ 444, 460 ], "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 29 } } }, "arguments": [ { "type": "Identifier", "name": "obj", "range": [ 461, 464 ], "loc": { "start": { "line": 20, "column": 30 }, "end": { "line": 20, "column": 33 } } } ], "range": [ 444, 465 ], "loc": { "start": { "line": 20, "column": 13 }, "end": { "line": 20, "column": 34 } } }, "prefix": true, "range": [ 443, 465 ], "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 34 } } }, "consequent": { "type": "ExpressionStatement", "expression": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 479, 483 ], "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 16 } } }, "property": { "type": "Identifier", "name": "parents", "range": [ 484, 491 ], "loc": { "start": { "line": 21, "column": 17 }, "end": { "line": 21, "column": 24 } } }, "range": [ 479, 491 ], "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 24 } } }, "property": { "type": "Identifier", "name": "set", "range": [ 492, 495 ], "loc": { "start": { "line": 21, "column": 25 }, "end": { "line": 21, "column": 28 } } }, "range": [ 479, 495 ], "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 28 } } }, "arguments": [ { "type": "Identifier", "name": "obj", "range": [ 496, 499 ], "loc": { "start": { "line": 21, "column": 29 }, "end": { "line": 21, "column": 32 } } }, { "type": "Identifier", "name": "obj", "range": [ 501, 504 ], "loc": { "start": { "line": 21, "column": 34 }, "end": { "line": 21, "column": 37 } } } ], "range": [ 479, 505 ], "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 38 } } }, "range": [ 479, 506 ], "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 39 } } }, "alternate": null, "range": [ 439, 506 ], "loc": { "start": { "line": 20, "column": 8 }, "end": { "line": 21, "column": 39 } } } ], "range": [ 429, 512 ], "loc": { "start": { "line": 19, "column": 15 }, "end": { "line": 22, "column": 5 } } }, "generator": false, "expression": false, "range": [ 423, 512 ], "loc": { "start": { "line": 19, "column": 9 }, "end": { "line": 22, "column": 5 } } }, "kind": "method", "computed": false, "range": [ 418, 512 ], "loc": { "start": { "line": 19, "column": 4 }, "end": { "line": 22, "column": 5 } }, "static": false }, { "type": "MethodDefinition", "key": { "type": "Identifier", "name": "getHead", "range": [ 518, 525 ], "loc": { "start": { "line": 24, "column": 4 }, "end": { "line": 24, "column": 11 } } }, "value": { "type": "FunctionExpression", "id": null, "params": [ { "type": "Identifier", "name": "obj", "range": [ 526, 529 ], "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 15 } } } ], "body": { "type": "BlockStatement", "body": [ { "type": "VariableDeclaration", "declarations": [ { "type": "VariableDeclarator", "id": { "type": "Identifier", "name": "par", "range": [ 545, 548 ], "loc": { "start": { "line": 25, "column": 12 }, "end": { "line": 25, "column": 15 } } }, "init": { "type": "CallExpression", "callee": { "type": "MemberExpression", "computed": false, "object": { "type": "ThisExpression", "range": [ 551, 555 ], "loc": { "start": { "line": 25, "column": 18 }, "end": { "line": 25, "column": 22 } } }, "property": { "type": "Identifier", "name": "getParent", "range": [ 556, 565 ], "loc": { "start": { "line": 25, "column": 23 }, "end": { "line": 25, "column": 32 } } }, "range": [ 551, 565 ], "loc": { "start": { "line": 25, "column":