copy the color from one node to another, dealing with the fact that one or both nodes may, in fact, be null @param from the node whose color we're copying; may be null @param to the node whose color we're changing; may be null @param index _KEY or _VALUE
(Node from, Node to, int index)
| 572 | * @param index _KEY or _VALUE |
| 573 | */ |
| 574 | private static void copyColor(Node from, Node to, int index) |
| 575 | { |
| 576 | if (to != null) |
| 577 | { |
| 578 | if (from == null) |
| 579 | { |
| 580 | |
| 581 | // by default, make it black |
| 582 | to.setBlack(index); |
| 583 | } |
| 584 | else |
| 585 | { |
| 586 | to.copyColor(from, index); |
| 587 | } |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | /** |
| 592 | * is the specified node red? if the node does not exist, no, it's |
no test coverage detected