| 1549 | } |
| 1550 | |
| 1551 | void |
| 1552 | TrapezoidMapTriFinder::Node::assert_valid(bool tree_complete) const |
| 1553 | { |
| 1554 | #ifndef NDEBUG |
| 1555 | // Check parents. |
| 1556 | for (Parents::const_iterator it = _parents.begin(); |
| 1557 | it != _parents.end(); ++it) { |
| 1558 | Node* parent = *it; |
| 1559 | assert(parent != this && "Cannot be parent of self"); |
| 1560 | assert(parent->has_child(this) && "Parent missing child"); |
| 1561 | } |
| 1562 | |
| 1563 | // Check children, and recurse. |
| 1564 | switch (_type) { |
| 1565 | case Type_XNode: |
| 1566 | assert(_union.xnode.left != 0 && "Null left child"); |
| 1567 | assert(_union.xnode.left->has_parent(this) && "Incorrect parent"); |
| 1568 | assert(_union.xnode.right != 0 && "Null right child"); |
| 1569 | assert(_union.xnode.right->has_parent(this) && "Incorrect parent"); |
| 1570 | _union.xnode.left->assert_valid(tree_complete); |
| 1571 | _union.xnode.right->assert_valid(tree_complete); |
| 1572 | break; |
| 1573 | case Type_YNode: |
| 1574 | assert(_union.ynode.below != 0 && "Null below child"); |
| 1575 | assert(_union.ynode.below->has_parent(this) && "Incorrect parent"); |
| 1576 | assert(_union.ynode.above != 0 && "Null above child"); |
| 1577 | assert(_union.ynode.above->has_parent(this) && "Incorrect parent"); |
| 1578 | _union.ynode.below->assert_valid(tree_complete); |
| 1579 | _union.ynode.above->assert_valid(tree_complete); |
| 1580 | break; |
| 1581 | case Type_TrapezoidNode: |
| 1582 | assert(_union.trapezoid != 0 && "Null trapezoid"); |
| 1583 | assert(_union.trapezoid->trapezoid_node == this && |
| 1584 | "Incorrect trapezoid node"); |
| 1585 | _union.trapezoid->assert_valid(tree_complete); |
| 1586 | break; |
| 1587 | } |
| 1588 | #endif |
| 1589 | } |
| 1590 | |
| 1591 | void |
| 1592 | TrapezoidMapTriFinder::Node::get_stats(int depth, |
no test coverage detected