Set the node heights from the current node branch lengths. Actually sets distance from root so the heights then need to be reversed.
(ReRootedNode node, double height)
| 526 | * sets distance from root so the heights then need to be reversed. |
| 527 | */ |
| 528 | private void nodeLengthsToHeights(ReRootedNode node, double height) { |
| 529 | |
| 530 | double newHeight = height; |
| 531 | |
| 532 | if (node.getLength() > 0.0) { |
| 533 | newHeight += node.getLength(); |
| 534 | } |
| 535 | |
| 536 | node.setHeight(newHeight); |
| 537 | |
| 538 | for (Node child : node.getChildren()) { |
| 539 | nodeLengthsToHeights((ReRootedNode)child, newHeight); |
| 540 | } |
| 541 | } |
| 542 | |
| 543 | /** |
| 544 | * Calculate branch lengths from the current node heights. |
no test coverage detected