* Get next sibling of a node or node id. * @param {string | Node} node * @returns {Node | null}
(node)
| 161 | * @returns {Node | null} |
| 162 | */ |
| 163 | get_node_after(node) { |
| 164 | if (!Node.is_node(node)) { |
| 165 | var the_node = this.get_node(node); |
| 166 | if (!the_node) { |
| 167 | logger.error('the node[id=' + node + '] can not be found.'); |
| 168 | return null; |
| 169 | } else { |
| 170 | return this.get_node_after(the_node); |
| 171 | } |
| 172 | } |
| 173 | if (node.isroot) { |
| 174 | return null; |
| 175 | } |
| 176 | var idx = node.index; |
| 177 | var brothers = node.parent.children; |
| 178 | if (brothers.length > idx) { |
| 179 | return node.parent.children[idx]; |
| 180 | } else { |
| 181 | return null; |
| 182 | } |
| 183 | } |
| 184 | /** |
| 185 | * Move a node to new parent/position. |
| 186 | * @param {Node} node |
no test coverage detected