UNPKG

awv3

Version:
1,657 lines (1,656 loc) 916 kB
{ "type": "Program", "start": 0, "end": 8787, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 220, "column": 0 } }, "sourceType": "module", "body": [ { "type": "ImportDeclaration", "start": 0, "end": 45, "loc": { "start": { "line": 1, "column": 0 }, "end": { "line": 1, "column": 45 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } }, "local": { "type": "Identifier", "start": 7, "end": 17, "loc": { "start": { "line": 1, "column": 7 }, "end": { "line": 1, "column": 17 } }, "name": "Constraint" } } ], "importKind": "value", "source": { "type": "Literal", "start": 23, "end": 44, "loc": { "start": { "line": 1, "column": 23 }, "end": { "line": 1, "column": 44 } }, "value": "sketcher/constraint", "rawValue": "sketcher/constraint", "raw": "'sketcher/constraint'" } }, { "type": "ImportDeclaration", "start": 46, "end": 83, "loc": { "start": { "line": 2, "column": 0 }, "end": { "line": 2, "column": 37 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 53, "end": 59, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } }, "local": { "type": "Identifier", "start": 53, "end": 59, "loc": { "start": { "line": 2, "column": 7 }, "end": { "line": 2, "column": 13 } }, "name": "Sketch" } } ], "importKind": "value", "source": { "type": "Literal", "start": 65, "end": 82, "loc": { "start": { "line": 2, "column": 19 }, "end": { "line": 2, "column": 36 } }, "value": "sketcher/sketch", "rawValue": "sketcher/sketch", "raw": "'sketcher/sketch'" } }, { "type": "ImportDeclaration", "start": 84, "end": 150, "loc": { "start": { "line": 3, "column": 0 }, "end": { "line": 3, "column": 66 } }, "specifiers": [ { "type": "ImportSpecifier", "start": 92, "end": 107, "loc": { "start": { "line": 3, "column": 8 }, "end": { "line": 3, "column": 23 } }, "imported": { "type": "Identifier", "start": 92, "end": 107, "loc": { "start": { "line": 3, "column": 8 }, "end": { "line": 3, "column": 23 } }, "name": "GeometricObject" }, "local": { "type": "Identifier", "start": 92, "end": 107, "loc": { "start": { "line": 3, "column": 8 }, "end": { "line": 3, "column": 23 } }, "name": "GeometricObject" } }, { "type": "ImportSpecifier", "start": 109, "end": 114, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 30 } }, "imported": { "type": "Identifier", "start": 109, "end": 114, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 30 } }, "name": "Point" }, "local": { "type": "Identifier", "start": 109, "end": 114, "loc": { "start": { "line": 3, "column": 25 }, "end": { "line": 3, "column": 30 } }, "name": "Point" } }, { "type": "ImportSpecifier", "start": 116, "end": 120, "loc": { "start": { "line": 3, "column": 32 }, "end": { "line": 3, "column": 36 } }, "imported": { "type": "Identifier", "start": 116, "end": 120, "loc": { "start": { "line": 3, "column": 32 }, "end": { "line": 3, "column": 36 } }, "name": "Line" }, "local": { "type": "Identifier", "start": 116, "end": 120, "loc": { "start": { "line": 3, "column": 32 }, "end": { "line": 3, "column": 36 } }, "name": "Line" } } ], "importKind": "value", "source": { "type": "Literal", "start": 127, "end": 149, "loc": { "start": { "line": 3, "column": 43 }, "end": { "line": 3, "column": 65 } }, "value": "sketcher/geomobjects", "rawValue": "sketcher/geomobjects", "raw": "'sketcher/geomobjects'" } }, { "type": "ImportDeclaration", "start": 151, "end": 177, "loc": { "start": { "line": 4, "column": 0 }, "end": { "line": 4, "column": 26 } }, "specifiers": [ { "type": "ImportDefaultSpecifier", "start": 158, "end": 163, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 12 } }, "local": { "type": "Identifier", "start": 158, "end": 163, "loc": { "start": { "line": 4, "column": 7 }, "end": { "line": 4, "column": 12 } }, "name": "THREE" } } ], "importKind": "value", "source": { "type": "Literal", "start": 169, "end": 176, "loc": { "start": { "line": 4, "column": 18 }, "end": { "line": 4, "column": 25 } }, "value": "three", "rawValue": "three", "raw": "'three'" }, "trailingComments": [ { "type": "CommentLine", "value": "====================== Disjoint Set Union ========================", "start": 179, "end": 247, "loc": { "start": { "line": 6, "column": 0 }, "end": { "line": 6, "column": 68 } }, "range": [ 179, 247 ] } ] }, { "type": "ClassDeclaration", "start": 248, "end": 912, "loc": { "start": { "line": 7, "column": 0 }, "end": { "line": 37, "column": 1 } }, "id": { "type": "Identifier", "start": 254, "end": 257, "loc": { "start": { "line": 7, "column": 6 }, "end": { "line": 7, "column": 9 } }, "name": "DSU", "leadingComments": null }, "superClass": null, "body": { "type": "ClassBody", "start": 258, "end": 912, "loc": { "start": { "line": 7, "column": 10 }, "end": { "line": 37, "column": 1 } }, "body": [ { "type": "MethodDefinition", "start": 264, "end": 319, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 10, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 264, "end": 275, "loc": { "start": { "line": 8, "column": 4 }, "end": { "line": 8, "column": 15 } }, "name": "constructor" }, "static": false, "kind": "constructor", "value": { "type": "FunctionExpression", "start": 275, "end": 319, "loc": { "start": { "line": 8, "column": 15 }, "end": { "line": 10, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [], "body": { "type": "BlockStatement", "start": 278, "end": 319, "loc": { "start": { "line": 8, "column": 18 }, "end": { "line": 10, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 288, "end": 313, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 33 } }, "expression": { "type": "AssignmentExpression", "start": 288, "end": 312, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 32 } }, "operator": "=", "left": { "type": "MemberExpression", "start": 288, "end": 300, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 20 } }, "object": { "type": "ThisExpression", "start": 288, "end": 292, "loc": { "start": { "line": 9, "column": 8 }, "end": { "line": 9, "column": 12 } } }, "property": { "type": "Identifier", "start": 293, "end": 300, "loc": { "start": { "line": 9, "column": 13 }, "end": { "line": 9, "column": 20 } }, "name": "parents" }, "computed": false }, "right": { "type": "NewExpression", "start": 303, "end": 312, "loc": { "start": { "line": 9, "column": 23 }, "end": { "line": 9, "column": 32 } }, "callee": { "type": "Identifier", "start": 307, "end": 310, "loc": { "start": { "line": 9, "column": 27 }, "end": { "line": 9, "column": 30 } }, "name": "Map" }, "arguments": [] } } } ] } } }, { "type": "MethodDefinition", "start": 325, "end": 392, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 14, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 325, "end": 334, "loc": { "start": { "line": 12, "column": 4 }, "end": { "line": 12, "column": 13 } }, "name": "getParent" }, "static": false, "kind": "method", "value": { "type": "FunctionExpression", "start": 334, "end": 392, "loc": { "start": { "line": 12, "column": 13 }, "end": { "line": 14, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 335, "end": 338, "loc": { "start": { "line": 12, "column": 14 }, "end": { "line": 12, "column": 17 } }, "name": "obj" } ], "body": { "type": "BlockStatement", "start": 340, "end": 392, "loc": { "start": { "line": 12, "column": 19 }, "end": { "line": 14, "column": 5 } }, "body": [ { "type": "ReturnStatement", "start": 350, "end": 386, "loc": { "start": { "line": 13, "column": 8 }, "end": { "line": 13, "column": 44 } }, "argument": { "type": "LogicalExpression", "start": 357, "end": 385, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 43 } }, "left": { "type": "CallExpression", "start": 357, "end": 378, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 36 } }, "callee": { "type": "MemberExpression", "start": 357, "end": 373, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 31 } }, "object": { "type": "MemberExpression", "start": 357, "end": 369, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 27 } }, "object": { "type": "ThisExpression", "start": 357, "end": 361, "loc": { "start": { "line": 13, "column": 15 }, "end": { "line": 13, "column": 19 } } }, "property": { "type": "Identifier", "start": 362, "end": 369, "loc": { "start": { "line": 13, "column": 20 }, "end": { "line": 13, "column": 27 } }, "name": "parents" }, "computed": false }, "property": { "type": "Identifier", "start": 370, "end": 373, "loc": { "start": { "line": 13, "column": 28 }, "end": { "line": 13, "column": 31 } }, "name": "get" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 374, "end": 377, "loc": { "start": { "line": 13, "column": 32 }, "end": { "line": 13, "column": 35 } }, "name": "obj" } ] }, "operator": "||", "right": { "type": "Identifier", "start": 382, "end": 385, "loc": { "start": { "line": 13, "column": 40 }, "end": { "line": 13, "column": 43 } }, "name": "obj" } } } ] } } }, { "type": "MethodDefinition", "start": 398, "end": 461, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 18, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 398, "end": 407, "loc": { "start": { "line": 16, "column": 4 }, "end": { "line": 16, "column": 13 } }, "name": "setParent" }, "static": false, "kind": "method", "value": { "type": "FunctionExpression", "start": 407, "end": 461, "loc": { "start": { "line": 16, "column": 13 }, "end": { "line": 18, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 408, "end": 411, "loc": { "start": { "line": 16, "column": 14 }, "end": { "line": 16, "column": 17 } }, "name": "obj" }, { "type": "Identifier", "start": 413, "end": 416, "loc": { "start": { "line": 16, "column": 19 }, "end": { "line": 16, "column": 22 } }, "name": "par" } ], "body": { "type": "BlockStatement", "start": 418, "end": 461, "loc": { "start": { "line": 16, "column": 24 }, "end": { "line": 18, "column": 5 } }, "body": [ { "type": "ExpressionStatement", "start": 428, "end": 455, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 35 } }, "expression": { "type": "CallExpression", "start": 428, "end": 454, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 34 } }, "callee": { "type": "MemberExpression", "start": 428, "end": 444, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 24 } }, "object": { "type": "MemberExpression", "start": 428, "end": 440, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 20 } }, "object": { "type": "ThisExpression", "start": 428, "end": 432, "loc": { "start": { "line": 17, "column": 8 }, "end": { "line": 17, "column": 12 } } }, "property": { "type": "Identifier", "start": 433, "end": 440, "loc": { "start": { "line": 17, "column": 13 }, "end": { "line": 17, "column": 20 } }, "name": "parents" }, "computed": false }, "property": { "type": "Identifier", "start": 441, "end": 444, "loc": { "start": { "line": 17, "column": 21 }, "end": { "line": 17, "column": 24 } }, "name": "set" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 445, "end": 448, "loc": { "start": { "line": 17, "column": 25 }, "end": { "line": 17, "column": 28 } }, "name": "obj" }, { "type": "Identifier", "start": 450, "end": 453, "loc": { "start": { "line": 17, "column": 30 }, "end": { "line": 17, "column": 33 } }, "name": "par" } ] } } ] } } }, { "type": "MethodDefinition", "start": 467, "end": 669, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 27, "column": 5 } }, "computed": false, "key": { "type": "Identifier", "start": 467, "end": 474, "loc": { "start": { "line": 20, "column": 4 }, "end": { "line": 20, "column": 11 } }, "name": "getHead" }, "static": false, "kind": "method", "value": { "type": "FunctionExpression", "start": 474, "end": 669, "loc": { "start": { "line": 20, "column": 11 }, "end": { "line": 27, "column": 5 } }, "id": null, "generator": false, "expression": false, "async": false, "params": [ { "type": "Identifier", "start": 475, "end": 478, "loc": { "start": { "line": 20, "column": 12 }, "end": { "line": 20, "column": 15 } }, "name": "obj" } ], "body": { "type": "BlockStatement", "start": 480, "end": 669, "loc": { "start": { "line": 20, "column": 17 }, "end": { "line": 27, "column": 5 } }, "body": [ { "type": "VariableDeclaration", "start": 490, "end": 520, "loc": { "start": { "line": 21, "column": 8 }, "end": { "line": 21, "column": 38 } }, "declarations": [ { "type": "VariableDeclarator", "start": 494, "end": 519, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 37 } }, "id": { "type": "Identifier", "start": 494, "end": 497, "loc": { "start": { "line": 21, "column": 12 }, "end": { "line": 21, "column": 15 } }, "name": "par" }, "init": { "type": "CallExpression", "start": 500, "end": 519, "loc": { "start": { "line": 21, "column": 18 }, "end": { "line": 21, "column": 37 } }, "callee": { "type": "MemberExpression", "start": 500, "end": 514, "loc": { "start": { "line": 21, "column": 18 }, "end": { "line": 21, "column": 32 } }, "object": { "type": "ThisExpression", "start": 500, "end": 504, "loc": { "start": { "line": 21, "column": 18 }, "end": { "line": 21, "column": 22 } } }, "property": { "type": "Identifier", "start": 505, "end": 514, "loc": { "start": { "line": 21, "column": 23 }, "end": { "line": 21, "column": 32 } }, "name": "getParent" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 515, "end": 518, "loc": { "start": { "line": 21, "column": 33 }, "end": { "line": 21, "column": 36 } }, "name": "obj" } ] } } ], "kind": "var" }, { "type": "IfStatement", "start": 529, "end": 569, "loc": { "start": { "line": 22, "column": 8 }, "end": { "line": 23, "column": 23 } }, "test": { "type": "BinaryExpression", "start": 533, "end": 544, "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 23 } }, "left": { "type": "Identifier", "start": 533, "end": 536, "loc": { "start": { "line": 22, "column": 12 }, "end": { "line": 22, "column": 15 } }, "name": "par" }, "operator": "===", "right": { "type": "Identifier", "start": 541, "end": 544, "loc": { "start": { "line": 22, "column": 20 }, "end": { "line": 22, "column": 23 } }, "name": "obj" } }, "consequent": { "type": "ReturnStatement", "start": 558, "end": 569, "loc": { "start": { "line": 23, "column": 12 }, "end": { "line": 23, "column": 23 } }, "argument": { "type": "Identifier", "start": 565, "end": 568, "loc": { "start": { "line": 23, "column": 19 }, "end": { "line": 23, "column": 22 } }, "name": "obj" } }, "alternate": null }, { "type": "VariableDeclaration", "start": 578, "end": 607, "loc": { "start": { "line": 24, "column": 8 }, "end": { "line": 24, "column": 37 } }, "declarations": [ { "type": "VariableDeclarator", "start": 582, "end": 606, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 36 } }, "id": { "type": "Identifier", "start": 582, "end": 586, "loc": { "start": { "line": 24, "column": 12 }, "end": { "line": 24, "column": 16 } }, "name": "head" }, "init": { "type": "CallExpression", "start": 589, "end": 606, "loc": { "start": { "line": 24, "column": 19 }, "end": { "line": 24, "column": 36 } }, "callee": { "type": "MemberExpression", "start": 589, "end": 601, "loc": { "start": { "line": 24, "column": 19 }, "end": { "line": 24, "column": 31 } }, "object": { "type": "ThisExpression", "start": 589, "end": 593, "loc": { "start": { "line": 24, "column": 19 }, "end": { "line": 24, "column": 23 } } }, "property": { "type": "Identifier", "start": 594, "end": 601, "loc": { "start": { "line": 24, "column": 24 }, "end": { "line": 24, "column": 31 } }, "name": "getHead" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 602, "end": 605, "loc": { "start": { "line": 24, "column": 32 }, "end": { "line": 24, "column": 35 } }, "name": "par" } ] } } ], "kind": "var" }, { "type": "ExpressionStatement", "start": 616, "end": 642, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 34 } }, "expression": { "type": "CallExpression", "start": 616, "end": 641, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 33 } }, "callee": { "type": "MemberExpression", "start": 616, "end": 630, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 22 } }, "object": { "type": "ThisExpression", "start": 616, "end": 620, "loc": { "start": { "line": 25, "column": 8 }, "end": { "line": 25, "column": 12 } } }, "property": { "type": "Identifier", "start": 621, "end": 630, "loc": { "start": { "line": 25, "column": 13 }, "end": { "line": 25, "column": 22 } }, "name": "setParent" }, "computed": false }, "arguments": [ { "type": "Identifier", "start": 631, "end": 634, "loc": {