(inRoot: TreeNode)
| 55 | * Initialize all computational message for following algorithm. |
| 56 | */ |
| 57 | export function init(inRoot: TreeNode) { |
| 58 | const root = inRoot as TreeLayoutNode; |
| 59 | root.hierNode = { |
| 60 | defaultAncestor: null, |
| 61 | ancestor: root, |
| 62 | prelim: 0, |
| 63 | modifier: 0, |
| 64 | change: 0, |
| 65 | shift: 0, |
| 66 | i: 0, |
| 67 | thread: null |
| 68 | }; |
| 69 | |
| 70 | const nodes = [root]; |
| 71 | let node; |
| 72 | let children; |
| 73 | |
| 74 | while (node = nodes.pop()) { // jshint ignore:line |
| 75 | children = node.children; |
| 76 | if (node.isExpand && children.length) { |
| 77 | const n = children.length; |
| 78 | for (let i = n - 1; i >= 0; i--) { |
| 79 | const child = children[i]; |
| 80 | child.hierNode = { |
| 81 | defaultAncestor: null, |
| 82 | ancestor: child, |
| 83 | prelim: 0, |
| 84 | modifier: 0, |
| 85 | change: 0, |
| 86 | shift: 0, |
| 87 | i: i, |
| 88 | thread: null |
| 89 | }; |
| 90 | nodes.push(child); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * The implementation of this function was originally copied from "d3.js" |
no outgoing calls
no test coverage detected
searching dependent graphs…